The QBasic Forum      Other Subforums, Links and Downloads
  << Previous Topic | Next Topic >>Return to Index  

I remember when i was little boy

March 21 2009 at 8:53 AM
Lisztfr  (no login)

Whatever, some of you may know, for very long time there was a tool, a physical tool to reproduce or resize an drawing. I don't remember the name and can't find it on google, so let me explain : On one end you hold a pencil, drawing the original, and on the other end there was another pencil which draw the resized pic. The pencils where connected through this undescriptible (but simple) mecanisme i can't tell in english, hey .. there was a fixed plot and the 2 pencils where waving around. It was like pliers. Hence i want to make that run in Qbasic.

L

 
 Respond to this message   
AuthorReply

(Login burger2227)
R

* It is called a Proportional Divider tool

March 21 2009, 11:05 AM 






 
 Respond to this message   
qbguy
(Login dean.menezes)
R

It's called a pantograph

March 21 2009, 12:02 PM 

What do I win?

 
 Respond to this message   
Lisztfr
(no login)

Sounds familiar to me

March 21 2009, 12:22 PM 

But here it is :

http://cjoint.com/data/dxusJspJUY.htm

The green plots are pencils, the black plot is the fixed center. I never used such a thing... but i was wondering if i could make a sort of zoom using the idea in qb.

Guess it's all pythagora.

L


 
 Respond to this message   
Ben
(no login)

* What version of QBasic do you use?

March 21 2009, 12:26 PM 


 
 Respond to this message   

(Login burger2227)
R

* Is this another SCREEN 2 adventure?

March 21 2009, 12:56 PM 


 
 Respond to this message   
Lisztfr
(no login)

huh, yeah...

March 22 2009, 3:50 AM 

I changed my mind.

I will draw a shadow behind the object, since this is relative easy. the coordinates of the shadow points are :

If the light spot is before the object at distance 1 at the left bottom, the plan of the shadow is behind the object at distance 1, the shadow will be twice so high than the object, and :


Shadow coordinates for a point(x, y) = X, Y are function of the distance to bottom * factor (=(distance plan/distance spot) * 2, or something alike)

One must remember however that the shadow will hold as much points as the object, NO MORE ! since the shadow is bigger than the object, it will contain holes... So if one would like to achieve a plain colored (screen 2 = black) shadow, this is more difficult imho.

L

 
 Respond to this message   
Lisztfr
(no login)

Here is my program....

March 22 2009, 2:06 PM 

Any idea to make is less ugly ??? the worst program ever :

'-----------begin-------------

SCREEN 2
CLS

'set the spot distance (the plane is behind the object, at -1 unit)
'F = factor : rapport des distances. Ex :

F = 1 / 2 'means, the spot is n units before the object


'Set the box

LINE (169, 39)-(371, 131), 1, B, &HF0F0

SLEEP 1

CLS



'draw object

LINE (300, 80)-(320, 100), 1, BF
LINE (296, 75)-(325, 105), 1, B


'get the spot coordinates, from the right bottom, XS, YS :

XS = 0: YS = 0

FOR xx = 370 TO 170 STEP -1
FOR yy = 40 TO 130
IF POINT(xx, yy) = 1 THEN XS = xx: EXIT FOR
NEXT yy
IF XS <> 0 THEN EXIT FOR
NEXT xx


FOR yy = 130 TO 40 STEP -1
FOR xx = 170 TO 370
IF POINT(xx, yy) = 1 THEN YS = yy: EXIT FOR
NEXT xx
IF YS <> 0 THEN EXIT FOR
NEXT yy


PRINT XS, YS

'draw the shadow, from top :

FOR y = 40 TO 130
FOR x = 170 TO 370
IF POINT(x, y) = 1 THEN PSET (x + ((x - XS) * F), y + ((y - YS) * F)), 1
NEXT x
NEXT y


END



 
 Respond to this message   
Lisztfr
(no login)

Less crapy....

March 22 2009, 2:38 PM 

A cheap "fix" : i draw not every point so i avoid the round-up pattern

'-----------------start---------------

SCREEN 2
CLS

'set the spot distance (the plane is behind the object, at -1 unit)
'F = factor : rapport des distances. Ex :

F = 1 / 3 'means, the spot is n units before the object


'Set the box

LINE (169, 39)-(371, 131), 1, B, &HF0F0

SLEEP





'draw object

'LINE (300, 80)-(320, 100), 1, BF
'LINE (296, 75)-(325, 105), 1, B


CIRCLE (300, 100), 30
PAINT (300, 100), 1




'get the spot coordinates, from the right bottom, XS, YS :

XS = 0: YS = 0

FOR xx = 370 TO 170 STEP -1
FOR yy = 40 TO 130
IF POINT(xx, yy) = 1 THEN XS = xx: EXIT FOR
NEXT yy
IF XS <> 0 THEN EXIT FOR
NEXT xx


FOR yy = 130 TO 40 STEP -1
FOR xx = 170 TO 370
IF POINT(xx, yy) = 1 THEN YS = yy: EXIT FOR
NEXT xx
IF YS <> 0 THEN EXIT FOR
NEXT yy


PRINT XS, YS

'draw the shadow, from top :

FOR y = 40 TO 130 STEP 2
FOR x = 170 TO 370 STEP 2
IF POINT(x, y) = 1 THEN PSET (x + ((x - XS) * F), y + ((y - YS) * F)), 1
NEXT x
NEXT y


END



 
 Respond to this message   
Lisztfr
(no login)

A brilliant shadow

March 23 2009, 6:17 AM 

Like sunshine :


'--------------start---------------

SCREEN 2
CLS

RANDOMIZE TIMER

'set the spot distance (the plane is behind the object, at -1 unit)
'F = factor : rapport des distances. Ex :

F = 1 / 5 'means, the spot is n units before the object


'Set the box

LINE (169, 39)-(371, 131), 1, B, &HF0F0

SLEEP





'draw object

'LINE (300, 80)-(320, 100), 1, BF
'LINE (296, 75)-(325, 105), 1, B


CIRCLE (300, 100), 30
PAINT (300, 100), 1




'get the spot coordinates, from the right bottom, XS, YS :

XS = 0: YS = 0

FOR xx = 370 TO 170 STEP -1
FOR yy = 40 TO 130
IF POINT(xx, yy) = 1 THEN XS = xx: EXIT FOR
NEXT yy
IF XS <> 0 THEN EXIT FOR
NEXT xx


FOR yy = 130 TO 40 STEP -1
FOR xx = 170 TO 370
IF POINT(xx, yy) = 1 THEN YS = yy: EXIT FOR
NEXT xx
IF YS <> 0 THEN EXIT FOR
NEXT yy


PRINT XS, YS

XS = XS + 200
'YS = YS + 10


'draw the shadow, from top :

FOR y = 40 TO 130 STEP 2
FOR x = 170 TO 370 STEP 2
IF POINT(x, y) = 1 THEN
a = RND * 2 + 1
PSET (x + ((x - XS) * F + a), y + ((y - YS) * F) + a), 1
END IF
NEXT x
NEXT y


END



 
 Respond to this message   
Current Topic - I remember when i was little boy
  << Previous Topic | Next Topic >>Return to Index