Class CurveExtremum

java.lang.Object
org.apache.sis.geometry.CurveExtremum

final class CurveExtremum extends Object
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² = 0
A 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

    Fields
    Modifier and Type
    Field
    Description
    (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
    Constructor
    Description
    Creates a new object for computing curve extremum.
  • Method Summary

    Modifier and Type
    Method
    Description
    (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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ex1

      double ex1
      Coordinate of the first extremum point (P1).
    • ey1

      double ey1
      Coordinate of the first extremum point (P1).
    • ex2

      double ex2
      Coordinate of the second extremum point (P2).
    • ey2

      double ey2
      Coordinate 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.