public void CalcChildContourTree(float maxSupportConeDistance) { this.ChildContourTree.Clear(); var decimalCorrectionFactor = 10000; var clipper = new ContourHelper.ClipperOffset(); var results = new List <List <ContourHelper.IntPoint> >(); var destinationPolyTree = new ContourHelper.PolyTree(); clipper.AddPath(this.OuterPath, ContourHelper.JoinType.jtMiter, ContourHelper.EndType.etClosedPolygon); clipper.Execute(ref destinationPolyTree, -maxSupportConeDistance * decimalCorrectionFactor); foreach (var polyNode in destinationPolyTree.Childs) { var contour = new SliceContourInfo(); contour.OuterPath.AddRange(polyNode.Contour); contour.ParentContour = this; contour.CalcChildContourTree(maxSupportConeDistance); this.ChildContourTree.Add(contour); } }
public void DrawContour(SliceContourInfo contour) { var childOuterPoints = contour.OuterPoints; for (var i = 0; i < childOuterPoints.Count; i++) { if (i == childOuterPoints.Count - 1) { OpenTK.Graphics.OpenGL.GL.Vertex3(childOuterPoints[i]); OpenTK.Graphics.OpenGL.GL.Vertex3(childOuterPoints[0]); } else { OpenTK.Graphics.OpenGL.GL.Vertex3(childOuterPoints[i]); OpenTK.Graphics.OpenGL.GL.Vertex3(childOuterPoints[i + 1]); } } foreach (var childContour in contour.ChildContourTree) { DrawContour(childContour); } }