org.faceless.graph.math

## Class 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 and Description
DataCurve()
• ### Method Summary

All Methods
Modifier and Type Method and 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 value
double[] steps()
Return the points on the curve that it should be sampled at to get an accurate picture of it.
java.lang.String toString()
• ### Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### DataCurve

public DataCurve()
• ### 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 return Double.POSITIVE_INFINITY (yes, positive)
Specified by:
getMin in class Curve
• #### 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 return Double.NEGATIVE_INFINITY (yes, negative)
Specified by:
getMax in class Curve
• #### 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. Most FunctionCurve will return false, but curves that have been fitted to a DataCurve may return any points from that DataCurve that are matched exactly by the fitted curve.
Specified by:
point in class 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 curve
y - 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) return Double.NaN
Specified by:
get in class Curve
• #### 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 of FunctionCurve 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.
Specified by:
steps in class Curve
• #### toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object