本文整理汇总了C#中Polygons.RemoveSmallAreas方法的典型用法代码示例。如果您正苦于以下问题:C# Polygons.RemoveSmallAreas方法的具体用法?C# Polygons.RemoveSmallAreas怎么用?C# Polygons.RemoveSmallAreas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygons
的用法示例。
在下文中一共展示了Polygons.RemoveSmallAreas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateTopAndBottoms
public void GenerateTopAndBottoms(int layerIndex, int extrusionWidth_um, int outerPerimeterWidth_um, int downLayerCount, int upLayerCount)
{
ExtruderLayers extruder = this;
SliceLayer layer = extruder.Layers[layerIndex];
for (int islandIndex = 0; islandIndex < layer.Islands.Count; islandIndex++)
{
LayerIsland island = layer.Islands[islandIndex];
// this is the entire extrusion width to make sure we are outside of the extrusion line
Polygons lastInset = island.InsetToolPaths[island.InsetToolPaths.Count - 1];
Polygons insetWithOffset = lastInset.Offset(-extrusionWidth_um);
Polygons infillOutlines = new Polygons(insetWithOffset);
// calculate the bottom outlines
if (downLayerCount > 0)
{
Polygons bottomOutlines = new Polygons(insetWithOffset);
if (layerIndex - 1 >= 0)
{
bottomOutlines = RemoveIslandsFromPolygons(extruder.Layers[layerIndex - 1].Islands, island.BoundingBox, bottomOutlines);
bottomOutlines.RemoveSmallAreas(extrusionWidth_um);
}
infillOutlines = infillOutlines.CreateDifference(bottomOutlines);
infillOutlines = Clipper.CleanPolygons(infillOutlines, cleanDistance_um);
island.SolidBottomToolPaths = bottomOutlines;
}
// calculate the top outlines
if (upLayerCount > 0)
{
Polygons topOutlines = new Polygons(insetWithOffset);
topOutlines = topOutlines.CreateDifference(island.SolidBottomToolPaths);
topOutlines = Clipper.CleanPolygons(topOutlines, cleanDistance_um);
for (int insetIndex = 0; insetIndex < island.InsetToolPaths.Count - 1; insetIndex++)
{
// Add thin wall filling by taking the area between the insets.
Polygons largerInset = island.InsetToolPaths[insetIndex].Offset(-extrusionWidth_um / 2);
Polygons smallerInset = island.InsetToolPaths[insetIndex + 1].Offset(extrusionWidth_um / 2);
Polygons thinWalls = largerInset.CreateDifference(smallerInset).Offset(-extrusionWidth_um/4);
if (thinWalls.Count > 0)
{
topOutlines.AddAll(thinWalls);
}
}
if (layerIndex + 1 < extruder.Layers.Count)
{
// Remove the top layer that is above this one to get only the data that is a top layer on this layer.
topOutlines = RemoveIslandsFromPolygons(extruder.Layers[layerIndex + 1].Islands, island.BoundingBox, topOutlines);
}
topOutlines.RemoveSmallAreas(extrusionWidth_um);
infillOutlines = infillOutlines.CreateDifference(topOutlines);
infillOutlines = Clipper.CleanPolygons(infillOutlines, cleanDistance_um);
island.SolidTopToolPaths = topOutlines;
}
// calculate the solid infill outlines
if (upLayerCount > 1 || downLayerCount > 1)
{
Polygons solidInfillOutlines = new Polygons(insetWithOffset);
solidInfillOutlines = solidInfillOutlines.CreateDifference(island.SolidBottomToolPaths);
solidInfillOutlines = Clipper.CleanPolygons(solidInfillOutlines, cleanDistance_um);
solidInfillOutlines = solidInfillOutlines.CreateDifference(island.SolidTopToolPaths);
solidInfillOutlines = Clipper.CleanPolygons(solidInfillOutlines, cleanDistance_um);
int upEnd = layerIndex + upLayerCount + 1;
if (upEnd <= extruder.Layers.Count && layerIndex - downLayerCount >= 0)
{
Polygons totalPartsToRemove = new Polygons(insetWithOffset);
int upStart = layerIndex + 2;
for (int layerToTest = upStart; layerToTest < upEnd; layerToTest++)
{
totalPartsToRemove = AddIslandsToPolygons(extruder.Layers[layerToTest].Islands, island.BoundingBox, totalPartsToRemove);
totalPartsToRemove = Clipper.CleanPolygons(totalPartsToRemove, cleanDistance_um);
}
int downStart = layerIndex - 1;
int downEnd = layerIndex - downLayerCount;
for (int layerToTest = downStart; layerToTest >= downEnd; layerToTest--)
{
totalPartsToRemove = AddIslandsToPolygons(extruder.Layers[layerToTest].Islands, island.BoundingBox, totalPartsToRemove);
totalPartsToRemove = Clipper.CleanPolygons(totalPartsToRemove, cleanDistance_um);
}
solidInfillOutlines = solidInfillOutlines.CreateDifference(totalPartsToRemove);
solidInfillOutlines.RemoveSmallAreas(extrusionWidth_um);
solidInfillOutlines = Clipper.CleanPolygons(solidInfillOutlines, cleanDistance_um);
//.........这里部分代码省略.........