#1325 Fixed crash when polygons with > 3 indices turn out to be degenerate

master
Marius Kintel 2015-04-25 15:20:09 -04:00
parent 172f1bfd3e
commit e6989526ca
7 changed files with 21 additions and 6 deletions

View File

@ -77,7 +77,10 @@ namespace PolysetUtils {
if (currface.empty() || idx != currface.back()) currface.push_back(idx); if (currface.empty() || idx != currface.back()) currface.push_back(idx);
} }
if (currface.front() == currface.back()) currface.pop_back(); if (currface.front() == currface.back()) currface.pop_back();
if (currface.size() < 3) faces.pop_back(); // Cull empty triangles if (currface.size() < 3) {
faces.pop_back(); // Cull empty triangles
if (faces.empty()) polygons.pop_back(); // All faces were culled
}
} }
// Tessellate indexed mesh // Tessellate indexed mesh

10
testdata/scad/3D/issues/issue1325.scad vendored Normal file
View File

@ -0,0 +1,10 @@
polyhedron(points = [
[0, -4, 1],
[0, -5, 1],
[0, -5, 2],
[0, -4, 0]
],
faces = [
[1, 2, 2, 1],
[0, 0, 3, 3]
]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -49,7 +49,8 @@
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable> <BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E0034E3D19AA8651009F0BD0" BlueprintIdentifier = "E0034E3D19AA8651009F0BD0"
@ -69,15 +70,15 @@
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "testdata/scad/3D/issues/issue1061.scad -o out.png" argument = "testdata/scad/3D/issues/issue1061.scad -o out.png"
isEnabled = "YES"> isEnabled = "NO">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "testdata/scad/3D/issues/minkowski-thin-cylinder.scad -o out.png" argument = "testdata/scad/3D/issues/minkowski-thin-cylinder.scad -o out.png"
isEnabled = "NO"> isEnabled = "NO">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "spheres.scad -o out.png" argument = "issue1276.scad"
isEnabled = "NO"> isEnabled = "YES">
</CommandLineArgument> </CommandLineArgument>
<CommandLineArgument <CommandLineArgument
argument = "non-manifold2.scad -o non-manifold2.stl --debug=GeometryUtils" argument = "non-manifold2.scad -o non-manifold2.stl --debug=GeometryUtils"
@ -113,7 +114,8 @@
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release" buildConfiguration = "Release"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable> <BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "E0034E3D19AA8651009F0BD0" BlueprintIdentifier = "E0034E3D19AA8651009F0BD0"