public class EllipseUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Vector2f |
getPointOnEllipse(@Nullable Vector2f ellipseCenter,
float ellipseWidth,
float ellipseHeight,
float ellipseAngleOffset,
float angle)
Returns a point along the circumference of an ellipse at the given angle
and facing.
|
static Vector2f |
getRandomPointInEllipse(@Nullable Vector2f ellipseCenter,
float ellipseWidth,
float ellipseHeight,
float ellipseAngleOffset)
Returns a random point inside of an ellipse with uniform distribution.
|
static Vector2f |
getRandomPointOnEllipse(@Nullable Vector2f ellipseCenter,
float ellipseWidth,
float ellipseHeight,
float ellipseAngleOffset)
Returns a random point along the circumference of an ellipse.
|
static boolean |
isPointWithinEllipse(Vector2f point,
@Nullable Vector2f ellipseCenter,
float ellipseWidth,
float ellipseHeight,
float ellipseAngleOffset)
Checks whether a point is on or within the bounds of an ellipse.
|
public static Vector2f getPointOnEllipse(@Nullable @Nullable Vector2f ellipseCenter, float ellipseWidth, float ellipseHeight, float ellipseAngleOffset, float angle)
ellipseCenter
- The center point of the ellipse (can be null
for a 0, 0 origin).ellipseWidth
- The width (size on unrotated x-axis) of the
ellipse.ellipseHeight
- The height (size on unrotated y-axis) of the
ellipse.ellipseAngleOffset
- How much to rotate the ellipse from its
original axis, in degrees.angle
- The angle, in degrees, to get the point at.Vector2f
at [@code angle} degrees along the
circumference of the given ellipse.public static Vector2f getRandomPointOnEllipse(@Nullable @Nullable Vector2f ellipseCenter, float ellipseWidth, float ellipseHeight, float ellipseAngleOffset)
ellipseCenter
- The center point of the ellipse (can be null
for a 0, 0 origin).ellipseWidth
- The width (size on unrotated x-axis) of the
ellipse.ellipseHeight
- The height (size on unrotated y-axis) of the
ellipse.ellipseAngleOffset
- How much to rotate the ellipse from its
original axis, in degrees.getPointOnEllipse(Vector2f, float, float, float, float)
public static Vector2f getRandomPointInEllipse(@Nullable @Nullable Vector2f ellipseCenter, float ellipseWidth, float ellipseHeight, float ellipseAngleOffset)
ellipseCenter
- The center point of the ellipse (can be null
for a 0, 0 origin).ellipseWidth
- The width (size on unrotated x-axis) of the
ellipse.ellipseHeight
- The height (size on unrotated y-axis) of the
ellipse.ellipseAngleOffset
- How much to rotate the ellipse from its
original axis, in degrees.public static boolean isPointWithinEllipse(Vector2f point, @Nullable @Nullable Vector2f ellipseCenter, float ellipseWidth, float ellipseHeight, float ellipseAngleOffset)
point
- The Vector2f
to check.ellipseCenter
- The center point of the ellipse (can be null
for a 0, 0 origin).ellipseWidth
- The width (size on unrotated x-axis) of the
ellipse.ellipseHeight
- The height (size on unrotated y-axis) of the
ellipse.ellipseAngleOffset
- How much to rotate the ellipse from its
original axis, in degrees.true
if point
is on or within the ellipse,
false
otherwise.