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; }
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)); }
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)); }
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)); }
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)); }
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; }
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)); }
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; }
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; }
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; }
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; }
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)); }
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)); }