Пример #1
0
        public void Arc3DTest_0001()
        {
            var tol = 1e-7;

            var p1 = new Vector3D("X = 13.87329226 Y = 134.93466652 Z = -3.70729037");
            var p2 = new Vector3D("X = 75.89230418 Y = 224.11406806 Z = 35.97437873");
            var p3 = new Vector3D("X = 97.48181688 Y = 229.31008314 Z = 16.9314998");

            var arc = new Arc3D(tol, p1, p2, p3);

            var plo = new Vector3D("X = -74.96786784 Y = 178.50832685 Z = -43.45380285");
            var plx = new Vector3D("X = 61.65932598 Y = 313.82398026 Z = -33.75931542");
            var ply = new Vector3D("X = 87.35160811 Y = 8.94741958 Z = 35.66234059");

            var plcs = new CoordinateSystem3D(plo, plx - plo, ply - plo);

            var iSegmentPts = arc.Intersect(tol, plcs, only_perimeter: false).ToList();
            var i1          = iSegmentPts[0];
            var i2          = iSegmentPts[1];
            var iSegment    = new Line3D(i1, i2);

            Assert.True(plcs.Contains(tol, i1));
            Assert.True(plcs.Contains(tol, i2));

            Assert.True(arc.Contains(tol, i1, onlyPerimeter: false));
            Assert.True(arc.Contains(tol, i2, onlyPerimeter: false));

            Assert.True(i1.EqualsTol(tol, new Vector3D("X = 40.09735573 Y = 156.48945821 Z = -7.46179105")));
            Assert.True(i2.EqualsTol(tol, new Vector3D("X = 72.20796391 Y = 188.29182351 Z = -5.18335819")));
        }
Пример #2
0
        public void CoordinateSystem3DTest_004()
        {
            var cs1cad = new CoordinateSystem3D(new Vector3D(-1, 77, .75),
                                                new Vector3D(0, 0, 1),
                                                new Vector3D(.619, -.785, 0),
                                                new Vector3D(.785, .619, 0));

            var cs2cad = new CoordinateSystem3D(new Vector3D(-1, 77, .75),
                                                new Vector3D(-0.649, .409, .642),
                                                new Vector3D(-.108, -.884, .454),
                                                new Vector3D(.753, .225, .618));

            var vaxis = new Vector3D(-.311, -1.15, -.75);

            Assert.True(cs1cad.Rotate(vaxis, 60d.ToRad()).Equals(1e-3, cs2cad));

            var pt = new Vector3D(-1.379, 76.762, 1.298);

            Assert.True(cs2cad.Contains(1e-3, pt) && !cs1cad.Contains(1e-3, pt));
        }