Package georegression.geometry
Class UtilEllipse_F32
java.lang.Object
georegression.geometry.UtilEllipse_F32
Functions for extracting information from ellipses and converting between different ellipse formats.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
computeAngle
(Point2D_F32 p, EllipseRotated_F32 ellipse) Computes the value of 't' used to specify a point's locationstatic Point2D_F32
computePoint
(float t, EllipseRotated_F32 ellipse, @Nullable Point2D_F32 output) Computes the point on the ellipse at location 't', where t is an angle in radiansstatic Vector2D_F32
computeTangent
(float t, EllipseRotated_F32 ellipse, @Nullable Vector2D_F32 output) Computes the tangent to the ellipse at the specified locationstatic EllipseRotated_F32
convert
(EllipseQuadratic_F32 input, @Nullable EllipseRotated_F32 output) Convert from quadratic to rotated formats.static EllipseQuadratic_F32
convert
(EllipseRotated_F32 input, @Nullable EllipseQuadratic_F32 output) Convert from rotated to quadratic.static float
evaluate
(float x, float y, EllipseQuadratic_F32 ellipse) Computes the value of the quadratic ellipse function at point (x,y).static float
evaluate
(float x, float y, EllipseRotated_F32 ellipse) Computes the value of the quadratic ellipse function at point (x,y).static boolean
tangentLines
(EllipseRotated_F32 ellipseA, EllipseRotated_F32 ellipseB, Point2D_F32 tangentA0, Point2D_F32 tangentA1, Point2D_F32 tangentA2, Point2D_F32 tangentA3, Point2D_F32 tangentB0, Point2D_F32 tangentB1, Point2D_F32 tangentB2, Point2D_F32 tangentB3) Finds four lines which are tangent to both ellipses.static boolean
tangentLines
(Point2D_F32 pt, EllipseRotated_F32 ellipse, Point2D_F32 tangentA, Point2D_F32 tangentB) Finds two points on the ellipse that in combination with point 'pt' each define a line that is tangent to the ellipse.
-
Constructor Details
-
UtilEllipse_F32
public UtilEllipse_F32()
-
-
Method Details
-
convert
public static EllipseRotated_F32 convert(EllipseQuadratic_F32 input, @Nullable @Nullable EllipseRotated_F32 output) Convert from quadratic to rotated formats. Equations taken from [1].
[1] David Eberly "Information About Ellipses", Geometric Tools, LLC 2011
- Parameters:
input
- Input in quadratic format.output
- (Optional) Storage for converted format. Can be null.- Returns:
- Ellipse in rotated format.
-
convert
public static EllipseQuadratic_F32 convert(EllipseRotated_F32 input, @Nullable @Nullable EllipseQuadratic_F32 output) Convert from rotated to quadratic.- Parameters:
input
- Input rotated format.output
- (Optional) Storage for quadratic format. Can be null.- Returns:
- Ellipse in quadratic format.
-
evaluate
Computes the value of the quadratic ellipse function at point (x,y). Should equal 0 if the point is along the ellipse.- Parameters:
x
- x-coordinatey
- y-coordinateellipse
- Ellipse equation being evaluated.- Returns:
- value of ellipse equation at point (x,y)
-
evaluate
Computes the value of the quadratic ellipse function at point (x,y). Should equal 1 if the point is on the ellipse.- Parameters:
x
- x-coordinatey
- y-coordinateellipse
- Ellipse equation being evaluated.- Returns:
- value of ellipse equation at point (x,y)
-
computePoint
public static Point2D_F32 computePoint(float t, EllipseRotated_F32 ellipse, @Nullable @Nullable Point2D_F32 output) Computes the point on the ellipse at location 't', where t is an angle in radians- Parameters:
t
- An angle in radians from 0 to 2*PIellipse
- Ellipseoutput
- (Optional) point on the ellipse . Can be null.- Returns:
- Point on the ellipse
-
computeAngle
Computes the value of 't' used to specify a point's location- Parameters:
p
- Point on the ellipseellipse
- Ellipse- Returns:
- Angle from -pi to pi
-
computeTangent
public static Vector2D_F32 computeTangent(float t, EllipseRotated_F32 ellipse, @Nullable @Nullable Vector2D_F32 output) Computes the tangent to the ellipse at the specified location- Parameters:
t
- Location on the ellipse. Radiansellipse
- Ellipse equationoutput
- Optional storage for tangent- Returns:
- The tangent
-
tangentLines
public static boolean tangentLines(Point2D_F32 pt, EllipseRotated_F32 ellipse, Point2D_F32 tangentA, Point2D_F32 tangentB) Finds two points on the ellipse that in combination with point 'pt' each define a line that is tangent to the ellipse.
Notes:
Point 'pt' is assumed to be outside of the ellipse.- Parameters:
pt
- Point which the lines will pass thoughellipse
- The ellipse which the lines will be tangent totangentA
- (output) Point on the ellipse where tangent line A hits ittangentB
- (output) Point on the ellipse where tangent line B hits it
-
tangentLines
public static boolean tangentLines(EllipseRotated_F32 ellipseA, EllipseRotated_F32 ellipseB, Point2D_F32 tangentA0, Point2D_F32 tangentA1, Point2D_F32 tangentA2, Point2D_F32 tangentA3, Point2D_F32 tangentB0, Point2D_F32 tangentB1, Point2D_F32 tangentB2, Point2D_F32 tangentB3) Finds four lines which are tangent to both ellipses. Both ellipses must not intersect. Line 0 and line 3 will not intersect the line joining the center of the two ellipses while line 1 and 2 will.
- Parameters:
ellipseA
- (Input) First ellipseellipseB
- (Input) Second ellipsetangentA0
- (Output) Point on ellipseA in which tangent line0 passes throughtangentA1
- (Output) Point on ellipseA in which tangent line1 passes throughtangentA2
- (Output) Point on ellipseA in which tangent line2 passes throughtangentA3
- (Output) Point on ellipseA in which tangent line3 passes throughtangentB0
- (Output) Point on ellipseB in which tangent line0 passes throughtangentB1
- (Output) Point on ellipseB in which tangent line1 passes throughtangentB2
- (Output) Point on ellipseB in which tangent line2 passes throughtangentB3
- (Output) Point on ellipseB in which tangent line3 passes through- Returns:
- true if a solution was found or false if it failed
- See Also:
-