Package org.faceless.graph.math
Class DataCurve
- java.lang.Object
-
- org.faceless.graph.math.Curve
-
- org.faceless.graph.math.DataCurve
-
public class DataCurve extends Curve
A type of curve that represents data samples. If you're plotting data on a LineGraph then this the Curve you need to use.
-
-
Constructor Summary
Constructors Constructor Description DataCurve()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
get(double x)
Return the value of this curve at the specified X position.double[][]
getForFit()
Return the data in the curve in a form that can be used by another curve - usually to fit a smoother curve to the samples.double
getMax()
Return the maximum value that is defined for this curve.double
getMin()
Return the minimum value that is defined for this curve.boolean
point(double x)
If a marker is to be placed at this point on the curve then return true, otherwise return false.void
set(double x, double y)
Set the value of the curve at a specific valuedouble[]
steps()
Return the points on the curve that it should be sampled at to get an accurate picture of it.java.lang.String
toString()
-
-
-
Method Detail
-
getMin
public double getMin()
Description copied from class:Curve
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 double getMax()
Description copied from class:Curve
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)
-
point
public boolean point(double x)
Description copied from class:Curve
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.
-
set
public void set(double x, double y)
Set the value of the curve at a specific value- Parameters:
x
- The X position on the curvey
- The value of the curve at this position
-
getForFit
public double[][] getForFit()
Return the data in the curve in a form that can be used by another curve - usually to fit a smoother curve to the samples.
Returns an array of doubles that's 2xN, where N is the number of data samples. The first column is the X values, the second column the Y values.
-
get
public double get(double x)
Description copied from class:Curve
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 double[] steps()
Description copied from class:Curve
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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-