Esempio n. 1
0
        internal void ConvertModelBleedingIntersectionsToPolyTrees(float sliceHeight, AtumPrinter selectedPrinter, bool usePixelsAsValues = true)
        {
            var angledSides     = new List <List <PolylineWithNormal> >();
            var wallSides       = new List <List <PolylineWithNormal> >();
            var facingDownSides = new List <PolyNode>();

            this.ModelBleedingPolyTrees[0] = PolyTree.FromListOfModelIntersectionsUsingPolygons(sliceHeight, this._modelBleedingZIntersections, selectedPrinter,
                                                                                                null, null,
                                                                                                out angledSides, out wallSides, usePixelsAsValues);
        }
Esempio n. 2
0
        internal void ConvertModelIntersectionsToPolyTrees(float sliceHeight, AtumPrinter selectedPrinter, Material selectedMaterial, SupportProfile selectedMaterialProfile,
                                                           List <float[]> angleSideAngles, List <float[]> wallSideAngles,
                                                           bool usePixelsAsValues = true, bool includeAngledSide = false, bool includeWallSides = false)
        {
            var angledSides = new List <List <PolylineWithNormal> >();
            var wallSides   = new List <List <PolylineWithNormal> >();

            this.ModelPolyTrees[0] = PolyTree.FromListOfModelIntersectionsUsingPolygons(sliceHeight, this._modelIntersectionsZ, selectedPrinter,
                                                                                        angleSideAngles, wallSideAngles,
                                                                                        out angledSides, out wallSides,
                                                                                        usePixelsAsValues, processUnion: true,
                                                                                        includeAngledSides: includeAngledSide, includeWallSides: includeWallSides);


            if (includeAngledSide && angledSides.Count > 0)
            {
                this.ModelAnglesPolyTree = new PolyTree();
                var clipperOffset = new ClipperOffset();
                var clipperResult = new PolyTree();
                foreach (var angledSide in angledSides)
                {
                    var polyList = new List <IntPoint>();
                    foreach (var angledPolygon in angledSide)
                    {
                        polyList.Add(angledPolygon.Point);
                    }


                    ReducePointsInPath(polyList, MagsAIEngine.PixelOffsetOptimisation);

                    clipperOffset.AddPath(polyList, JoinType.jtMiter, EndType.etOpenButt);
                }

                clipperOffset.Execute(ref clipperResult, (selectedMaterialProfile.SupportOverhangDistance) * (CONTOURPOINT_TO_VECTORPOINT_FACTOR));
                clipperResult            = IntersectModelSliceLayer(this.ModelPolyTrees[0][0], clipperResult);
                this.ModelAnglesPolyTree = clipperResult;
                ReducePointsInPolyTree(this.ModelAnglesPolyTree, MagsAIEngine.PixelOffsetOptimisation);
            }

            //polytree using polygon offset
            if (includeWallSides && wallSides.Count > 0)
            {
                var clipperOffset = new ClipperOffset();
                foreach (var wallSide in wallSides)
                {
                    var polyList = new List <IntPoint>();
                    foreach (var wallPolygon in wallSide)
                    {
                        polyList.Add(wallPolygon.Point);
                    }

                    ReducePointsInPath(polyList, MagsAIEngine.PixelOffsetOptimisation);
                    clipperOffset.AddPath(polyList, JoinType.jtMiter, EndType.etOpenButt);
                }

                var clipperResult = new PolyTree();
                clipperOffset.Execute(ref clipperResult, (selectedMaterialProfile.SupportOverhangDistance / 2) * (CONTOURPOINT_TO_VECTORPOINT_FACTOR));
                clipperResult = IntersectModelSliceLayer(this.ModelWallPolyTree, clipperResult);

                this.ModelWallPolyTree = clipperResult;
                ReducePointsInPolyTree(this.ModelWallPolyTree, MagsAIEngine.PixelOffsetOptimisation);

                //TriangleHelper.SavePolyNodesContourToPng(this.ModelWallPolyTree._allPolys, "wall_" + sliceHeight.ToString("00.00"));
            }
        }