public void CropVisible_of_Segment3_outside_visible_region_is_null() { var camera = new CameraModel(focalLength: 7.13, principalPoint: new Vector2(-3.14, 2.88), domain: new Box2(minX: -4, minY: -2, width: 5, height: 8)); Segment2 chord; Segment2 segment2; Segment3 segment3; PrepareSegmentsForCropVisibleTest(camera, new Interval(1.14, 1.56), out chord, out segment2, out segment3); var crop = camera.CropVisible(segment3); Expect(crop == null); }
public void CropVisible_of_Segment3_inside_visible_region_is_original_Segment3() { var camera = new CameraModel(focalLength: 7.13, principalPoint: new Vector2(-3.14, 2.88), domain: new Box2(minX: -4, minY: -2, width: 5, height: 8)); Segment2 chord; Segment2 segment2; Segment3 segment3; PrepareSegmentsForCropVisibleTest(camera, new Interval(0.14, 0.56), out chord, out segment2, out segment3); var crop = camera.CropVisible(segment3); Expect(crop != null); ExpectSegmentsAreCollinear(crop.Value, segment3); Expect(Vector2.Distance(camera.Project(crop.Value.Start).Value, segment2.Start), Is.LessThan(_tolerance)); // crop.Start projects to correct point Expect(Vector2.Distance(camera.Project(crop.Value.End).Value, segment2.End), Is.LessThan(_tolerance)); // crop.End projects to correct point }