diff options
Diffstat (limited to 'js/helper-classes/3D/math-utils.js')
-rwxr-xr-x | js/helper-classes/3D/math-utils.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js index 44e2499d..4da3d2c8 100755 --- a/js/helper-classes/3D/math-utils.js +++ b/js/helper-classes/3D/math-utils.js | |||
@@ -784,7 +784,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { | |||
784 | }, | 784 | }, |
785 | 785 | ||
786 | boundaryContainsPoint: { | 786 | boundaryContainsPoint: { |
787 | value: function( bounds, targetPt, backFacing ) | 787 | value: function( bounds, targetPt, backFacing, onParams ) |
788 | { | 788 | { |
789 | var pt = targetPt.slice(0); | 789 | var pt = targetPt.slice(0); |
790 | while (pt.length > 2) pt.pop(); | 790 | while (pt.length > 2) pt.pop(); |
@@ -815,8 +815,16 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { | |||
815 | { | 815 | { |
816 | //var t = vec1.modulus() / vec0.modulus(); | 816 | //var t = vec1.modulus() / vec0.modulus(); |
817 | var t = VecUtils.vecMag(2, vec1)/VecUtils.vecMag(2, vec0); | 817 | var t = VecUtils.vecMag(2, vec1)/VecUtils.vecMag(2, vec0); |
818 | if ((this.fpSign(t) >= 0) && (this.fpCmp(t,1.0) <= 0)) | 818 | var dot = VecUtils.vecDot(2, vec0, vec1); |
819 | if ((this.fpSign(dot) >= 0) && (this.fpSign(t) >= 0) && (this.fpCmp(t,1.0) <= 0)) | ||
820 | { | ||
821 | if (onParams) | ||
822 | { | ||
823 | onParams[0] = (i+3) % 4; | ||
824 | onParams[1] = t; | ||
825 | } | ||
819 | return this.ON; | 826 | return this.ON; |
827 | } | ||
820 | else | 828 | else |
821 | return this.OUTSIDE; | 829 | return this.OUTSIDE; |
822 | } | 830 | } |