59 |
public abstract class QuadCurve2D implements Shape, Cloneable |
public abstract class QuadCurve2D implements Shape, Cloneable |
60 |
{ |
{ |
61 |
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0; |
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0; |
62 |
|
private static final double EPSILON = 1E-10; |
63 |
|
|
64 |
/** |
/** |
65 |
* Constructs a new QuadCurve2D. Typical users will want to |
* Constructs a new QuadCurve2D. Typical users will want to |
963 |
If this is not done,bad behaviour may result for points on that axis. */ |
If this is not done,bad behaviour may result for points on that axis. */ |
964 |
if (a0 == 0.0 || a2 == 0.0) |
if (a0 == 0.0 || a2 == 0.0) |
965 |
{ |
{ |
966 |
double small = getFlatness() * (1E-10); |
double small = getFlatness() * EPSILON; |
967 |
if (a0 == 0.0) |
if (a0 == 0.0) |
968 |
a0 += small; |
a0 -= small; |
969 |
|
|
970 |
if (a2 == 0.0) |
if (a2 == 0.0) |
971 |
a2 += small; |
a2 -= small; |
972 |
} |
} |
973 |
|
|
974 |
r[0] = a0; |
r[0] = a0; |
991 |
|
|
992 |
if (useYaxis) |
if (useYaxis) |
993 |
{ |
{ |
994 |
if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0)) |
if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0)) |
995 |
nCrossings++; |
nCrossings++; |
996 |
} |
} |
997 |
else |
else |
998 |
{ |
{ |
999 |
if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance)) |
if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance)) |
1000 |
nCrossings++; |
nCrossings++; |
1001 |
} |
} |
1002 |
|
|