org.faceless.graph.math
Class SimpleCurve
java.lang.Object
org.faceless.graph.math.Curve
org.faceless.graph.math.FunctionCurve
org.faceless.graph.math.SimpleCurve
public final class SimpleCurve
- extends FunctionCurve
A SimpleCurve is a curve that's just a wrapper
around java functions like Math.sin
or
Math.tan
Constructor Summary |
SimpleCurve(String name)
The constructor takes the name of the java method
that represents the function. |
Method Summary |
double |
get(double x)
Return the value of the function at the specified X position. |
String |
toString()
|
SimpleCurve
public SimpleCurve(String name)
throws NoSuchMethodException
The constructor takes the name of the java method
that represents the function. An example would be
new SimpleCurve("java.lang.Math.sin")
The argument must be the name of a static method
that takes a single double parameter and returns a double.
If it doesn't meet this criteria an exception is thrown.
- Parameters:
name
- The fully qualified name of the function
- Throws:
NoSuchMethodException
- if the function doesn't
exist, isn't static, doesn't take a double or doesn't
return a double.
get
public double get(double x)
- Return the value of the function at the specified X position. The
function may return NaN or an infinite value, but be warned - if it
throws an exception, an
Error
is thrown by this method.
- Specified by:
get
in class Curve
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2001-2012 Big Faceless Organization