Author:
Thijs
Topic:
Cylinder
Setup O = ( 0, 0, 0) V0 = ( 1, 1 ,1) V1 = ( 1,-1,-1) ϕ = Slider(5°,85°,0.5°, 1, 240, true, true, false) lineA = Rotate(Line(V1, V0), ϕ, xAxis) 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, (1,0,0)) A2d = Dilate(A2, fact, (1,0,0)) Lnexor1 = {Cylinder(A1d, A2d, ecc/2)} Lnexor2 = Rotate(Lnexor1, 120°, Line(O,V0)) Lnexor3 = Rotate(Lnexor1, 240°, Line(O,V0)) Lnexor4 = Rotate(Lnexor3, 120°, Line(O,V1)) Lnexor5 = Rotate(Lnexor4, 120°, Line(O,V0)) Lnexor6 = Rotate(Lnexor4, 240°, Line(O,V0)) 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)) 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))