07-03-2023, 03:52 AM
If I understand correctly, is this the sort of thing you're looking for? It now subjects each point to a transformation matrix operation. That's somewhat more trig work than before. Now it creates the plot (x, y) relative to a (0, 0) origin, performs the rotation (in radians), and THEN centers it in the screen after it's properly plotted and rotated. If you prefer degrees then just; rotate! = _D2R(degrees)
Code: (Select All)
'de La Hire's method of ellipse
'geometric construction of two concentric circles
'the outermost diameter equals the desired ellipse's
'semi major axis, while the inner circle matches the
'semi minor axis.
'a full 360ø rotation is executed and the positions
'are plotted using a COS function of the outer circle's
'resulting X position and SIN function of the inner
'circle's Y position.
SCREEN _NEWIMAGE(1024, 512, 32)
cen_x% = 512 ' screen center x
cen_y% = 256 ' screen center y
semi_maj% = 200 ' Semi major axis of ellipse i.e. outer circle
semi_min% = 105 ' Semi minor axis of ellipse i.e. inner circle
rotate! = .75 ' radian rotation of ellipse
cursx% = semi_maj% * COS(rotate!)
cursy% = semi_maj% * SIN(rotate!)
PSET (cursx% + cen_x%, cursy% + cen_y%) ' pre-position graphics cursor
FOR ang = 0 TO 2 * _PI STEP .01 ' granularity of 1/100 radian
x% = semi_maj% * COS(ang) ' x position a COS function of the outer circle
y% = semi_min% * SIN(ang) ' y position a SIN function of the inner circle
xr% = x% * COS(rotate!) - y% * SIN(rotate!) + cen_x%
yr% = x% * SIN(rotate!) + y% * COS(rotate!) + cen_y%
LINE STEP(0, 0)-(xr%, yr%) ' line from previous cursor position
NEXT ang
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
sha_na_na_na_na_na_na_na_na_na: