示例#1
0
        public void VectorAngleToPlaneTest()
        {
            Plane3d s = new Plane3d();
            // XY plane

            Vector3d v = new Vector3d(1, 0, 0);

            Assert.IsTrue(Abs(v.AngleTo(s)) < GeometRi3D.Tolerance);
            Assert.IsTrue(Abs(s.AngleTo(v)) < GeometRi3D.Tolerance);

            v = new Vector3d(0, 0, 1);
            Assert.IsTrue(Abs(v.AngleTo(s) - PI / 2) < GeometRi3D.Tolerance);
            Assert.IsTrue(Abs(s.AngleTo(v) - PI / 2) < GeometRi3D.Tolerance);

            v = new Vector3d(0, 0, -1);
            Assert.IsTrue(Abs(v.AngleTo(s) - PI / 2) < GeometRi3D.Tolerance);
            Assert.IsTrue(Abs(s.AngleTo(v) - PI / 2) < GeometRi3D.Tolerance);

            v = new Vector3d(1, 0, 1);
            Assert.IsTrue(Abs(v.AngleTo(s) - PI / 4) < GeometRi3D.Tolerance);
            Assert.IsTrue(Abs(s.AngleTo(v) - PI / 4) < GeometRi3D.Tolerance);

            v = new Vector3d(1, 0, -1);
            Assert.IsTrue(Abs(v.AngleTo(s) - PI / 4) < GeometRi3D.Tolerance);
            Assert.IsTrue(Abs(s.AngleTo(v) - PI / 4) < GeometRi3D.Tolerance);
        }