<<Graphics`Colors`
col[0] = Red
col[1] = Green
col[2] = Blue
col[3] = Yellow
col[4] = Orange
col[5] = Olive
col[6] = Turquoise
col[7] = Maroon
col[8] = DarkGreen
col[9] = LightBlue
col[n_] := col[Mod[n,10]] /; n>9
LiveForm[g_] := NumberForm[InputForm[N[g]], 5]
WriteLiveForm[filename_, g_] := (
WriteString[filename,
ToString[NumberForm[InputForm[N[g]], 5]]];
Close[filename];)
g3D[t_,vp_] :=
Graphics3D[t,
{PlotRange -> {{-2,2},{-2,2},{-2,2}},
BoxRatios -> {1,1,1},
Boxed -> False,
Lighting -> False,
Background -> GrayLevel[0],
ViewPoint -> vp}
]
g3D[t_] := g3D[t,{5,1,1}]
Polify[{i__}] := Polygon[v /@ {i}]
Linify[{i__}] := Line[v /@ {i}]
DualVertex[{i__}] := N[(Plus @@ v /@ {i})/Length[{i}]]
DualFace[i_] :=
Module[{unord,ord,currface},
unord = Select[Faces,MemberQ[#,i]&];
ord = {unord[[1]]};
unord = Drop[unord,1];
currface = ord[[1]];
While[unord =!= {},
currface =
First[Select[unord,Length[Intersection[#,currface]]==2&]];
ord = Join[ord,{currface}];
unord = Complement[unord,{currface}]
];
Polygon[DualVertex /@ ord]
]
BasicPicture[] := g3D[{
EdgeForm[],
Table[{col[i-1],Polify[Faces[[i]]]},{i,Length[Faces]}]
}]
DualPicture[] := g3D[{
White,
Linify /@ Edges,
Table[{col[i],DualFace[i]},{i,0,numVertices - 1}]
}]
BWSolid[] := {
EdgeForm[{GrayLevel[0]}],
Polify /@ Faces
}
VertexNumbers[] :=
Table[Text[ToString[i],1.1 v[i]],{i,0,numVertices-1}]