public void It_Returns_The_BoundingBox_Of_The_Arc() { // Arrange double angle = GSharkMath.ToRadians(40); Arc arc2D = new Arc(Plane.PlaneXY, 15, angle); Arc arc3D = _exampleArc3D; // Act BoundingBox bBox2D = arc2D.BoundingBox(); BoundingBox bBox3D = arc3D.BoundingBox(); // Assert bBox2D.Min.EpsilonEquals(new Vector3(11.490667, 0, 0), 6).Should().BeTrue(); bBox2D.Max.EpsilonEquals(new Vector3(15, 9.641814, 0), 6).Should().BeTrue(); bBox3D.Min.EpsilonEquals(new Vector3(69.115079, 8.858347, -1.884313), 6).Should().BeTrue(); bBox3D.Max.EpsilonEquals(new Vector3(102.068402, 36.39316, 5.246477), 6).Should().BeTrue(); }
/// <summary> /// Adds a new, colored arc to the display list. /// </summary> /// <param name="arc">Arc to add.</param> /// <param name="color">Color of arc.</param> /// <param name="thickness">Thickness of arc.</param> public void AddArc(Arc arc, Color color, int thickness) { if (m_disposed) { throw new ObjectDisposedException("This CustomDisplay instance has been disposed and cannot be modified"); } if (!arc.IsValid) { return; } CDU_Arc cdu = new CDU_Arc(); cdu.m_arc = arc; cdu.m_color = Color.FromArgb(255, color); cdu.m_thickness = thickness; m_arcs.Add(cdu); m_clip.Union(arc.BoundingBox()); }
BoundingBox getBoundingBox(List <DwgEntity> entities) { BoundingBox ext = new BoundingBox(); var boundingBoxList = new List <BoundingBox>(); foreach (DwgEntity entity in entities) { if (entity is Line) { Line line = entity as Line; boundingBoxList.Add(line.BoundingBox()); } if (entity is Arc) { Arc arc = entity as Arc; boundingBoxList.Add(arc.BoundingBox()); } } ext = BoundingBoxBuilder.Union(boundingBoxList.ToArray()); return(ext); }
private void getBoundingBox() { List <BoundingBox> extentList = new List <BoundingBox>(); foreach (DwgEntity entity in entities) { if (entity is Line) { Line line = entity as Line; extentList.Add(line.BoundingBox()); } if (entity is Arc) { Arc arc = entity as Arc; extentList.Add(arc.BoundingBox()); } if (entity is Vector3) { Vector3 pt = entity as Vector3; extentList.Add(pt.BoundingBox()); } } boundingBox = BoundingBoxBuilder.Union(extentList.ToArray()); }
public IBoundingBox BoundingBox() { var bbList = new List <IBoundingBox>(); foreach (DwgEntity entity in Entities) { if (entity is Line3) { Line3 line = entity as Line3; bbList.Add(line.BoundingBox()); } if (entity is Arc) { Arc arc = entity as Arc; bbList.Add(arc.BoundingBox()); } if (entity is Vector3) { Vector3 pt = entity as Vector3; bbList.Add(pt.BoundingBox()); } } return(BoundingBoxBuilder.Union(bbList)); }
/// <summary> /// Adds a new, colored arc to the display list. /// </summary> /// <param name="arc">Arc to add.</param> /// <param name="color">Color of arc.</param> /// <param name="thickness">Thickness of arc.</param> public void AddArc(Arc arc, Color color, int thickness) { if (m_disposed) { throw new ObjectDisposedException("This CustomDisplay instance has been disposed and cannot be modified"); } if (!arc.IsValid) { return; } CDU_Arc cdu = new CDU_Arc(); cdu.m_arc = arc; cdu.m_color = Color.FromArgb(255, color); cdu.m_thickness = thickness; m_arcs.Add(cdu); m_clip.Union(arc.BoundingBox()); }