Mirrors() public static method

Given the 4 verts of a tetrahedron (must lie within ball), Calculate the faces of the tetrahedron. Input and Output in ball model.
public static Mirrors ( Vector3D verts ) : R3.Geometry.Sphere[]
verts Vector3D
return R3.Geometry.Sphere[]
Ejemplo n.º 1
0
        public void InitializeGoursat()
        {
            //Vector3D[] test = SimplexCalcs.GoursatTetrahedron( 3.5, 3.8, 3.1, 2.2, 2.01, 2.1 );	// Example values from paper.
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 4, 3, 2, 3, 3 );				// 4,3,3,3
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 5, 3, 2, 3, 3 );				// 5,3,3,3
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 4, 3, 2, 4, 3 );				// 4,3,4,3
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 4, 3, 2, 5, 3 );				// 4,3,5,3
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 5, 3, 2, 5, 3 );				// 5,3,5,3
            //Verts = SimplexCalcs.GoursatTetrahedron( 3, 5, 3, 2, 2, 2 );				// 5,3^1,1
            //Verts = SimplexCalcs.GoursatTetrahedron( 3, 2, 2, 2, 5, 3 );				// 5,3^1,1 alt (to avoid vertices at origin).

            // Paracompact doesn't work :(
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 6, 3, 2, 6, 3 );				// 6,3,6,3

            // Regular
            Verts = SimplexCalcs.GoursatTetrahedron(2, 5, 3, 2, 4, 2);                                                          // 5,3,4
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 4, 3, 2, 5, 2 );						// 4,3,5
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 5, 3, 2, 5, 2 );						// 5,3,5
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 5, 2, 2, 5, 3 );						// 5,3,5 (Alt)
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 3, 5, 2, 3, 2 );						// 3,5,3

            // Spherical doesn't work :(
            //Verts = SimplexCalcs.GoursatTetrahedron( 2, 5, 3, 2, 3, 2 );						// 5,3,3

            Facets = SimplexCalcs.Mirrors(Verts);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the 6 simplex edges in the UHS model.
        /// </summary>
        public static H3.Cell.Edge[] SimplexEdgesUHS(int p, int q, int r)
        {
            // Only implemented for honeycombs with hyperideal cells right now.
            if (!(Geometry2D.GetGeometry(p, q) == Geometry.Hyperbolic))
            {
                throw new System.NotImplementedException();
            }

            Sphere[] simplex = SimplexCalcs.Mirrors(p, q, r, moveToBall: false);

            Circle[] circles = simplex.Select(s => H3Models.UHS.IdealCircle(s)).ToArray();

            Vector3D[] defPoints = new Vector3D[6];
            Vector3D   dummy;

            Euclidean2D.IntersectionLineCircle(circles[1].P1, circles[1].P2, circles[0], out defPoints[0], out dummy);
            Euclidean2D.IntersectionLineCircle(circles[2].P1, circles[2].P2, circles[0], out defPoints[1], out dummy);
            Euclidean2D.IntersectionLineCircle(circles[1].P1, circles[1].P2, circles[3], out defPoints[2], out dummy);
            Euclidean2D.IntersectionLineCircle(circles[2].P1, circles[2].P2, circles[3], out defPoints[3], out dummy);

            Circle3D c = simplex[0].Intersection(simplex[3]);

            Vector3D normal = c.Normal;

            normal.RotateXY(Math.PI / 2);
            Vector3D intersection;
            double   height, off;

            Euclidean2D.IntersectionLineLine(c.Center, c.Center + normal, circles[1].P1, circles[1].P2, out intersection);
            off            = (intersection - c.Center).Abs();
            height         = Math.Sqrt(c.Radius * c.Radius - off * off);
            intersection.Z = height;
            defPoints[4]   = intersection;

            Euclidean2D.IntersectionLineLine(c.Center, c.Center + normal, circles[2].P1, circles[2].P2, out intersection);
            off            = (intersection - c.Center).Abs();
            height         = Math.Sqrt(c.Radius * c.Radius - off * off);
            intersection.Z = height;
            defPoints[5]   = intersection;

            // Hyperideal vertex too?
            bool order = false;

            H3.Cell.Edge[] edges = null;
            if (Geometry2D.GetGeometry(q, r) == Geometry.Hyperbolic)
            {
                edges = new H3.Cell.Edge[]
                {
                    new H3.Cell.Edge(new Vector3D(), new Vector3D(0, 0, 10)),
                    new H3.Cell.Edge(defPoints[4], defPoints[5], order),
                    new H3.Cell.Edge(defPoints[0], defPoints[4], order),
                    new H3.Cell.Edge(defPoints[1], defPoints[5], order),
                    new H3.Cell.Edge(defPoints[2], defPoints[4], order),
                    new H3.Cell.Edge(defPoints[3], defPoints[5], order),
                };
            }
            else
            {
                Vector3D vPointUHS = H3Models.BallToUHS(VertexPointBall(p, q, r));
                defPoints[0] = defPoints[1] = vPointUHS;
                edges        = new H3.Cell.Edge[]
                {
                    new H3.Cell.Edge(vPointUHS, new Vector3D(0, 0, 10)),
                    new H3.Cell.Edge(defPoints[4], defPoints[5], order),
                    new H3.Cell.Edge(defPoints[0], defPoints[4], order),
                    new H3.Cell.Edge(defPoints[1], defPoints[5], order),
                    new H3.Cell.Edge(defPoints[2], defPoints[4], order),
                    new H3.Cell.Edge(defPoints[3], defPoints[5], order),
                };
            }

            return(edges);
        }
Ejemplo n.º 3
0
 public void InitializeGoursat(int[] dihedrals)
 {
     Verts  = SimplexCalcs.GoursatTetrahedron(dihedrals[0], dihedrals[1], dihedrals[2], dihedrals[3], dihedrals[4], dihedrals[5]);
     Facets = SimplexCalcs.Mirrors(Verts);
 }