コード例 #1
0
        public void PlanarLinearObjectsCoplanarityTest()
        {
            Plane3d   p1 = new Plane3d(new Point3d(1, 1, 1), new Vector3d(1, 0, 0));
            Line3d    l1 = new Line3d(new Point3d(1, 1, 1), new Vector3d(0, 1, 1));
            Segment3d s1 = new Segment3d(new Point3d(1, 2, 4), new Point3d(2, -2, 0));

            Assert.IsTrue(p1.IsCoplanarTo(l1));
            Assert.IsTrue(l1.IsCoplanarTo(p1));
            Assert.IsFalse(p1.IsCoplanarTo(s1));
            Assert.IsFalse(s1.IsCoplanarTo(p1));
        }
コード例 #2
0
        public void LinearObjectsCoplanarityTest()
        {
            Line3d l1 = new Line3d(new Point3d(1, 1, 1), new Vector3d(0, 1, 1));
            Line3d l2 = new Line3d(new Point3d(-1, 2, 1), new Vector3d(0, 1, 1));
            Line3d l3 = new Line3d(new Point3d(1, 2, 3), new Vector3d(0, 2, 1));
            Line3d l4 = new Line3d(new Point3d(1, 1, 1), new Vector3d(1, 2, 3));

            // Self-coplanarity
            Assert.IsTrue(l1.IsCoplanarTo(l1));
            // Parallel lines
            Assert.IsTrue(l1.IsCoplanarTo(l2));
            // Intersecting lines
            Assert.IsTrue(l1.IsCoplanarTo(l3));
            // Intersecting lines
            Assert.IsTrue(l1.IsCoplanarTo(l4));
            // Not coplanar
            Assert.IsFalse(l3.IsCoplanarTo(l4));

            Segment3d s1 = new Segment3d(new Point3d(1, 2, 4), new Point3d(1, -2, 5));

            Assert.IsTrue(s1.IsCoplanarTo(s1));
            Assert.IsTrue(s1.IsCoplanarTo(l1));
            Assert.IsFalse(s1.IsCoplanarTo(l4));
        }