Ejemplo n.º 1
0
        public void CircleProjectionToPlaneTest()
        {
            Vector3d v1 = new Vector3d(3, 5, 1);
            Circle3d c  = new Circle3d(new Point3d(5, 6, 1), 5, v1);
            Plane3d  s  = new Plane3d(5, 2, 3, -3);

            Point3d p = c.ParametricForm(0.5).ProjectionTo(s);

            Assert.IsTrue(p.BelongsTo(c.ProjectionTo(s)));
            p = c.ParametricForm(0.725).ProjectionTo(s);
            Assert.IsTrue(p.BelongsTo(c.ProjectionTo(s)));
            p = c.ParametricForm(2.7122).ProjectionTo(s);
            Assert.IsTrue(p.BelongsTo(c.ProjectionTo(s)));
        }
Ejemplo n.º 2
0
        public void EllipseProjectionToPlaneTest()
        {
            Vector3d v1 = new Vector3d(3, 0, 1);
            Vector3d v2 = 3 * v1.OrthogonalVector;
            Ellipse  e  = new Ellipse(new Point3d(5, 6, 1), v1, v2);
            Plane3d  s  = new Plane3d(5, 2, 3, -3);

            Point3d p = e.ParametricForm(0.5).ProjectionTo(s);

            Assert.IsTrue(p.BelongsTo(e.ProjectionTo(s)));
            p = e.ParametricForm(0.725).ProjectionTo(s);
            Assert.IsTrue(p.BelongsTo(e.ProjectionTo(s)));
            p = e.ParametricForm(2.7122).ProjectionTo(s);
            Assert.IsTrue(p.BelongsTo(e.ProjectionTo(s)));
        }
Ejemplo n.º 3
0
        public void EllipsoidProjectionToLineTest_2()
        {
            Point3d   p  = new Point3d(0, 0, 0);
            Vector3d  v1 = new Vector3d(4, 0, 0);
            Vector3d  v2 = new Vector3d(0, 6, 0);
            Vector3d  v3 = new Vector3d(0, 0, 9);
            Ellipsoid e  = new Ellipsoid(p, v1, v2, v3);

            p  = new Point3d(1, 1, 1);
            v1 = new Vector3d(1, 1, 3);
            Line3d    l = new Line3d(p, v1);
            Segment3d s = e.ProjectionTo(l);

            // Construct plane orthogonal to line and passing through segment end point
            // And check if it is touching ellipsoid
            Plane3d pl1 = new Plane3d(s.P1, v1);
            object  obj = e.IntersectionWith(pl1);

            if (obj.GetType() == typeof(Point3d))
            {
                p = (Point3d)obj;
                if (p.BelongsTo(e))
                {
                    Assert.IsTrue(true);
                }
                else
                {
                    Assert.Fail();
                }
            }
            else
            {
                Assert.Fail();
            }
        }
Ejemplo n.º 4
0
        public void PointInAlignedBoxTest()
        {
            Point3d p   = new Point3d(1, 1, 1);
            Box3d   box = new Box3d(p, 8, 6, 10);

            p = new Point3d(2, 2, 2);  // Point inside
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsTrue(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsFalse(p.IsOnBoundary(box));

            p = new Point3d(2, 4, 2);  // Point on side
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsTrue(p.IsOnBoundary(box));

            p = new Point3d(5, 4, 6);  // Point in corner
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsTrue(p.IsOnBoundary(box));

            p = new Point3d(5, -5, 6);  // Point outside
            Assert.IsFalse(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsTrue(p.IsOutside(box));
            Assert.IsFalse(p.IsOnBoundary(box));
        }
Ejemplo n.º 5
0
        public void PointBelongsToPlaneTest()
        {
            Plane3d s1 = new Plane3d(-1, 2, -2, 9);
            Point3d p1 = s1.Point;

            Assert.IsTrue(p1.BelongsTo(s1));

            s1 = new Plane3d(new Point3d(0, 0, 10), new Vector3d(0, 0, 1));
            p1 = new Point3d(0, 0, 10);
            Assert.IsTrue(p1.BelongsTo(s1));

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            s1 = new Plane3d(new Point3d(0, 0, 10), new Vector3d(0, 0, 100));
            p1 = new Point3d(0, 0, 10.05);
            Assert.IsTrue(p1.BelongsTo(s1));
            p1 = new Point3d(0, 0, 10.15);
            Assert.IsFalse(p1.BelongsTo(s1));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 6
0
        public void PointInsideRelativeTest()
        {
            Point3d  a = new Point3d(0, 0, 0);
            Point3d  b = new Point3d(15, 0, 0);
            Point3d  p = new Point3d(0, 15, 0);
            Triangle s = new Triangle(a, b, p);

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(1, 1, 0.1);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(0.2, 5, 0.0);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 7
0
        public void PointInTriangleTest2()
        {
            Point3d p1 = new Point3d(0, 0, 0);
            Point3d p2 = new Point3d(6, 0, 0);
            Point3d p3 = new Point3d(0, 6, 0);

            Triangle t = new Triangle(p1, p2, p3);
            Point3d  p = new Point3d(4, 4, 0);

            Assert.IsFalse(p.BelongsTo(t));

            p = new Point3d(6, 0.5, 0);
            Assert.IsFalse(p.BelongsTo(t));

            p = new Point3d(5, -0.5, 0);
            Assert.IsFalse(p.BelongsTo(t));

            p = new Point3d(2, 5, 0);
            Assert.IsFalse(p.BelongsTo(t));

            p = new Point3d(2, 2, 0.1);
            Assert.IsFalse(p.BelongsTo(t));

            p = new Point3d(2, 2, 0);
            Assert.IsTrue(p.BelongsTo(t));

            p = new Point3d(5, 1, 0);
            Assert.IsTrue(p.BelongsTo(t));

            p = new Point3d(0, 1, 0);
            Assert.IsTrue(p.BelongsTo(t));

            p = new Point3d(2, 0, 0);
            Assert.IsTrue(p.BelongsTo(t));
        }
Ejemplo n.º 8
0
        public void PointInSegmentTest()
        {
            Point3d   p = new Point3d(0, 0, 0);
            Segment3d s = new Segment3d(p, new Point3d(10, 0, 0));

            p = new Point3d(5, 0, 0);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(10, 0, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 3, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(11, 0, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }
Ejemplo n.º 9
0
        public void PointInSphereRelativeTest()
        {
            Point3d p = new Point3d(1, 1, 1);
            Sphere  s = new Sphere(p, 5);

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(1, 5.9, 1);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6.04, 1);  // Point on surface
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.06, 1);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 10
0
        public void PointInEllipseTest()
        {
            Point3d p = new Point3d(1, 1, 0);
            Ellipse s = new Ellipse(p, new Vector3d(10, 0, 0), new Vector3d(0, 5, 0));

            p = new Point3d(2, 2, 0);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.005, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 2, 0.01);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }
Ejemplo n.º 11
0
        public void PointInCircleTest()
        {
            Point3d  p = new Point3d(1, 1, 0);
            Circle3d s = new Circle3d(p, 5, new Vector3d(0, 0, 1));

            p = new Point3d(2, 2, 0);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.005, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 2, 0.01);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }
Ejemplo n.º 12
0
        public void PointInTriangleTest()
        {
            Point3d  a = new Point3d(0, 0, 0);
            Point3d  b = new Point3d(15, 0, 0);
            Point3d  p = new Point3d(0, 15, 0);
            Triangle s = new Triangle(a, b, p);

            p = new Point3d(1, 1, 0);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(10, 0, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 3, 1);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(16, 0, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }
Ejemplo n.º 13
0
        public void PointBelongsToLineTest()
        {
            Point3d  p1 = new Point3d(1, -5, -1);
            Vector3d v1 = new Vector3d(-2, 3, 4);
            Line3d   l1 = new Line3d(p1, v1);
            Point3d  p2 = p1.Translate(3 * v1);

            Assert.IsTrue(p2.BelongsTo(l1));
        }
Ejemplo n.º 14
0
        public void LineProjectionToPlaneTest()
        {
            Point3d  p1 = new Point3d(1, -5, -1);
            Vector3d v1 = new Vector3d(-2, 3, 4);
            Line3d   l1 = new Line3d(p1, v1);
            Plane3d  s1 = new Plane3d(-2, 2, 3, -29);

            Point3d p2 = (Point3d)l1.IntersectionWith(s1);
            Line3d  l2 = (Line3d)l1.ProjectionTo(s1);

            Assert.IsTrue(p2.BelongsTo(l2));
        }
Ejemplo n.º 15
0
        public void PointBelongsToRayTest()
        {
            Point3d p = new Point3d(0, 0, 0);
            Ray3d   r = new Ray3d(new Point3d(1, 1, 0), new Vector3d(1, 0, 0));

            Assert.IsFalse(p.BelongsTo(r));

            p = new Point3d(1, 1, 0);
            Assert.IsTrue(p.BelongsTo(r));

            p = new Point3d(3, 1, 0);
            Assert.IsTrue(p.BelongsTo(r));
        }
Ejemplo n.º 16
0
        public void PointBelongsToSegmentTest()
        {
            Point3d   p = new Point3d(0, 0, 0);
            Segment3d s = new Segment3d(new Point3d(1, 1, 0), new Point3d(3, 3, 0));

            Assert.IsFalse(p.BelongsTo(s));

            p = new Point3d(1, 1, 0);
            Assert.IsTrue(p.BelongsTo(s));
            p = new Point3d(2, 2, 0);
            Assert.IsTrue(p.BelongsTo(s));
            p = new Point3d(3, 3, 0);
            Assert.IsTrue(p.BelongsTo(s));
        }
Ejemplo n.º 17
0
        public void PointInEllipseRelativeTest()
        {
            Point3d p = new Point3d(1, 1, 0);
            Ellipse s = new Ellipse(p, new Vector3d(10, 0, 0), new Vector3d(0, 5, 0));

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(2, 2, 0.1);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.2, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 2, 0.2);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 18
0
        public void PointInSegmentRelativeTest()
        {
            Point3d   p = new Point3d(0, 0, 0);
            Segment3d s = new Segment3d(p, new Point3d(10, 0, 0));

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(5, 0, 0.05);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(10.05, 0, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 0.2, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(10.2, 0, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 19
0
        public void PointInAlignedBoxRelativeTest()
        {
            Point3d p   = new Point3d(1, 1, 1);
            Box3d   box = new Box3d(p, 8, 6, 10);

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(2, 2, 2);  // Point inside
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsTrue(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsFalse(p.IsOnBoundary(box));

            p = new Point3d(2, 4.1, 2);  // Point on side
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsTrue(p.IsOnBoundary(box));

            p = new Point3d(5.1, 4, 6);  // Point in corner
            Assert.IsTrue(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsFalse(p.IsOutside(box));
            Assert.IsTrue(p.IsOnBoundary(box));

            p = new Point3d(2, 4.2, 2);  // Point outside
            Assert.IsFalse(p.BelongsTo(box));
            Assert.IsFalse(p.IsInside(box));
            Assert.IsTrue(p.IsOutside(box));
            Assert.IsFalse(p.IsOnBoundary(box));

            // Resore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 20
0
        public void PointInCircleRelativeTest()
        {
            Point3d  p = new Point3d(1, 1, 0);
            Circle3d s = new Circle3d(p, 5, new Vector3d(0, 0, 1));

            double tol  = GeometRi3D.Tolerance;
            bool   mode = GeometRi3D.UseAbsoluteTolerance;

            GeometRi3D.Tolerance            = 0.01;
            GeometRi3D.UseAbsoluteTolerance = false;

            p = new Point3d(2, 2, 0.04);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6.04, 0);  // Point on boundary
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.06, 0);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 2, 0.06);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            // Restore initial state
            GeometRi3D.UseAbsoluteTolerance = mode;
            GeometRi3D.Tolerance            = tol;
        }
Ejemplo n.º 21
0
        public void PointInSphereTest()
        {
            Point3d p = new Point3d(1, 1, 1);
            Sphere  s = new Sphere(p, 5);

            p = new Point3d(2, 2, 2);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6, 1);  // Point on surface
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.005, 1);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }
Ejemplo n.º 22
0
        public void PointInEllipsoidTest()
        {
            Point3d   p = new Point3d(1, 1, 1);
            Ellipsoid s = new Ellipsoid(p, new Vector3d(3, 0, 0), new Vector3d(0, 5, 0), new Vector3d(0, 0, 2));

            p = new Point3d(2, 2, 2);  // Point inside
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsTrue(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));

            p = new Point3d(1, 6, 1);  // Point on surface
            Assert.IsTrue(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsFalse(p.IsOutside(s));
            Assert.IsTrue(p.IsOnBoundary(s));

            p = new Point3d(1, 6.005, 1);  // Point outside
            Assert.IsFalse(p.BelongsTo(s));
            Assert.IsFalse(p.IsInside(s));
            Assert.IsTrue(p.IsOutside(s));
            Assert.IsFalse(p.IsOnBoundary(s));
        }