Package org.apache.sis.geometry
Class CurveExtremum
java.lang.Object
org.apache.sis.geometry.CurveExtremum
Finds the extremum of the unique cubic curve which fit the two given points and derivatives.
First, this method finds the A, B, C and D coefficients for the following equation:
y = A + Bx + Cx² + Dx³Next, this method finds the extremum by finding the (x,y) values that satisfy the following equation (which is the derivative of the above equation):
B + 2Cx + 3Dx² = 0A cubic curve can have two extremum, which are stored in this object in no particular order. The distance separating the two extremum is sometimes a useful information for determining if a quadratic equation would be a sufficient approximation.
The points stored in this object may contains NaN values if the
given geometry is actually a line segment (dy1
= dy2
= slope from P1 to P2).
- Since:
- 0.5
- Version:
- 0.5
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) double
Coordinate of the first extremum point (P1).(package private) double
Coordinate of the second extremum point (P2).(package private) double
Coordinate of the first extremum point (P1).(package private) double
Coordinate of the second extremum point (P2). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
resolve
(double x1, double y1, double dy1, double x2, double y2, double dy2) Finds the extremum of the unique cubic curve which fit the two given points and derivatives.
-
Field Details
-
ex1
double ex1Coordinate of the first extremum point (P1). -
ey1
double ey1Coordinate of the first extremum point (P1). -
ex2
double ex2Coordinate of the second extremum point (P2). -
ey2
double ey2Coordinate of the second extremum point (P2).
-
-
Constructor Details
-
CurveExtremum
CurveExtremum()Creates a new object for computing curve extremum.
-
-
Method Details
-
resolve
void resolve(double x1, double y1, double dy1, double x2, double y2, double dy2) Finds the extremum of the unique cubic curve which fit the two given points and derivatives. See class javadoc for more information.- Parameters:
x1
- the x coordinate of the first point.y1
- the y coordinate of the first point.dy1
- the ∂x/∂y value at the first point.x2
- the x coordinate of the second point.y2
- the y coordinate of the second point.dy2
- the ∂x/∂y value at the second point.
-