|
@@ -49,8 +49,24 @@
|
|
<script>
|
|
<script>
|
|
THREE.ShapeUtils.triangulateShape = ( function () {
|
|
THREE.ShapeUtils.triangulateShape = ( function () {
|
|
var pnlTriangulator = new PNLTRI.Triangulator();
|
|
var pnlTriangulator = new PNLTRI.Triangulator();
|
|
|
|
+ function removeDupEndPts(points) {
|
|
|
|
+
|
|
|
|
+ var l = points.length;
|
|
|
|
+
|
|
|
|
+ if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {
|
|
|
|
+
|
|
|
|
+ points.pop();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
return function triangulateShape( contour, holes ) {
|
|
return function triangulateShape( contour, holes ) {
|
|
// console.log("new Triangulation: PnlTri.js " + PNLTRI.REVISION );
|
|
// console.log("new Triangulation: PnlTri.js " + PNLTRI.REVISION );
|
|
|
|
+
|
|
|
|
+ removeDupEndPts( contour );
|
|
|
|
+ holes.forEach( removeDupEndPts );
|
|
|
|
+
|
|
return pnlTriangulator.triangulate_polygon( [ contour ].concat(holes) );
|
|
return pnlTriangulator.triangulate_polygon( [ contour ].concat(holes) );
|
|
};
|
|
};
|
|
} )();
|
|
} )();
|