Cubic Nexorade

Author:
Thijs
Topic:
Cylinder
Setup O = ( 0, 0, 0) V0 = ( 1, 1, 1) V1 = (-1, 1, 1) ϕ = Slider(2°,88°,0.5°, 1, 240, true, true, false) lineA = Rotate(Line(V1, V0), ϕ, Line(O,Midpoint(V1,V0))) lineC = Rotate(lineA, 240°, Line(O,V0)) perpCA= PerpendicularLine(lineC, lineA) A1 = Intersect(perpCA,lineA) A2 = Reflect(A1, Midpoint(V1,V0)) len = Distance(A1,A2) ecc = Distance(lineA,lineC) fact= (len+ecc)/len A1d = Dilate(A1, fact, Midpoint(V1,V0)) A2d = Dilate(A2, fact, Midpoint(V1,V0)) nexor1 = {Cylinder(A1d, A2d, ecc/2)} nexor2 = Rotate(nexor1, 120°, Line(O, V0)) nexor3 = Rotate(nexor1, 240°, Line(O, V0)) Lnexor1 = zip(rotate(nexor1,k*90°,xAxis),k,{0,2}) Lnexor2 = zip(rotate(nexor2,k*90°,yAxis),k,{0,2}) Lnexor3 = zip(rotate(nexor3,k*90°,zAxis),k,{0,2}) Lnexor4 = zip(rotate(nexor1,k*90°,xAxis),k,{1,3}) Lnexor5 = zip(rotate(nexor2,k*90°,yAxis),k,{1,3}) Lnexor6 = zip(rotate(nexor3,k*90°,zAxis),k,{1,3}) On = true #------------------------ # Settings #------------------------ SetCoords(ϕ, 140, 50) SetColor(ϕ,"Black") SetValue(ϕ,20°) SetActiveView(-1) SetBackgroundColor("Black") Q=UnicodeToLetter(34) List={"Red","Green","Blue","Cyan","Magenta","Yellow"} Execute(Zip("SetColor(Lnexor"+k+"1,"+Q+txt+Q+")",k,1..6, txt,List)) Execute(Zip("SetFilling(Lnexor"+k+",1)",k,1..6)) Execute(Zip("SetLineThickness(Lnexor"+k+",2)",k,1..6)) List={"O","V0","V1","A1","A2","A1d","A2d","lineA","lineC","perpCA","Q"} Execute(Zip("SetConditionToShowObject("+obj+",false)",obj,List)) Execute(Zip("SetConditionToShowObject(nexor"+k+",false)",k,1..3)) Delete(List) #------------------------ # Start button : On Click #------------------------ SetActiveView(-1) CenterView((0,0,0)) SetValue(On,If(On,false,true)) SetCaption(buttStart,If(On,"Stop","Start")) SetSpinSpeed(If(On,1,0)) StartAnimation(ϕ,If(On,true,false))