Fixed some epsilons.
This commit is contained in:
@@ -107,7 +107,7 @@ public class Ray2 implements IRay2
|
|||||||
double dx = end.x() - start.x(), dy = end.y() - start.y();
|
double dx = end.x() - start.x(), dy = end.y() - start.y();
|
||||||
|
|
||||||
double divisor = bx*dy - by*dx;
|
double divisor = bx*dy - by*dx;
|
||||||
if (Math.abs(divisor) < Math.EPSILON) {
|
if (Math.abs(divisor) < MathUtil.EPSILON) {
|
||||||
// the lines are parallel (or the segment is zero-length)
|
// the lines are parallel (or the segment is zero-length)
|
||||||
double t = Math.min(getIntersection(start), getIntersection(end));
|
double t = Math.min(getIntersection(start), getIntersection(end));
|
||||||
boolean isect = (t != Float.MAX_VALUE);
|
boolean isect = (t != Float.MAX_VALUE);
|
||||||
@@ -135,7 +135,7 @@ public class Ray2 implements IRay2
|
|||||||
// compute the segment's line parameters
|
// compute the segment's line parameters
|
||||||
double a = starty - end.y(), b = end.x() - startx;
|
double a = starty - end.y(), b = end.x() - startx;
|
||||||
double len = Math.hypot(a, b);
|
double len = Math.hypot(a, b);
|
||||||
if (len < Math.EPSILON) { // start equals end; check as circle
|
if (len < MathUtil.EPSILON) { // start equals end; check as circle
|
||||||
return getIntersection(start, radius, result);
|
return getIntersection(start, radius, result);
|
||||||
}
|
}
|
||||||
double rlen = 1f / len;
|
double rlen = 1f / len;
|
||||||
@@ -149,7 +149,7 @@ public class Ray2 implements IRay2
|
|||||||
double x, y;
|
double x, y;
|
||||||
if (above || below) { // check the intersection with the top/bottom boundary
|
if (above || below) { // check the intersection with the top/bottom boundary
|
||||||
double divisor = a*direction.x + b*direction.y;
|
double divisor = a*direction.x + b*direction.y;
|
||||||
if (Math.abs(divisor) < Math.EPSILON) { // lines are parallel
|
if (Math.abs(divisor) < MathUtil.EPSILON) { // lines are parallel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
c += (above ? -radius : +radius);
|
c += (above ? -radius : +radius);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class Ray2 implements IRay2
|
|||||||
float dx = end.x() - start.x(), dy = end.y() - start.y();
|
float dx = end.x() - start.x(), dy = end.y() - start.y();
|
||||||
|
|
||||||
float divisor = bx*dy - by*dx;
|
float divisor = bx*dy - by*dx;
|
||||||
if (Math.abs(divisor) < FloatMath.EPSILON) {
|
if (Math.abs(divisor) < MathUtil.EPSILON) {
|
||||||
// the lines are parallel (or the segment is zero-length)
|
// the lines are parallel (or the segment is zero-length)
|
||||||
float t = Math.min(getIntersection(start), getIntersection(end));
|
float t = Math.min(getIntersection(start), getIntersection(end));
|
||||||
boolean isect = (t != Float.MAX_VALUE);
|
boolean isect = (t != Float.MAX_VALUE);
|
||||||
@@ -135,7 +135,7 @@ public class Ray2 implements IRay2
|
|||||||
// compute the segment's line parameters
|
// compute the segment's line parameters
|
||||||
float a = starty - end.y(), b = end.x() - startx;
|
float a = starty - end.y(), b = end.x() - startx;
|
||||||
float len = FloatMath.hypot(a, b);
|
float len = FloatMath.hypot(a, b);
|
||||||
if (len < FloatMath.EPSILON) { // start equals end; check as circle
|
if (len < MathUtil.EPSILON) { // start equals end; check as circle
|
||||||
return getIntersection(start, radius, result);
|
return getIntersection(start, radius, result);
|
||||||
}
|
}
|
||||||
float rlen = 1f / len;
|
float rlen = 1f / len;
|
||||||
@@ -149,7 +149,7 @@ public class Ray2 implements IRay2
|
|||||||
float x, y;
|
float x, y;
|
||||||
if (above || below) { // check the intersection with the top/bottom boundary
|
if (above || below) { // check the intersection with the top/bottom boundary
|
||||||
float divisor = a*direction.x + b*direction.y;
|
float divisor = a*direction.x + b*direction.y;
|
||||||
if (Math.abs(divisor) < FloatMath.EPSILON) { // lines are parallel
|
if (Math.abs(divisor) < MathUtil.EPSILON) { // lines are parallel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
c += (above ? -radius : +radius);
|
c += (above ? -radius : +radius);
|
||||||
|
|||||||
Reference in New Issue
Block a user