aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/StageLine.js12
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js1
-rwxr-xr-xjs/helper-classes/3D/math-utils.js3
3 files changed, 14 insertions, 2 deletions
diff --git a/js/helper-classes/3D/StageLine.js b/js/helper-classes/3D/StageLine.js
index d6eea478..b869fb17 100755
--- a/js/helper-classes/3D/StageLine.js
+++ b/js/helper-classes/3D/StageLine.js
@@ -246,8 +246,17 @@ var StageLine = exports.StageLine = Object.create(Object.prototype, {
246 if (s0 != s1) 246 if (s0 != s1)
247 { 247 {
248 var t = Math.abs(d0)/( Math.abs(d0) + Math.abs(d1) ); 248 var t = Math.abs(d0)/( Math.abs(d0) + Math.abs(d1) );
249 if (t == 0) 249 if (MathUtils.fpSign(t) === 0)
250 { 250 {
251 // the first point of the line is on the (infinite) extension of a side of the boundary.
252 // Make sure the point (pt0) is within the range of the polygon edge
253 var vt0 = vecUtils.vecSubtract(3, pt0, bp0),
254 vt1 = vecUtils.vecSubtract(3, bp1, pt0);
255 var dt0 = vecUtils.vecDot(3, vec, vt0),
256 dt1 = vecUtils.vecDot(3, vec, vt1);
257 var st0 = MathUtils.fpSign(dt0), st1 = MathUtils.fpSign(dt1);
258 if ((st0 >= 0) && (st1 >= 0))
259 {
251 if (s1 > 0) // entering the material from the beginning of the line that is to be drawn 260 if (s1 > 0) // entering the material from the beginning of the line that is to be drawn
252 { 261 {
253 // see if the start point of the line is at a corner of the bounded plane 262 // see if the start point of the line is at a corner of the bounded plane
@@ -291,6 +300,7 @@ var StageLine = exports.StageLine = Object.create(Object.prototype, {
291 } 300 }
292 } 301 }
293 } 302 }
303 }
294 else if ( (MathUtils.fpSign(t) > 0) && (MathUtils.fpCmp(t,1.0) <= 0)) 304 else if ( (MathUtils.fpSign(t) > 0) && (MathUtils.fpCmp(t,1.0) <= 0))
295 { 305 {
296 // get the point where the line crosses the edge of the element plane 306 // get the point where the line crosses the edge of the element plane
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 65a2647e..5d3a1e2f 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -829,6 +829,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
829 var obj = this._stateArray.pop(); 829 var obj = this._stateArray.pop();
830 this._lineColor = obj._lineColor; 830 this._lineColor = obj._lineColor;
831 this._drawingContext.lineWidth = obj._lineWidth; 831 this._drawingContext.lineWidth = obj._lineWidth;
832 this._drawingContext.strokeStyle = obj._lineColor;
832 } 833 }
833 }, 834 },
834 835
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js
index 191b02bd..001f03fe 100755
--- a/js/helper-classes/3D/math-utils.js
+++ b/js/helper-classes/3D/math-utils.js
@@ -839,7 +839,8 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
839 { 839 {
840 //var t = vec1.modulus() / vec0.modulus(); 840 //var t = vec1.modulus() / vec0.modulus();
841 var t = VecUtils.vecMag(2, vec1)/VecUtils.vecMag(2, vec0); 841 var t = VecUtils.vecMag(2, vec1)/VecUtils.vecMag(2, vec0);
842 if ((this.fpSign(t) >= 0) && (this.fpCmp(t,1.0) <= 0)) 842 var dot = VecUtils.vecDot(2, vec0, vec1);
843 if ((this.fpSign(dot) >= 0) && (this.fpSign(t) >= 0) && (this.fpCmp(t,1.0) <= 0))
843 return this.ON; 844 return this.ON;
844 else 845 else
845 return this.OUTSIDE; 846 return this.OUTSIDE;