public static Vector3D FaceCenterSpherical(int p, int q, int r) { // Get a {q,p} tiling on the z=0 plane. Segment[] baseTileSegments = BaseTileSegments(q, p); // This will be unit length. Vector3D pFaceDirection = H3Models.UHSToBall(baseTileSegments.First().P1); // In-radius is in conformal model double inRadius = Spherical2D.s2eNorm(Honeycomb.InRadius(p, q, r)); return(pFaceDirection * inRadius); }
/// <summary> /// Mirrors for Spherical geometry, in the ball model. /// </summary> public static Sphere[] MirrorsSpherical(int p, int q, int r) { // Get a {q,p} tiling on the z=0 plane. Segment[] baseTileSegments = BaseTileSegments(q, p); // This will be unit length. Vector3D pFaceDirection = H3Models.UHSToBall(baseTileSegments.First().P1); // In-radius is in conformal model double inRadius = Spherical2D.s2eNorm(Honeycomb.InRadius(p, q, r)); double centerOfSphereNE = (1 - inRadius) / (1 + inRadius); Vector3D center; double radius; H3Models.Ball.DupinCyclideSphere(-pFaceDirection * centerOfSphereNE, 1.0 /*geodesic circle*/, Geometry.Spherical, out center, out radius); Sphere cellBoundary = new Sphere() { Center = center, Radius = radius, Invert = true }; Sphere[] interior = InteriorMirrors(p, q); interior = interior.Select(s => H3Models.UHSToBall(s)).ToArray(); Sphere[] surfaces = new Sphere[] { cellBoundary, interior[0], interior[1], interior[2] }; // Apply rotations. bool applyRotations = false; if (applyRotations) { double rotation = Math.PI / 2; foreach (Sphere s in surfaces) { RotateSphere(s, rotation); } } return(surfaces); }