function removeDupEndPts(points) {

                var l = points.length;

                if ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {

                    points.pop();

                }

            }
Triangulate: ERROR - probable bad polygon!

                        //throw ( "Warning, unable to triangulate polygon!" );
                        //return null;
                        // Sometimes warning is fine, especially polygons are triangulated in reverse.
                        console.warn( 'THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()' );

                        if ( indices ) return vertIndices;
                        return result;

                    }

                    /* three consecutive vertices in current polygon, <u,v,w>