// 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); }
// https://plus.google.com/u/0/117663015413546257905/posts/BnCEkdNiTZ2 public static void TwinDodecs() { Tiling tiling = new Tiling(); TilingConfig config = new TilingConfig(5, 3); tiling.GenerateInternal(config, Polytope.Projection.VertexCentered); // Vertex-centered makes infinities tricky Dodec dodec = new Dodec(); foreach (Tile tile in tiling.Tiles) { foreach (Segment seg in tile.Boundary.Segments) { Vector3D p1 = seg.P1, p2 = seg.P2; if (Infinity.IsInfinite(p1)) { p1 = Infinity.InfinityVector; } if (Infinity.IsInfinite(p2)) { p2 = Infinity.InfinityVector; } dodec.Verts.Add(p1); dodec.Verts.Add(p2); dodec.Midpoints.Add(Halfway(p1, p2)); } } // Now recursively add more vertices. HashSet <Vector3D> allVerts = new HashSet <Vector3D>(); foreach (Vector3D v in dodec.Verts) { allVerts.Add(v); } RecurseTwins(allVerts, dodec, 0); using (StreamWriter sw = File.CreateText("dual_dodecs_points_sphere.pov")) { foreach (Vector3D vert in allVerts) { Vector3D onSphere = Sterographic.PlaneToSphereSafe(vert); sw.WriteLine(PovRay.Sphere(new Sphere() { Center = onSphere, Radius = 0.01 })); //if( !Infinity.IsInfinite( vert ) ) // sw.WriteLine( PovRay.Sphere( new Sphere() { Center = vert, Radius = 0.01 } ) ); } } }
private static void RecurseTwins(HashSet <Vector3D> allVerts, Dodec dodec, int level) { level++; if (level > 1) { return; } //foreach( Vector3D v in dodec.Midpoints ) foreach (Vector3D v in dodec.Verts) { Dodec dual = GetDual(dodec, v); int count = allVerts.Count; foreach (Vector3D dualV in dual.Verts) { allVerts.Add(dualV); } if (count != allVerts.Count) { RecurseTwins(allVerts, dual, level); } } }
private static void RecurseTwins( HashSet<Vector3D> allVerts, Dodec dodec, int level ) { level++; if( level > 1 ) return; //foreach( Vector3D v in dodec.Midpoints ) foreach( Vector3D v in dodec.Verts ) { Dodec dual = GetDual( dodec, v ); int count = allVerts.Count; foreach( Vector3D dualV in dual.Verts ) allVerts.Add( dualV ); if( count != allVerts.Count ) RecurseTwins( allVerts, dual, level ); } }
// 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; }
// https://plus.google.com/u/0/117663015413546257905/posts/BnCEkdNiTZ2 public static void TwinDodecs() { Tiling tiling = new Tiling(); TilingConfig config = new TilingConfig( 5, 3 ); tiling.GenerateInternal( config, Polytope.Projection.VertexCentered ); // Vertex-centered makes infinities tricky Dodec dodec = new Dodec(); foreach( Tile tile in tiling.Tiles ) foreach( Segment seg in tile.Boundary.Segments ) { Vector3D p1 = seg.P1, p2 = seg.P2; if( Infinity.IsInfinite( p1 ) ) p1 = Infinity.InfinityVector; if( Infinity.IsInfinite( p2 ) ) p2 = Infinity.InfinityVector; dodec.Verts.Add( p1 ); dodec.Verts.Add( p2 ); dodec.Midpoints.Add( Halfway( p1, p2 ) ); } // Now recursively add more vertices. HashSet<Vector3D> allVerts = new HashSet<Vector3D>(); foreach( Vector3D v in dodec.Verts ) allVerts.Add( v ); RecurseTwins( allVerts, dodec, 0 ); using( StreamWriter sw = File.CreateText( "dual_dodecs_points_sphere.pov" ) ) { foreach( Vector3D vert in allVerts ) { Vector3D onSphere = Sterographic.PlaneToSphereSafe( vert ); sw.WriteLine( PovRay.Sphere( new Sphere() { Center = onSphere, Radius = 0.01 } ) ); //if( !Infinity.IsInfinite( vert ) ) // sw.WriteLine( PovRay.Sphere( new Sphere() { Center = vert, Radius = 0.01 } ) ); } } }