Class QuadraticInterpolation

java.lang.Object
org.shredzone.commons.suncalc.util.QuadraticInterpolation

public class QuadraticInterpolation extends Object
Calculates the roots and extremum of a quadratic equation.
  • Constructor Details

    • QuadraticInterpolation

      public QuadraticInterpolation(double yMinus, double y0, double yPlus)
      Creates a new quadratic equation.
      Parameters:
      yMinus - y at x == -1
      y0 - y at x == 0
      yPlus - y at x == 1
  • Method Details

    • getXe

      public double getXe()
      Returns X of extremum. Can be outside [-1 .. 1].
      Returns:
      X
    • getYe

      public double getYe()
      Returns the Y value at the extremum.
      Returns:
      Y
    • getRoot1

      public double getRoot1()
      Returns the first root that was found.
      Returns:
      X of first root
    • getRoot2

      public double getRoot2()
      Returns the second root that was found.
      Returns:
      X of second root
    • getNumberOfRoots

      public int getNumberOfRoots()
      Returns the number of roots found in [-1 .. 1].
      Returns:
      Number of roots
    • isMaximum

      public boolean isMaximum()
      Returns whether the extremum is a minimum or a maximum.
      Returns:
      true: Extremum at xe is a maximum. false: Extremum at xe is a minimum.