Пример #1
0
        public void TestPlaneDistance()
        {
            Plane  plane    = new Plane(new Vector3d(-0.5 + 5, -0.5 - 5, 20), new Vector3d(1, 1, 0));
            double distance = plane.GetDistanceFromPoint(new Vector3d(0, 0, 0));

            ZAssert.AssertIsClose(distance, 0.5 * Math.Sqrt(2));
            Circle3 intersection = plane.GetUnitSphereIntersection();

            ZAssert.AssertIsClose(intersection.radius, 0.5 * Math.Sqrt(2));
        }
Пример #2
0
        private void DoCubeFaceTest(CubeSectorFace face, LongLat longLat, bool doXNotY, double expectedAnswer)
        {
            var      front  = new CubeSector(face, 0, 0, 0);
            Vector3d normal = front.sectorFace.GetFaceNormal();
            Vector3d down   = front.sectorFace.GetFaceDownDirection();
            Vector3d right  = front.sectorFace.GetFaceRightDirection();

            if (doXNotY)
            {
                ZAssert.AssertIsClose(front.GetRel(normal, right, longLat.ToSphereVector()), expectedAnswer);
            }
            else
            {
                ZAssert.AssertIsClose(front.GetRel(normal, down, longLat.ToSphereVector()), expectedAnswer);
            }
        }