|
@@ -1,4 +1,3 @@
|
|
|
-import { Vector2 } from './Vector2.js';
|
|
|
import { Vector3 } from './Vector3.js';
|
|
|
|
|
|
/**
|
|
@@ -109,24 +108,20 @@ Object.assign( Triangle, {
|
|
|
|
|
|
}(),
|
|
|
|
|
|
- uvIntersection: function () {
|
|
|
+ getUV: function () {
|
|
|
|
|
|
var barycoord = new Vector3();
|
|
|
- var v1 = new Vector2();
|
|
|
- var v2 = new Vector2();
|
|
|
- var v3 = new Vector2();
|
|
|
|
|
|
- return function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3, result ) {
|
|
|
+ return function getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {
|
|
|
|
|
|
this.getBarycoord( point, p1, p2, p3, barycoord );
|
|
|
|
|
|
- v1.copy( uv1 ).multiplyScalar( barycoord.x );
|
|
|
- v2.copy( uv2 ).multiplyScalar( barycoord.y );
|
|
|
- v3.copy( uv3 ).multiplyScalar( barycoord.z );
|
|
|
+ target.set( 0, 0 );
|
|
|
+ target.addScaledVector( uv1, barycoord.x );
|
|
|
+ target.addScaledVector( uv2, barycoord.y );
|
|
|
+ target.addScaledVector( uv3, barycoord.z );
|
|
|
|
|
|
- v1.add( v2 ).add( v3 );
|
|
|
-
|
|
|
- return result.copy( v1 );
|
|
|
+ return target;
|
|
|
|
|
|
};
|
|
|
|
|
@@ -232,9 +227,9 @@ Object.assign( Triangle.prototype, {
|
|
|
|
|
|
},
|
|
|
|
|
|
- uvIntersection: function ( point, uv1, uv2, uv3, result ) {
|
|
|
+ getUV: function ( point, uv1, uv2, uv3, result ) {
|
|
|
|
|
|
- return Triangle.uvIntersection( point, this.a, this.b, this.c, uv1, uv2, uv3, result );
|
|
|
+ return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, result );
|
|
|
|
|
|
},
|
|
|
|