Skip to content

Commit

Permalink
Merge pull request #1 from andreasplesch/earcu
Browse files Browse the repository at this point in the history
helper functions in scope
  • Loading branch information
andreasplesch authored Jan 3, 2017
2 parents d324144 + eb315f0 commit a3028f5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions examples/webgl_geometry_text_earcut.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit a3028f5

Please sign in to comment.