diff options
Diffstat (limited to 'js/helper-classes/3D/StageLine.js')
-rwxr-xr-x | js/helper-classes/3D/StageLine.js | 12 |
1 files changed, 11 insertions, 1 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 |