|
@@ -47,24 +47,24 @@
|
|
|
<!-- replace built-in triangulation with Earcut -->
|
|
|
<script src="js/libs/earcut.js"></script>
|
|
|
<script>
|
|
|
-
|
|
|
- function removeDupEndPts(points) {
|
|
|
-
|
|
|
- var l = points.length;
|
|
|
- if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {
|
|
|
- points.pop();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function addContour( vertices, contour ) {
|
|
|
+
|
|
|
+ THREE.ShapeUtils.triangulateShape = function ( contour, holes ) {
|
|
|
|
|
|
- for ( var i = 0; i < contour.length; i++ ) {
|
|
|
- vertices.push( contour[i].x );
|
|
|
- vertices.push( contour[i].y );
|
|
|
+ function removeDupEndPts(points) {
|
|
|
+
|
|
|
+ var l = points.length;
|
|
|
+ if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {
|
|
|
+ points.pop();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- THREE.ShapeUtils.triangulateShape = function ( contour, holes ) {
|
|
|
+ function addContour( vertices, contour ) {
|
|
|
+
|
|
|
+ for ( var i = 0; i < contour.length; i++ ) {
|
|
|
+ vertices.push( contour[i].x );
|
|
|
+ vertices.push( contour[i].y );
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
removeDupEndPts( contour );
|
|
|
holes.forEach( removeDupEndPts );
|