public void CoordinateSystem_Shift_UndoShift() { CoordinateSystem system = new CoordinateSystem(Point.MakePointWithInches(-1, 2, 4), new Angle(new Degree(), 123), new Angle(new Degree(), -22), new Angle(new Degree(), 78)); List<LineSegment> bounds = new List<LineSegment>(); bounds.Add(new LineSegment(Point.MakePointWithInches(0, 1, 0), Point.MakePointWithInches(0, 3, 0))); bounds.Add(new LineSegment(Point.MakePointWithInches(0, 1, 0), Point.MakePointWithInches(4, 1, 0))); bounds.Add(new LineSegment(Point.MakePointWithInches(0, 3, 0), Point.MakePointWithInches(4, 3, 0))); bounds.Add(new LineSegment(Point.MakePointWithInches(4, 1, 0), Point.MakePointWithInches(4, 3, 0))); Polygon testPolygon = new Polygon(bounds); Polygon shifted = testPolygon.Shift(system.ShiftToThisFrom()); Polygon shifted2 = shifted.Shift(system.ShiftFromThisTo()); testPolygon.Should().Be(shifted2); }
public void Polygon_RemovePolygons_VM_6b() { //this will be a test of the top plate from VM_6b var point1=new Point(41*Distance.Inches, 25.874*Distance.Inches); var point2 = new Point(45 * Distance.Inches, 25.874 * Distance.Inches); var point3 = new Point(45 * Distance.Inches, 29.874 * Distance.Inches); var point4 = new Point(41 * Distance.Inches, 29.874 * Distance.Inches); var point5 = new Point(41.25 * Distance.Inches, 25.874 * Distance.Inches); var point6 = new Point(44.75 * Distance.Inches, 25.874 * Distance.Inches); var point7 = new Point(44.75 * Distance.Inches, 26.562 * Distance.Inches); var point8 = new Point(43 * Distance.Inches, 27.875 * Distance.Inches); var point9 = new Point(41.25 * Distance.Inches, 26.562 * Distance.Inches); var point10 = new Point(41 * Distance.Inches, 26.375 * Distance.Inches); var point11 = new Point(45 * Distance.Inches, 26.375 * Distance.Inches); var point12 = new Point(43 * Distance.Inches, 29.874 * Distance.Inches); var platePoints =new List<Point>(); platePoints.Add(point1); platePoints.Add(point2); platePoints.Add(point3); platePoints.Add(point4); var area1Points = new List<Point>(); area1Points.Add(point5); area1Points.Add(point6); area1Points.Add(point7); area1Points.Add(point8); area1Points.Add(point9); var area2Points = new List<Point>(); area2Points.Add(point10); area2Points.Add(point8); area2Points.Add(point12); area2Points.Add(point4); var area3Points = new List<Point>(); area3Points.Add(point8); area3Points.Add(point11); area3Points.Add(point3); area3Points.Add(point12); var area1 = new Polygon(area1Points); var area2 =new Polygon(area2Points); var area3 = new Polygon(area3Points); var plate = new Polygon(platePoints); var polygons = new List<Polygon>(); var plates = new List<Polygon>(); polygons.Add(area2); polygons.Add(area3); polygons.Add(area1); plates.Add(plate); var results = plate.RemoveOverlappingPolygons(polygons); results.Count.Should().Be(2); var leftover1points = new List<Point>(); leftover1points.Add(point2); leftover1points.Add(point11); leftover1points.Add(point7); leftover1points.Add(point6); var leftover1 = new Polygon(leftover1points); leftover1.Should().Be(results[0]); var leftover2points = new List<Point>(); leftover2points.Add(point1); leftover2points.Add(point5); leftover2points.Add(point9); leftover2points.Add(point10); var leftover2 =new Polygon(leftover2points); leftover2.Should().Be(results[1]); }