|
@@ -95,6 +95,20 @@ Object.assign( Triangle, {
|
|
|
|
|
|
}(),
|
|
}(),
|
|
|
|
|
|
|
|
+ containsPoint: function () {
|
|
|
|
+
|
|
|
|
+ var v1 = new Vector3();
|
|
|
|
+
|
|
|
|
+ return function containsPoint( point, a, b, c ) {
|
|
|
|
+
|
|
|
|
+ Triangle.getBarycoord( point, a, b, c, v1 );
|
|
|
|
+
|
|
|
|
+ return ( v1.x >= 0 ) && ( v1.y >= 0 ) && ( ( v1.x + v1.y ) <= 1 );
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ }(),
|
|
|
|
+
|
|
uvIntersection: function () {
|
|
uvIntersection: function () {
|
|
|
|
|
|
var barycoord = new Vector3();
|
|
var barycoord = new Vector3();
|
|
@@ -116,20 +130,6 @@ Object.assign( Triangle, {
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- }(),
|
|
|
|
-
|
|
|
|
- containsPoint: function () {
|
|
|
|
-
|
|
|
|
- var v1 = new Vector3();
|
|
|
|
-
|
|
|
|
- return function containsPoint( point, a, b, c ) {
|
|
|
|
-
|
|
|
|
- Triangle.getBarycoord( point, a, b, c, v1 );
|
|
|
|
-
|
|
|
|
- return ( v1.x >= 0 ) && ( v1.y >= 0 ) && ( ( v1.x + v1.y ) <= 1 );
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
}()
|
|
}()
|
|
|
|
|
|
} );
|
|
} );
|
|
@@ -232,6 +232,12 @@ Object.assign( Triangle.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ uvIntersection: function ( point, uv1, uv2, uv3, result ) {
|
|
|
|
+
|
|
|
|
+ return Triangle.uvIntersection( point, this.a, this.b, this.c, uv1, uv2, uv3, result );
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
intersectsBox: function ( box ) {
|
|
intersectsBox: function ( box ) {
|
|
|
|
|
|
return box.intersectsTriangle( this );
|
|
return box.intersectsTriangle( this );
|