cx% = -100: cy% = 400 '3D space origin
points(0).x = 150 'start point
points(0).y = 50
points(0).z = 0
points(1).x = 50 'control point (handle)
points(1).y = 430
points(1).z = 300
points(2).x = 590 'control point (handle)
points(2).y = 350
points(2).z = -500
points(3).x = 320 'control point (handle)
points(3).y = 160
points(3).z = 300
points(4).x = 590 'end point
points(4).y = 50
points(4).z = 0
again:
Line3D i%, 0, 0, i%, 700, 0, 15
Line3D 0, i%, 0, 700, i%, 0, 15
CalcFracPoints points(), spans(), f#
Circle3D x#, y#, z#, 1, 0, 12
DrawLines points()
DrawLines spans()
Circle3D spans(i%).x, spans(i%).y, spans(i%).z, 1, 0, 14
Circle3D x#, y#, z#, 2, 0, 4
iLns%
= UBOUND(pIn
) - LBOUND(pIn
) 'no +1 here, as lines = 1 less than pointsoPts% = (iLns% * (iLns% + 1)) / 2 'sum 1 to n, which is n(n+1)/2
p% = 0
pOut(p%).x = pIn(i%).x + frac# * (pIn(i% + 1).x - pIn(i%).x)
pOut(p%).y = pIn(i%).y + frac# * (pIn(i% + 1).y - pIn(i%).y)
pOut(p%).z = pIn(i%).z + frac# * (pIn(i% + 1).z - pIn(i%).z)
p% = p% + 1
pOut(p% - 1).s = -1 'stop flag for drawing
FOR i%
= p%
- j%
TO p%
- 2 pOut(p%).x = pOut(i%).x + frac# * (pOut(i% + 1).x - pOut(i%).x)
pOut(p%).y = pOut(i%).y + frac# * (pOut(i% + 1).y - pOut(i%).y)
pOut(p%).z = pOut(i%).z + frac# * (pOut(i% + 1).z - pOut(i%).z)
p% = p% + 1
pOut(p% - 1).s = -1 'stop flag for drawing
col~& = 1
Line3D pIn(i%).x, pIn(i%).y, pIn(i%).z, pIn(i% + 1).x, pIn(i% + 1).y, pIn(i% + 1).z, col~&
col~&
= (col~&
+ 1) AND 15 i% = i% + 1 'skip to next sequence
SUB Line3D
(x1%
, y1%
, z1%
, x2%
, y2%
, z2%
, col%
) 'x1%/y1%/z1% = start, x2%/y2%/z2% = end, col% = color pen
x1# = (x1% + (y1% * 0.1)): z1# = (z1% + (y1% * 0.1))
x2# = (x2% + (y2% * 0.1)): z2# = (z2% + (y2% * 0.1))
LINE (x1#
+ cx%
- 1, -z1#
+ cy%
)-(x2#
+ cx%
- 1, -z2#
+ cy%
), col%
LINE (x1#
+ cx%
, -z1#
+ cy%
)-(x2#
+ cx%
, -z2#
+ cy%
), col%
LINE (x1#
+ cx%
+ 1, -z1#
+ cy%
)-(x2#
+ cx%
+ 1, -z2#
+ cy%
), col%
SUB Circle3D
(x%
, y%
, z%
, r%
, ba%
, col%
) 'x%/y%/z% = center, r% = radius, ba% = B-Axis angle, col% = color pen
mx# = (x% + (y% * 0.1)): mz# = (z% + (y% * 0.1))
zx#
= r%
* COS(ba%
* 0.017453292519943)zz#
= r%
* SIN(ba%
* 0.017453292519943) x#
= zx#
* COS(cir%
* 0.017453292519943) y#
= r%
* SIN(cir%
* 0.017453292519943) z#
= zz#
* COS(cir%
* 0.017453292519943) x# = (x# + (y# * 0.1)): z# = (z# + (y# * 0.1))
LINE (x#
+ mx#
+ cx%
- 1, -z#
+ -mz#
+ cy%
- 1)-(x#
+ mx#
+ cx%
+ 1, -z#
+ -mz#
+ cy%
+ 1), col%
, BF