Starting The Cave

SzgLink Initialization

$Version
SetDirectory[NotebookDirectory[]]
<<SzgLink`
?SzgLink`*
machineip="130.126.127.24"
port1 ="9996";
port2 = ToString[ToExpression[port1]+1];
(* Ports for caveMathematica -> Mathematica communication *)
masterport1 = ToString[ToExpression[port2]+1]
masterport2 = ToString[ToExpression[masterport1]+1]
$szglink = Install[port1<>"@"<>machineip<>","<>port2<>"@"<>machineip, LinkMode->Listen, LinkProtocol->"TCPIP"]

Launch Syzygy Application

Now, in a console:                           dex vccube cavemathematica 130.126.127.24

Now on a console, dex vccube 
Standalone:
	caveMathematica <ip_address> [<port>]
For a cluster:
 dex <virtual_computer> caveMathematica <ip_address> [<port>]
      (<ip_address> is the address of this computer that you evaluated above, <port> is optional. If you left port1 as 9996 above, omit it).

caveMathematica MathLink shared link

CaveOpenSecondaryLink[" -linkconnect -linkprotocol tcpip -linkname "<>masterport1<>"@"<>machineip<>","<>masterport2<>"@"<>machineip]
$szgcavelink = LinkOpen[masterport1<>"@"<>machineip<>","<>masterport2<>"@"<>machineip,LinkMode->Listen, LinkProtocol->"TCPIP"]
MathLink`AddSharingLink[$szgcavelink,MathLink`AllowPreemptive->True]

Now press button 1 in caveMathematica to stablish the mathlink connection. Then evaluate e.g. "funny sphere" below.

??SzgLink`RenderSZG

When done, in console:  dkillall vccube

Examples

Objects

Manipulate[CaveFlyOrigin[x,y,z],{{x,0.,"X:"},-10.,10.,0.1},{{y,0.,"Y:"},-10.,10.,0.1},{{z,0.,"Z:"},-10.,10.,0.1}]

Manipulate[{CavePath[spath],CaveCart[scart],CaveStars[sstars]},{spath,{True,False}},{scart,{True,False}},{sstars,{True,False}}]

CaveMeshColor[{1.0,1.0,0.0}]

CavePolygonColor[{1,1,0}]

CaveBackgroundColor[{1,1,1}]

CaveClearObject["WandGlypth"]

CaveClearObject["FlyGlypth"]

CaveClearObject["FlyTrack"]

Glyphs

WandSZG[]

WandSZG[]

FlySZG[]

Example 1.

(*funny sphere*)
RenderSZG[SphericalPlot3D[1+Sin[5 ϕ] Sin[10 θ]/10,{θ,0,π},{ϕ,0,2π},ColorFunction->(ColorData["Rainbow"][#6]&),Mesh->None,PlotPoints->25,Boxed->False,Axes->False]]

WandSZG[]

WandSZG[]

Example 2

(*funny sphere*)
SphericalPlot3D[1+Sin[5 ϕ] Sin[10 θ]/10,{θ,0,π},{ϕ,0,2π},ColorFunction->(ColorData["Rainbow"][#6]&),Mesh->None,PlotPoints->25,Boxed->False,Axes->False,DisplayFunction:>((RenderSZG[#];#)&)]

Example 3

RenderSZG[SphericalPlot3D[Sin[5x + 7 y],x,y,ColorFunction->(ColorData["Rainbow"][#6]&),Mesh->None,PlotPoints->35,Boxed->False,Axes->False,MaxRecursion->3]]

Example 4

(*swirly thing*)
turn=9;
ext=2;
knot=4;
dist=1;
dia=0.2;
par=ParametricPlot3D[{(ext+Cos[turn x]) Cos[knot x],(ext+Cos[turn x]) Sin[knot x],dist Sin[turn x]},{x,0,2 Pi},PlotStyle->Tube[dia],PlotRange->All,Axes->False,Boxed->False,ViewPoint->{0,0,6},ColorFunction->"DeepSeaColors",ImageSize->{400,300},DisplayFunction:>((RenderSZG[#];#)&)]

Example 5

(*elevation data*)
rawHelen=Developer`ToPackedArray[Get["Helens.dat"]];
Helen = 2. rawHelen/8000.;

Dimensions[Helen]

ListPlot3D[Helen,MaxPlotPoints->150,Mesh->None,ColorFunction->"Topographic",DataRange->{{-5,5},{-5,5}},DisplayFunction:>((RenderSZG[#];#)&)]

Example 6

(*Animated Venus*)
α=1.73;
β=.75;

eVenus[λ_,η_,θ_,t_]:=((Cos[λ]+Sin[λ] Cos[η])/(1-((Sin[t] Sin[3θ] Sin[2η])/(Sqrt[2]))))(({{Cos[2θ] Cos[η]+β Sin[η] Cos[θ]}, {Sin[2θ] Cos[η]-β Sin[η] Sin[θ]}, {α Cos[η]}}));

Manipulate[ParametricPlot3D[eVenus[szgλ,η,θ,szgt],{η,0,2π},{θ,0,2π},PerformanceGoal->"Quality",PlotRange->{{-5,5},{-5,5},{-5,5}},Mesh->False, MaxRecursion->2,ColorFunction->"BrightBands",PlotPoints->15],{szgλ,0,Pi/2,Pi/50},{szgt,0,Pi/2,Pi/50}]

Example 7

(* CaveEvaluateButtons[up, down, select] *)
CaveEvaluateButtons[4,5,6]

szgx = 0;
szgy = 0;
CaveClearVariables[];
CaveAddVariable["szgx",0.,1.,0.1];
CaveAddVariable["szgy",0.,2.,0.1];

Slider[Dynamic[szgx] ,{0,1}]
Slider[Dynamic[szgy] ,{0,2}]

Dynamic[Plot3D[Sin[ szgx x+szgy Cos[y]],{x,-Pi,Pi},{y,-Pi,Pi},PlotPoints->{15,15},MaxRecursion->0,Mesh->None,ColorFunction->"BrightBands",DisplayFunction:>((RenderSZG[#];#)&)]]

(* !! Do not forget to delete the dynamic cells before trying the next examples !! *)

Example 8

(*Venus*)
α=1.73;
β=.75;

eVenus[λ_,η_,θ_,t_]:=((Cos[λ]+Sin[λ] Cos[η])/(1-((Sin[t] Sin[3θ] Sin[2η])/(Sqrt[2]))))(({{Cos[2θ] Cos[η]+β Sin[η] Cos[θ]}, {Sin[2θ] Cos[η]-β Sin[η] Sin[θ]}, {α Cos[η]}}));
szgu=0;
szgt=0;
CaveClearVariables[];
CaveAddVariable["szgu",0.,1.5708,0.05];
CaveAddVariable["szgt",0.,1.5708,0.05];
Slider[Dynamic[szgλ],{0,Pi/2}]
Slider[Dynamic[szgt],{0,Pi/2}]
Dynamic[ParametricPlot3D[eVenus[szgλ,η,θ,szgt],{η,0,2π},{θ,0,2π},PlotRange->{{-5,5},{-5,5},{-5,5}},Mesh->False, MaxRecursion->0,DisplayFunction:>((RenderSZG[#];#)&),ColorFunction->"BrightBands",PlotPoints->45]]

(* !! Do not forget to delete the dynamic cells before trying the next examples !! *)

Example 7

CaveClearVariables[];
CaveFlyButtons[4,5,6]

path=ParametricPlot3D[2{Sin[t],Cos[t],1},{t,0,2Pi},PlotRange->All,MaxRecursion->1,PlotPoints->15];
trackpath = Cases[path,a_Line:>a[[1]],Infinity][[1]];

CaveFlyPath[trackpath,{{}},{{}},{{}},60]

Plot3D[Sin[x+Cos[y]],{x,-Pi,Pi},{y,-Pi,Pi},PlotPoints->{10,10},MaxRecursion->0,Mesh->None,ColorFunction->"BrightBands",DisplayFunction:>(RenderSZG[#]&)]

Example 8

Rollercoaster

CaveClearVariables[];
CaveFlyButtons[4,5,6]
CaveClearObject["FlyTrack"]

RenderSZG[SphericalPlot3D[1+Sin[5 ϕ] Sin[10 θ]/10,{θ,0,π},{ϕ,0,2π},ColorFunction->(ColorData["Rainbow"][#6]&),Mesh->None,PlotPoints->25,Boxed->False,Axes->False]]

sc :=KnotData[{3,1},"SpaceCurve"]
R = 3.0;
T=2Pi;
path=ParametricPlot3D[R sc[t],{t,0,T},PlotRange->All,MaxRecursion->0,PlotPoints->60];
trackpath = Cases[path,a_Line:>a[[1]],Infinity][[1]];

CaveFlyPath[trackpath,{{}},{{}},{{}},15]

track=ParametricPlot3D[R sc[t],{t,0,T+0.1},PlotStyle->Tube[{0.55,0.55}],PlotRange->All,MaxRecursion->1,PlotPoints->40,ColorFunction->"BrightBands"]

FlyTrackSZG[track]

Michael' s Trott

Example 1.

<<Mesh`
Import["http://www.mathematicaguidebooks.org/V6/downloads/RiemannSurfacePlot3D.m"]

(*Trott shape #1*)
shape1=PolyhedronData["MathematicaPolyhedron"];
gc1=shape1[[1]];
Manipulate[RenderSZG[GeometryPlot3D[{gc1,Rotate[gc1,a,{0,0,1}]},ColorFunction->(RGBColor[#1,#2,0]&)]],{{a,0},-Pi/4,Pi/4,Pi/20}]

(*Trott shape #2*)
RenderSZG[GeometryPlot3D[Graphics3DMesh[RiemannSurfacePlot3D[w==(z^(1/3)),Re[w],{z,w}, ViewPoint->{-2.5,-2.2,0.8}]]]]

(*Trott shape #3*)
RenderSZG[GeometryPlot3D[Graphics3DMesh[RiemannSurfacePlot3D[w==(((1-(z^5)))^(1/5)),Im[w],{z,w},PlotPoints->{80,40}]]]]

(*Trott shape #4*)
RenderSZG[GeometryPlot3D[Graphics3DMesh[RiemannSheetParametricPlot3D[(( ArcCsc[(1+I)+z])/(Sqrt[z])),Re,{z,0,Pi},PlotPoints->60,
 ViewPoint->{0.73,-3.31,0.052}]]]]

(*example using GAP*)

Plot3D[Sin[x+Cos[y]],{x,-Pi,2Pi},{y,-Pi,Pi},PlotPoints->{10,10},MaxRecursion->1,Mesh->1,MeshFunctions->{"Gap"[0.8]},MeshShading->{None,Red},DisplayFunction:>(RenderSZG[#]&)]

RenderSZG[Graphics3D[Sphere[{0,0,0},1]]]

?RenderSZG

g=SphericalPlot3D[1+Sin[5 ϕ] Sin[10 θ]/10,{θ,0,π},{ϕ,0,2π},PlotPoints->25]

g2

RenderSZG[g]

RenderSZG[g3]

g3=Show[{g2,g},PlotRange->{{-1,1},{-1,1},{-1,1}}]

g2=ParametricPlot3D[{y+.5,x^2+y^2,x},{x,-1,1},{y,-1,1}]

GeneralTorus[ϕ_,θ_,r_,R_]:={{Cos[ϕ], -Sin[ϕ],0},{Sin[ϕ],Cos[ϕ],0},{0,0,1}}.{0,r Cos[θ]+R, r Sin[θ]};
CliffordTorus[r_]:=GeneralTorus[#1,#2,(r-1/r)/2,(r+1/r)/2]&;
DrawCliffordTorus[r_]:=ParametricPlot3D[Evaluate[CliffordTorus[r][θ,ϕ]],{θ,0,2π},{ϕ,0,2π},PlotPoints->12,MaxRecursion->0,Mesh->All,BoxRatios->Automatic,PlotStyle->Opacity[.5],PlotRange->{{-5,5},{-5,5},{-5,5}}][[1]]
CubePlot[g_,options__]:=Graphics`Mesh`GeometryPlot3D[g,ColorFunction->(RGBColor[#1,#2,#3]&),DisplayFunction:>((RenderSZG[#];#)&),options];

Tori=DrawCliffordTorus[#]&/@{1.2,3,5,7,12,50};

CubePlot[Tori]

Graphics3D[Tori]

Graphics`Mesh`GeometryPlot3D[Tori,ColorFunction->(RGBColor[#1,#2,#3]&),DisplayFunction:>((RenderSZG[#];#)&),PlotRange->{{-5,5},{-5,5},{-5,5}}]

DrawCliffordTorus[2]

Manipulate[Graphics`Mesh`GeometryPlot3D[
{
DrawCliffordTorus[1/(1-ϵ)]
}
,ColorFunction->(RGBColor[#1,#2,#3]&),DisplayFunction:>((RenderSZG[#];#)&),PlotRange->{{-5,5},{-5,5},{-5,5}}],{ϵ,0.01,.99,.01}]