public abstract class SupportPointFunction extends java.lang.Object implements IFunction
Modifier and Type | Class and Description |
---|---|
static class |
SupportPointFunction.SupportPointComperator
Sorts SupportPoints by their x coordinate
|
Constructor and Description |
---|
SupportPointFunction(java.util.List<SupportPoint> points,
float stiffness)
Constructs a new SupportPointFunction with the given SupportPoints.
|
SupportPointFunction(SupportPointFunction source)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
int |
addSupportPoint(float x,
float y)
Add a new SupportPoint at the given position.
|
float |
getDefinitionRange()
The definition range (minX to maxX) of all SupportPoints
|
float |
getMaxX() |
float |
getMaxY() |
float |
getMinX() |
float |
getMinY() |
float |
getStiffness() |
SupportPoint |
getSupportPoint(int index)
Retrieve the SupportPoint at the given index
|
java.util.List<ISupportPoint> |
getSupportPointsInArea(float minX,
float maxX,
float minY,
float maxY)
Get the SupportPoints of this function in the given area.
|
int |
getSupportPointSize() |
boolean |
hasSupportPointInArea(double left,
double right)
Checks if the function has a support point in the specified area
|
boolean |
hasSupportPointsInArea(float minX,
float maxX,
float minY,
float maxY)
Check it this function has at least one SupportPoints in the given area.
|
int |
indexOf(ISupportPoint supportPoint)
Retrieve the index of the given SupportPoint.
|
void |
initialize()
Called after changes to support points.
|
void |
mirrorYFunction()
Mirror function so that all support points get negated y coordinates.
|
void |
moveFunction(float xShift,
float yShift)
Move function in space.
|
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveSupportPoint(int index,
float xMove,
float yMove) |
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveSupportPoint(ISupportPoint point,
float xMove,
float yMove) |
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveSupportPointTo(int index,
float x,
float y) |
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveSupportPointTo(ISupportPoint point,
float x,
float y) |
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveTangentPointAfterTo(int index,
float x,
float y) |
org.apache.commons.math3.geometry.euclidean.twod.Vector2D |
moveTangentPointBeforeTo(int index,
float x,
float y) |
SupportPoint |
removeSupportPoint(int index)
Remove the SupportPoint at the given index if possible.
|
void |
rescaleXRange(float start,
float end,
float newEnd)
Re-scale a given area of the function.
|
java.lang.String |
toCSVString()
Returns a String with comma separated values of this function to be used
e.g. for file writing
|
public SupportPointFunction(java.util.List<SupportPoint> points, float stiffness)
points
- - an ArrayList containing the initial support pointspublic SupportPointFunction(SupportPointFunction source)
source
- the source to copypublic java.lang.String toCSVString()
IFunction
toCSVString
in interface IFunction
public float getMinX()
public float getMaxX()
public float getMinY()
public float getMaxY()
public float getDefinitionRange()
IFunction
getDefinitionRange
in interface IFunction
public boolean hasSupportPointsInArea(float minX, float maxX, float minY, float maxY)
IFunction
hasSupportPointsInArea
in interface IFunction
minX
- - the lower x boundmaxX
- - the upper x boundminY
- - the lower y boundmaxY
- - the upper y boundpublic boolean hasSupportPointInArea(double left, double right)
right
- border (including) (joint coordinates)left
- border (including) (joint coordinates)public java.util.List<ISupportPoint> getSupportPointsInArea(float minX, float maxX, float minY, float maxY)
IFunction
getSupportPointsInArea
in interface IFunction
minX
- - the lower x boundmaxX
- - the upper x boundminY
- - the lower y boundmaxY
- - the upper y boundpublic int getSupportPointSize()
getSupportPointSize
in interface IFunction
public SupportPoint getSupportPoint(int index)
IFunction
getSupportPoint
in interface IFunction
index
- - the index of the SupportPointpublic int indexOf(ISupportPoint supportPoint)
IFunction
public float getStiffness()
getStiffness
in interface IFunction
public void moveFunction(float xShift, float yShift)
IFunction
moveFunction
in interface IFunction
xShift
- - the shift in x directionyShift
- - the shift in y directionpublic void mirrorYFunction()
IFunction
mirrorYFunction
in interface IFunction
public void rescaleXRange(float start, float end, float newEnd)
IFunction
rescaleXRange
in interface IFunction
start
- - the start of the rangeend
- - the end of the rangenewEnd
- - the new end of the rangepublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveSupportPoint(int index, float xMove, float yMove)
moveSupportPoint
in interface IFunction
index
- - the index of the SupportPoint to movepublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveSupportPoint(ISupportPoint point, float xMove, float yMove)
moveSupportPoint
in interface IFunction
point
- - the SupportPoint to movepublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveSupportPointTo(ISupportPoint point, float x, float y)
moveSupportPointTo
in interface IFunction
point
- - the SupportPoint to movex
- - the new x coordinate of the SupportPointy
- - the new y coordinate of the SupportPointpublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveSupportPointTo(int index, float x, float y)
moveSupportPointTo
in interface IFunction
index
- - the index of the SupportPoint to movex
- - the new x coordinate of the SupportPointy
- - the new y coordinate of the SupportPointpublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveTangentPointBeforeTo(int index, float x, float y)
moveTangentPointBeforeTo
in interface IFunction
index
- - the index of the SupportPoint which tangent point before
should be movedx
- - the new x coordinate of the SupportPoint tangent point beforey
- - the new y coordinate of the SupportPoint tangent point beforepublic org.apache.commons.math3.geometry.euclidean.twod.Vector2D moveTangentPointAfterTo(int index, float x, float y)
moveTangentPointAfterTo
in interface IFunction
index
- - the index of the SupportPoint which tangent point after
should be movedx
- - the new x coordinate of the SupportPoint tangent point aftery
- - the new y coordinate of the SupportPoint tangent point afterpublic int addSupportPoint(float x, float y)
IFunction
addSupportPoint
in interface IFunction
x
- - the x coordinate of the new SupportPointy
- - the y coordinate of the new SupportPointpublic SupportPoint removeSupportPoint(int index)
IFunction
removeSupportPoint
in interface IFunction
index
- - the index of the SupportPoint to removepublic void initialize()