public final class GeomUtilities extends Object
Also it serves as a factory for various implementations of geometric primitives.
Modifier and Type | Method and Description |
---|---|
static boolean |
ellipseContains(RectD bounds,
PointD point,
double eps)
Checks whether an ellipse contains the given point.
|
static PointD |
findEllipseLineIntersection(RectD bounds,
PointD inner,
PointD outer)
Returns the ellipse/line intersection point for the given point pair.
|
static double |
findRayIntersection(PointD start,
PointD end,
PointD anchor,
PointD rayDirection)
Finds the intersection between a line segment and an infinite ray.
|
public static final boolean ellipseContains(RectD bounds, PointD point, double eps)
bounds
- The coordinates of the bounds of the ellipse's enclosing rectangle.point
- The coordinates of the point to test.eps
- A positive value allows for fuzzy hit testing. If the point lies outside the given object but it's distance is less than
or equal to that value, it will be considered a hit.public static final PointD findEllipseLineIntersection(RectD bounds, PointD inner, PointD outer)
This will always return the intersection point that lies in the direction from inner to outer.
bounds
- The coordinates of the bounds of the ellipse's enclosing rectangle.inner
- The coordinates of a point lying inside the ellipse.outer
- The coordinates of a point lying outside the ellipse.null
.public static final double findRayIntersection(PointD start, PointD end, PointD anchor, PointD rayDirection)
The ray is described using an anchor point and a ray direction. The direction vector does not need to be normalized. In order to obtain the intersection point do the following:
start
- The coordinates of the first end point of the line segment.end
- The coordinates of the second end point of the line segment.anchor
- The coordinates of the starting point of the ray.rayDirection
- The direction vector of the ray.Double.POSITIVE_INFINITY
if the ray does not intersect the line.