Browse Source

QuickHull: Added containsPoint().

Mugen87 6 years ago
parent
commit
2b486aef31
1 changed files with 18 additions and 0 deletions
  1. 18 0
      examples/js/QuickHull.js

+ 18 - 0
examples/js/QuickHull.js

@@ -119,6 +119,24 @@
 
 
 		},
 		},
 
 
+		containsPoint: function ( point ) {
+
+			var faces = this.faces;
+
+			for ( var i = 0, l = faces.length; i < l; i ++ ) {
+
+				var face = faces[ i ];
+
+				// compute signed distance and check on what half space the point lies
+
+				if ( face.distanceToPoint( point ) > this.tolerance ) return false;
+
+			}
+
+			return true;
+
+		},
+
 		makeEmpty: function () {
 		makeEmpty: function () {
 
 
 			this.faces = [];
 			this.faces = [];