Exemplo n.º 1
0
        public void Cropping_Segment3_by_plane_produces_null_when_entire_segment_is_on_negative_side()
        {
            var segment = new Segment3(new Vector3(3.14, 2.88, -1.77), new Vector3(0.52, -5.08, 1.23));

            var point = segment.PointAt(1.256);

            var plane = new Plane(point, normal: new Vector3(0.66, 1.44, -0.87));

            var crop = segment.CropBy(plane);

            Expect(crop == null);
        }
Exemplo n.º 2
0
        public void Cropping_Segment3_by_plane_produces_original_segment_when_entire_segment_is_on_positive_side()
        {
            var segment = new Segment3(new Vector3(3.14, 2.88, -1.77), new Vector3(0.52, -5.08, 1.23));

            var point = segment.PointAt(-0.256);

            var plane = new Plane(point, normal: new Vector3(0.66, 1.44, -0.87));

            var crop = segment.CropBy(plane);

            Expect(crop != null);
            Expect(Vector3.Distance(crop.Value.Start, segment.Start), Is.LessThan(_tolerance));
            Expect(Vector3.Distance(crop.Value.End, segment.End), Is.LessThan(_tolerance));
        }