Package org.gephi.appearance.api
Class Interpolator
- java.lang.Object
-
- org.gephi.appearance.api.Interpolator
-
- Direct Known Subclasses:
Interpolator.BezierInterpolator
public abstract class Interpolator extends Object
Abstract class that defines the singleinterpolate(float)
method. This abstract class is implemented by built-in interpolators accessible as static classes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Interpolator.BezierInterpolator
Bezier curve interpolator.
-
Field Summary
Fields Modifier and Type Field Description static Interpolator
LINEAR
Linear interpolationx = interpolate(x)
static Interpolator
LOG2
Log2 interpolationMath.log(1 + x)/Math.log(2) = interpolate(x)
-
Constructor Summary
Constructors Constructor Description Interpolator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract float
interpolate(float x)
This function takes an input value between 0 and 1 and returns another value, also between 0 and 1.static Interpolator
newBezierInterpolator(float px1, float py1, float px2, float py2)
Builds a bezier interpolator with two control points (px1, py1) and (px2, py2).
-
-
-
Field Detail
-
LINEAR
public static final Interpolator LINEAR
Linear interpolationx = interpolate(x)
-
LOG2
public static final Interpolator LOG2
Log2 interpolationMath.log(1 + x)/Math.log(2) = interpolate(x)
-
-
Method Detail
-
newBezierInterpolator
public static Interpolator newBezierInterpolator(float px1, float py1, float px2, float py2)
Builds a bezier interpolator with two control points (px1, py1) and (px2, py2). The points should all be in range [0, 1].- Parameters:
px1
- the x-coordinate of first control point, between [0, 1]py1
- the y-coordinate of first control point, between [0, 1]px2
- the x-coordinate of second control point, between [0, 1]py2
- the y-coordinate of second control point, between [0, 1]- Returns:
- new bezier interpolator
-
interpolate
public abstract float interpolate(float x)
This function takes an input value between 0 and 1 and returns another value, also between 0 and 1.- Parameters:
x
- a value between 0 and 1- Returns:
- a value between 0 and 1. Values outside of this boundary may be clamped to the interval [0,1] and cause undefined results.
-
-