public static SphereToPlane ( Vector3D spherePoint ) : Vector3D | ||
spherePoint | Vector3D | |
return | Vector3D |
private Tile TemplateTile() { double inRadiusHyp = InRadius; double inRadiusEuclidean = DonHatch.h2eNorm(inRadiusHyp); double faceRadius = FaceRadius(inRadiusEuclidean); // Calc the midpoint, and project to plane. Vector3D midPoint = MidPoint(inRadiusEuclidean, faceRadius); midPoint.Z *= -1; midPoint = Sterographic.SphereToPlane(midPoint); //double midPointSpherical = MidPoint( inRadiusEuclidean, faceRadius ); //double midPoint = Spherical2D.s2eNorm( midPointSpherical ); // Create and scale based on our midpoint. Polygon poly = new Polygon(); poly.CreateRegular(Q, R); double standardMidpointAbs = poly.Segments[0].Midpoint.Abs(); m_shrink = midPoint.Abs() / standardMidpointAbs; poly.Scale(m_shrink); Matrix4D m = Matrix4D.MatrixToRotateinCoordinatePlane(-Math.PI / Q, 0, 1); poly.Rotate(m); return(new Tile(poly, poly.Clone(), Geometry.Hyperbolic)); }
public static Vector3D SinusoidalToStereo(Vector3D v) { double lat = Math.PI / 2 * (1 - v.Y); Vector3D spherical = new Vector3D(1, lat, Math.PI * v.X / Math.Cos(lat - Math.PI / 2)); Vector3D onBall = SphericalCoords.SphericalToCartesian(spherical); return(Sterographic.SphereToPlane(onBall)); }
/// <summary> /// 2-dimensional function. /// http://archive.bridgesmathart.org/2013/bridges2013-217.pdf /// </summary> public static Vector3D MercatorToStereo(Vector3D v) { v *= Math.PI; // Input is [-1,1] double lat = 2 * Math.Atan(Math.Exp(v.Y)) - Math.PI / 2; double inclination = lat + Math.PI / 2; Vector3D spherical = new Vector3D(1, inclination, v.X); Vector3D onBall = SphericalCoords.SphericalToCartesian(spherical); return(Sterographic.SphereToPlane(onBall)); }
public static Vector3D EquirectangularToStereo(Vector3D v) { // http://mathworld.wolfram.com/EquirectangularProjection.html // y is the latitude // x is the longitude // Assume inputs go from -1 to 1. Vector3D spherical = new Vector3D(1, Math.PI / 2 * (1 - v.Y), v.X * Math.PI); Vector3D onBall = SphericalCoords.SphericalToCartesian(spherical); return(Sterographic.SphereToPlane(onBall)); }
/// <summary> /// 2-dimensional function. /// ZZZ - Should make this general. /// </summary> public static Vector3D OrthographicToStereo(Vector3D v) { // We can only do the projection for half of the sphere. double t = v.X * v.X + v.Y * v.Y; if (t > 1) { t = 1; } v.Z = Math.Sqrt(1 - t); return(Sterographic.SphereToPlane(v)); }
private static double EquidistantToStereo(double dist) { if (dist > 1) { throw new System.ArgumentException(); } Vector3D v = new Vector3D(0, -1); v.RotateXY(dist * Math.PI); v = Sterographic.SphereToPlane(new Vector3D(v.X, 0, v.Y)); return(v.Abs()); }
/// <summary> /// https://en.wikipedia.org/wiki/Lambert_azimuthal_equal-area_projection /// </summary> private static double EqualAreaToStereo(double dist) { if (dist > 1) { throw new System.ArgumentException(); } // We have dist normalized between 0 and 1, so this formula is slightly // different than on Wikipedia, where dist ranges up to 2. Vector3D v = new Vector3D(1, 2 * Math.Acos(dist), 0); v = Sterographic.SphereToPlane(SphericalCoords.SphericalToCartesian(v)); return(v.Abs()); }