|
@@ -44,27 +44,21 @@
|
|
|
|
|
|
setFromPoints( points ) {
|
|
|
|
|
|
- if ( Array.isArray( points ) !== true ) {
|
|
|
+ // The algorithm needs at least four points.
|
|
|
+ if ( points.length >= 4 ) {
|
|
|
|
|
|
- console.error( 'THREE.ConvexHull: Points parameter is not an array.' );
|
|
|
+ this.makeEmpty();
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- if ( points.length < 4 ) {
|
|
|
-
|
|
|
- console.error( 'THREE.ConvexHull: The algorithm needs at least four points.' );
|
|
|
+ for ( let i = 0, l = points.length; i < l; i ++ ) {
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- this.makeEmpty();
|
|
|
+ this.vertices.push( new VertexNode( points[ i ] ) );
|
|
|
|
|
|
- for ( let i = 0, l = points.length; i < l; i ++ ) {
|
|
|
+ }
|
|
|
|
|
|
- this.vertices.push( new VertexNode( points[ i ] ) );
|
|
|
+ this.compute();
|
|
|
|
|
|
}
|
|
|
|
|
|
- this.compute();
|
|
|
return this;
|
|
|
|
|
|
}
|