Package org.faceless.graph.math
Class Curve
- java.lang.Object
-
- org.faceless.graph.math.Curve
-
- Direct Known Subclasses:
DataCurve
,FunctionCurve
public abstract class Curve extends java.lang.Object
The abstract superclass for all curves. A curve is what's plotted on a
AbstractLineGraph
, and has the property of always having a valid value between it's two end ranges - ie f(x) is valid for every min<=x<=max.All curves fall into one of two broad subclasses - a
DataCurve
, where the values of the curve reflect various data points, and aFunctionCurve
, where the values of the curve reflect a mathematical function.- See Also:
DataCurve
,FunctionCurve
,Spline
,Polynomial
-
-
Constructor Summary
Constructors Constructor Description Curve()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract double
get(double x)
Return the value of this curve at the specified X position.abstract double
getMax()
Return the maximum value that is defined for this curve.abstract double
getMin()
Return the minimum value that is defined for this curve.abstract boolean
point(double x)
If a marker is to be placed at this point on the curve then return true, otherwise return false.abstract double[]
steps()
Return the points on the curve that it should be sampled at to get an accurate picture of it.
-
-
-
Method Detail
-
get
public abstract double get(double x)
Return the value of this curve at the specified X position. If the curve has no value at this point (i.e. x<curve min or x>curve max) returnDouble.NaN
-
steps
public abstract double[] steps()
Return the points on the curve that it should be sampled at to get an accurate picture of it. Subclasses ofFunctionCurve
may return an empty list if they wish, or if there are certain points that the curve must be sampled at, it can return them here.
-
point
public abstract boolean point(double x)
If a marker is to be placed at this point on the curve then return true, otherwise return false. MostFunctionCurve
will return false, but curves that have been fitted to aDataCurve
may return any points from thatDataCurve
that are matched exactly by the fitted curve.
-
getMin
public abstract double getMin()
Return the minimum value that is defined for this curve. For curves with no minimum (like most mathematical functions), this should returnDouble.POSITIVE_INFINITY
(yes, positive)
-
getMax
public abstract double getMax()
Return the maximum value that is defined for this curve. For curves with no maximum (like most mathematical functions), this should returnDouble.NEGATIVE_INFINITY
(yes, negative)
-
-