Exemplo n.º 1
0
        // Rotates a dodec about a vertex or edge to get a dual dodec.
        private static Dodec GetDual(Dodec dodec, Vector3D rotationPoint)
        {
            //double rot = System.Math.PI / 2;	// Edge-centered
            double rot = 4 * (-Math.Atan((2 + Math.Sqrt(5) - 2 * Math.Sqrt(3 + Math.Sqrt(5))) / Math.Sqrt(3)));                                 // Vertex-centered

            Mobius m = new Mobius();

            if (Infinity.IsInfinite(rotationPoint))
            {
                m.Elliptic(Geometry.Spherical, new Vector3D(), -rot);
            }
            else
            {
                m.Elliptic(Geometry.Spherical, rotationPoint, rot);
            }

            Dodec dual = new Dodec();

            foreach (Vector3D v in dodec.Verts)
            {
                Vector3D rotated = m.ApplyInfiniteSafe(v);
                dual.Verts.Add(rotated);
            }

            foreach (Vector3D v in dodec.Midpoints)
            {
                Vector3D rotated = m.ApplyInfiniteSafe(v);
                dual.Midpoints.Add(rotated);
            }

            return(dual);
        }