Polyhedra Blender
Version -1.0
Created by SUN4V.pb Team
Preamble
The principle on which Quarkhedra of HO
and DI types are constructed, forms the whole family
of rather interesting polyhedra.
Polyhedra Blender realizes a principle of interaction of polyhedra due to which
the world of polyhedra receives huge quantity of new interesting representatives.
By analogy to name
Polyhedron Compounds this family can be named Polyhedron Blends.
The algorithm still is rough and not in all cases pleases with an end result, but
generally all this works, and some blends can already deliver feeling of true
pleasure :-).
Download/Disclaimer
polyhedraBlender.jar
size: 8Kb
is FREE only for non-commercial use.
Using with Mathematica
Adding of a polyhedron to a blend:
addMode[vertices, faces]
addMode[vertices, normals, faces]
In the first version of method Polyhedra Blender itself will calculate normals for faces.
It well works in simple cases, for example in case of a convex polyhedron.
Removing of a polyhedron from a blend:
deleteMode[index] removing of a polyhedron with
0-based number index
deleteAllModes[ ] full clearing
Examples:
(* Make sure you put polyhedraBlender.jar onto your CLASSPATH before
trying the example below, or use the AddToClassPath feature of J/Link to make it
available. *)
<< MathWorld`Platonic`
<< JLink`
mesh[obj_] := Module[{v,f},
v = obj@getVertices[ ];
AllowRaggedArrays[True];
f=obj@getFaces[ ] + 1;
AllowRaggedArrays[False];
Polygon[#]& /@ (v[[#]]& /@ f)]
(* gives a list of polygons for a polyhedron *)
vNgon[n_, k_, r_] := Module[{a = 2Pi/n, b}, b = k*a;
Table[{r*Cos[i*a + b], r*Sin[i*a + b], 0}, {i, 0, n - 1}]];
(* gives a list of vertices for a n-gon *)
addPoly3DSet[obj_, vNgon_, ax_, ay_, n_, k_, s_] := Module[{
a = 2Pi/n, b,
ff = Table[i, {i, 0, Length[vNgon] - 1}], fb,
normf = RotationFormula[
RotationFormula[{0, 0, 1}, {1, 0, 0}, ax], {0, 1, 0}, ay],
norm,
v = Map[RotationFormula[#, {0, 1, 0}, ay] &,
Map[RotationFormula[#, {1, 0, 0}, ax] &, vNgon]]},
b = k*a; fb = Reverse[ff];
Do[obj@addMode[N[Map[RotationFormula[#, {0, 0, 1}, s*(i*a + b)] &, v]],
N[{norm = RotationFormula[normf, {0, 0, 1}, s*(i*a + b)], -1*norm}],
{ff, fb}], {i, 0, n - 1, 1}]];
(* adding a set of n-gons *)
InstallJava[ ];
polyhedraBlender = JavaNew["sun4v.pb.PolyhedraBlender"];
addPoly3DSet[polyhedraBlender, vNgon[2, 0., 1], -Pi/6, -Pi/6, 9, 0., -1];
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@deleteAllModes[ ];
addPoly3DSet[polyhedraBlender, vNgon[3, 0., 1], -0.8, 0., 7, 0., -1];
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@deleteAllModes[ ];
addPoly3DSet[polyhedraBlender, vNgon[2, 0., 1], -0.5, -0.5, 7, 0., -1];
Show[Graphics3D[mesh[polyhedraBlender]]];
addPoly3DSet[polyhedraBlender, vNgon[5, 0., 1], -1., 0., 7, 0., -1];
Show[Graphics3D[mesh[polyhedraBlender]]];
addPoly3DSet[polyhedraBlender, vNgon[7, 0., 1], 0., 0., 1, 0.5, -1];
polyhedraBlender@setValue[2, polyhedraBlender@getNumModes[ ] - 1];
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@addMode[{{0., 0., 1.}, {0., 0., -1.}},
{{1., 0., 0.}, {-1., 0., 0.}}, {{0, 1}, {0, 1}}];
polyhedraBlender@setValue[2, polyhedraBlender@getNumModes[ ] - 1];
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@deleteAllModes[ ];
phCd = Polyhedron[Icosahedron6Compound];
Module[{ph}, Do[polyhedraBlender@addMode[N[
PolyhedronVertices[ph = phCd[[i]]]], PolyhedronFaces[ph] - 1], {i, 6}];]
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@deleteAllModes[ ];
phCd = Polyhedron[Dodecahedron5Compound];
Module[{ph}, Do[polyhedraBlender@addMode[N[
PolyhedronVertices[ph = phCd[[i]]]], PolyhedronFaces[ph] - 1], {i, 5}];]
Show[Graphics3D[mesh[polyhedraBlender]]];
polyhedraBlender@deleteAllModes[ ];
Do[addPoly3DSet[polyhedraBlender,
vNgon[2, 0., 1], -0.2 - i*0.2, -0.2 - i*0.2, 5, 0., -1], {i, 0, 5, 1}];
Show[Graphics3D[mesh[polyhedraBlender]]];
ReleaseJavaObject[polyhedraBlender];
Clear[polyhedraBlender, phCd];
We are represent our small LiveGraphics3D gallery of blends here.
We with pleasure shall place references to your galleries.
last updated: December 30, 2004
© by SUN4V.pb Team
|