diff options
-rw-r--r-- | intern/dualcon/intern/Projections.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/intern/dualcon/intern/Projections.h b/intern/dualcon/intern/Projections.h index be49fafb310..7740b0d1634 100644 --- a/intern/dualcon/intern/Projections.h +++ b/intern/dualcon/intern/Projections.h @@ -783,19 +783,17 @@ float getIntersectionPrimary(int edgeInd) LONG proj0 = cubeProj[i][0]; LONG proj1 = cubeProj[i][0] + cubeProj[i][edgeInd + 1]; LONG proj2 = inherit->trigProj[i][1]; + LONG d = proj1 - proj0; + double alpha; - // double alpha = (double)( ( proj2 - proj0 ) * cubeProj[edgeInd][edgeInd + 1] ) / (double)( proj1 - proj0 ) ; - double alpha = (double)( (proj2 - proj0) ) / (double)(proj1 - proj0); - - if (alpha < 0) - { + if (d == 0) alpha = 0.5; - } - else if (alpha > 1) - { - alpha = 0.5; - } + else { + alpha = (double)((proj2 - proj0)) / (double)d; + if (alpha < 0 || alpha > 1) + alpha = 0.5; + } return (float)alpha; }; |