Quote:Do you think it would be better if I give the programmer the option to choose where 0 degrees lies? Perhaps a CONST to be set such as ZERO=NORTH, ZERO=EAST, etc?
It's not an arbitrary thing to just say 0 = North. When you build a clock in Basic don't you have to subtract 90 degrees off all the angles to put 12 (= 0) at the North side of clock? Basic would have 12 o'clock pointed due East.
When you draw an equilateral triangle about a point x, y center, you have to subtract 90 degrees (or add 270 degrees) if you want the triangle pointed North instead of East.
Code: (Select All)
Screen _NewImage(800, 600, 32)
' draw triangle about 400, 300 at 100 radius
cx = 400
cy = 300
angle = 0 ' <<<< start angle at 0
x = cx + 100 * Cos(angle)
y = cy + 100 * Sin(angle)
anotherLine:
angle = angle + _Pi(2 / 3) ' add 120 degrees
newX = cx + 100 * Cos(angle)
newY = cy + 100 * Sin(angle)
Line (x, y)-(newX, newY)
lines = lines + 1
x = newX
y = newY
If lines < 3 Then GoTo anotherLine
Print "Press any for yellow triangle pointed North."
Sleep
Cls
' for triangle pointed north
angle = _Pi(3 / 2) ' <<<< start angle at 270 degrees = 3*Pi/2
x = cx + 100 * Cos(angle)
y = cy + 100 * Sin(angle)
lines = 0
anotherLine2:
angle = angle + _Pi(2 / 3) ' add 120 degrees
newX = cx + 100 * Cos(angle)
newY = cy + 100 * Sin(angle)
Line (x, y)-(newX, newY), &HFFFFFF00
lines = lines + 1
x = newX
y = newY
If lines < 3 Then GoTo anotherLine2
In Basic, 0 degrees is due East of any given point x, y according to Basic Trig functions COS and SIN.
Cos(0) = 1, Sin(0) = 0 Heck that's not just Basic, Math says that too!
b = b + ...