# Why did you add 3?

R

NICE WORK! The only problem is that fractions are rounded by QB to integer values, which causes a slight deviation from perfection. Try a bigger triangle in SCREEN 12. It won't be as noticeable. The pixels are smaller too!

Ted

SCREEN 13
'Random values for three points I came up with
x1 = 70
y1 = 170
x2 = 100
y2 = 60
x3 = 260
y3 = 170

'Plot the three points
PSET (x1, y1)
PSET (x2, y2)
PSET (x3, y3)
'Really, the distance between the first and final points,
'but also used to find the rate that the other two lines
'draw themselves, hence the variable name
ratex = x3 - x1
'The rates at which the two other lines draw themselves
'in order to keep up speed with the line between the
'first and final points, delineated by axis
rate1x = (x2 - x1) / ratex
rate1y = (y2 - y1) / ratex
rate2x = (x3 - x2) / ratex
rate2y = (y3 - y2) / ratex
'My loop
Delay 2
FOR x = 1 TO ratex
Delay .2
'Determine the coordinates at which a point will be drawn
'in order to subsequently draw a line between the first
'and second points ...
a = x * rate1x
b = x * rate1y
'... and the second and third points
c = x * rate2x
d = x * rate2y
'Draw them
PSET (a + x1, b + y1)
PSET (c + x2, d + y2)
'Draw the main line from beginning to end
PSET (x + x1, y1)
'Draw a line from each point on the two lines
' LINE (a + x1 + 3, b + y1)-(c + x2 - 3, d + y2), 15
LINE (a + x1, b + y1)-(c + x2, d + y2), 15
NEXT x

SUB Delay (dlay!)
start! = TIMER
DO WHILE start! + dlay! >= TIMER
IF start! > TIMER THEN start! = start! - 86400
LOOP
END SUB

 This message has been edited by burger2227 on Nov 22, 2010 11:35 PMThis message has been edited by burger2227 on Nov 22, 2010 11:25 PM

Posted on Nov 22, 2010, 11:06 PM

 Response Title Author and Date Mmmm Sean on Nov 23 Well, the line that is drawn is just the tangent line of the curve. Clippy on Nov 23