提交 eb315f02 编写于 作者: A Andreas Plesch 提交者: GitHub

helper functions in scope

上级 d324144d
......@@ -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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册