コード例 #1
0
 private static Vector3D Transform2(Vector3D p, Matrix4D mat)
 {
     p.Normalize();
     p = mat.RotateVector(p);
     p = Sterographic.S3toR3(p);
     p = SphericalModels.StereoToEquidistant(p);
     return(p);
 }
コード例 #2
0
        public static Vector3D ToConformal(Geometry g, Vector3D[] kv, Vector3D b)
        {
            Vector3D klein = Util.BaryToEuclidean(kv, b);

            switch (g)
            {
            case Geometry.Spherical:
                return(SphericalModels.GnomonicToStereo(klein));

            case Geometry.Euclidean:
                return(klein);

            case Geometry.Hyperbolic:
                return(HyperbolicModels.KleinToPoincare(klein));
            }

            throw new System.ArgumentException();
        }
コード例 #3
0
        // So that we can leverage Euclidean barycentric coordinates, we will first convert our simplex to the Klein model.
        // We will need to take care to properly convert back to the Ball as needed.
        public static Vector3D[] KleinVerts(Geometry g, Vector3D[] conformalVerts)
        {
            return(conformalVerts.Select(v =>
            {
                switch (g)
                {
                case Geometry.Spherical:
                    return SphericalModels.StereoToGnomonic(v);

                case Geometry.Euclidean:
                    return v;

                case Geometry.Hyperbolic:
                    return HyperbolicModels.PoincareToKlein(v);
                }

                throw new System.ArgumentException();
            }).ToArray());
        }
コード例 #4
0
        public static Circle3D GetCircleForBallPoint(Vector3D p)
        {
            Sphere ball = new Sphere();

            p = SphericalModels.GnomonicToStereo(p);

            if (Tolerance.GreaterThanOrEqual(p.Abs(), 1))
            {
                return(null);
            }

            Sphere t = H3Models.Ball.OrthogonalSphereInterior(p);

            //return H3Models.Ball.IdealCircle( t );

            // Get the corresponding point on the exterior (our inversion).
            p = HyperbolicModels.PoincareToKlein(p);
            p = HyperbolicModels.PoincareToKlein(p);
            p = ball.ReflectPoint(p);

            return(GetCircle(p));
        }
コード例 #5
0
ファイル: MouseMotion.cs プロジェクト: remuladgryta/MagicTile
        /// <summary>
        /// Helper to transform to standard model if needed.
        /// </summary>
        private Vector3D ToStandardIfNeeded(Vector3D point)
        {
            if (m_geometry == Geometry.Hyperbolic &&
                m_settings.HyperbolicModel == HModel.Klein)
            {
                return(HyperbolicModels.KleinToPoincare(point));
            }

            if (m_geometry == Geometry.Spherical)
            {
                if (m_settings.SphericalModel == SphericalModel.Gnomonic)
                {
                    return(SphericalModels.GnomonicToStereo(point));
                }

                if (m_settings.SphericalModel == SphericalModel.Fisheye)
                {
                    return(SphericalModels.StereoToGnomonic(point));
                }
            }

            return(point);
        }