Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Draw a bezier curve
- SUB Curve (pointAX AS DOUBLE, pointAY AS DOUBLE, controlAX AS DOUBLE, controlAY AS DOUBLE, pointBX AS DOUBLE, pointBY AS DOUBLE, controlBX AS DOUBLE, controlBY AS DOUBLE, detail AS INTEGER, colour AS INTEGER, pattern AS INTEGER)
- 'Half-way point
- DIM pointNX AS DOUBLE
- DIM pointNY AS DOUBLE
- 'Center of triangle: pointA -> controlA -> pointN
- DIM pointCX AS DOUBLE
- DIM pointCY AS DOUBLE
- 'Center of triangle: pointN -> controlB -> pointB
- DIM pointDX AS DOUBLE
- DIM pointDY AS DOUBLE
- 'Halfway between the two new controls
- DIM pointEX AS DOUBLE
- DIM pointEY AS DOUBLE
- IF detail = 0 THEN
- 'If this is the last line of detail just draw a line betwen the two points
- LINE (INT(pointAX), INT(pointAY))-(INT(pointBX), INT(pointBY)), colour,,pattern
- ELSE
- 'Find half way between controlA and controlB
- pointNX = (controlAX + controlBX) / 2
- pointNY = (controlAY + controlBY) / 2
- 'Find the center of the triangle pointA -> controlA -> and pointN
- pointCX = (pointAX + controlAX + pointNX) / 3
- pointCY = (pointAY + controlAY + pointNY) / 3
- 'Find the center of the triangle pointN -> controlB -> and pointB
- pointDX = (pointNX + controlBX + pointBX) / 3
- pointDY = (pointNY + controlBY + pointBY) / 3
- 'The control point is halfway between controlA and pointC (center of triangle)
- controlCX = (controlAX + pointCX) / 2
- controlCY = (controlAY + pointCY) / 2
- 'The second control point is halfway between controlB and pointD (center of triangle)
- controlDX = (controlBX + pointDX) / 2
- controlDY = (controlBY + pointDY) / 2
- 'The new destination point is halfway between pointC and pointD
- pointEX = (pointCX + pointDX) / 2
- pointEY = (pointCY + pointDY) / 2
- 'Draw a curve from pointA to pointE
- Curve pointAX, pointAY, pointCX, pointCY, pointEX, pointEY, pointCX, pointCY, detail - 1, colour,pattern
- 'Draw a curve from pointE to pointB
- Curve pointEX, pointEY, pointDX, pointDY, pointBX, pointBY, pointDX, pointDY, detail - 1, colour,pattern
- END IF
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement