Package WildMagic.LibFoundation.Curves
Class Curve3f
- java.lang.Object
-
- WildMagic.LibFoundation.Curves.Curve3f
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
MultipleCurve3
,SingleCurve3f
public abstract class Curve3f extends java.lang.Object implements java.io.Serializable
This is an abstract interface for a curve in 3D. The curve is defined as a function of time over an interval. The position, 1st derivative, and 2nd derivative is computed for any point along the curve as selected by an input value in the time domain. The tangent at any point is computed as direction of the 1st derivative vector and the speed is computed as the length of the 1st derivative vector. The arc length of any subinterval of the curve can be computed. The curve can be re-parameterized as function of arc length where the length at the minimum interval time is zero and the length at the maximum interval time is the total length of the curve. This means that given an arc length, the corresponding input time within the curve's time interval is determined. Extensions of this class provide the implementation based on the particular type of curve.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Curve3f.PointList
Utility class used in SubdivideByVariation()
-
Field Summary
Fields Modifier and Type Field Description protected float
m_fTMax
curve parameter is t where tmin <= t <= tmaxprotected float
m_fTMin
curve parameter is t where tmin <= t <= tmaxprivate static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description Curve3f(float fTMin, float fTMax)
Create a generalized curve over the specified time interval.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Vector3f
GetBinormal(float fTime)
Binormal at a point on the curve.float
GetCurvature(float fTime)
Curvature at a point on the curve.abstract Vector3f
GetFirstDerivative(float fTime)
Get the 3D coordinates of the 1st derivative vector at the point along the curve evaluated for the input time value.void
GetFrame(float fTime, Vector3f rkPosition, Vector3f rkTangent, Vector3f rkNormal, Vector3f rkBinormal)
Several quantities at once at a point on the curve.abstract float
GetLength(float fT0, float fT1)
Get the length of the curve for the specified time subinterval.float
GetMaxTime()
Get the maximum time value for which this curve is defined.float
GetMinTime()
Get the minimum time value for which this curve is defined.Vector3f
GetNormal(float fTime)
Normal at a point on the curve.abstract Vector3f
GetPosition(float fTime)
Get the 3D coordinates of the position along the curve evaluated for the input time value.abstract Vector3f
GetSecondDerivative(float fTime)
Get the 3D coordinates of the 2nd derivative vector at the point along the curve evaluated for the input time value.float
GetSpeed(float fTime)
Get the speed at the point along the curve evaluated for the input time value.Vector3f
GetTangent(float fTime)
Get the 3D coordinates of the tangent vector at the point along the curve evaluated for the input time value.abstract Vector3f
GetThirdDerivative(float fTime)
float
GetTime(float fLength)
Locate the time value associated with this arc length along the curve.abstract float
GetTime(float fLength, int iIterations, float fTolerance)
Re-parameterize the curve where the time value is defined as a function of arc length.float
GetTorsion(float fTime)
Torsion at a point on the curve.float
GetTotalLength()
Get the length total length of the curve from start to end.abstract float
GetVariation(float fT0, float fT1, Vector3f pkP0, Vector3f pkP1)
Subdivision by variation.void
SetTimeInterval(float fTMin, float fTMax)
If you are interested in only a subinterval of the actual domain of the curve, you may set that subinterval with SetTimeInterval.void
SubdivideByLength(int iNumPoints, Vector3f[] rakPoint)
Perform subdivisionvoid
SubdivideByTime(int iNumPoints, Vector3f[] rakPoint)
Perform subdivisionvoid
SubdivideByVariation(float fMinVariation, int iMaxLevel, int riNumPoints, Vector3f[] rakPoint)
protected void
SubdivideByVariation(float fT0, Vector3f rkP0, float fT1, Vector3f rkP1, float fMinVariation, int iLevel, int riNumPoints, Curve3f.PointList rpkList)
Subdivision by variation.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_fTMin
protected float m_fTMin
curve parameter is t where tmin <= t <= tmax
-
m_fTMax
protected float m_fTMax
curve parameter is t where tmin <= t <= tmax
-
-
Method Detail
-
GetBinormal
public Vector3f GetBinormal(float fTime)
Binormal at a point on the curve. @see GetTangent
-
GetCurvature
public float GetCurvature(float fTime)
Curvature at a point on the curve. @see GetTangent
-
GetFirstDerivative
public abstract Vector3f GetFirstDerivative(float fTime)
Get the 3D coordinates of the 1st derivative vector at the point along the curve evaluated for the input time value.- Parameters:
fTime
- Input time value which must be within the range for which this curve is defined.- Returns:
- New instance created to contain the 3D coordinates of the computed 1st derivative vector. If the time value is less than getMinTime() then the 1st derivative vector at the start of the curve is returned. If the time value is greater than getMaxTime() then the 1st derivative vector at the end of the curve is returned.
-
GetFrame
public void GetFrame(float fTime, Vector3f rkPosition, Vector3f rkTangent, Vector3f rkNormal, Vector3f rkBinormal)
Several quantities at once at a point on the curve. @see GetTangent
-
GetLength
public abstract float GetLength(float fT0, float fT1)
Get the length of the curve for the specified time subinterval.- Parameters:
fT0
- Minimum time of the subinterval. Clipped to getMinTime() if less than it.fT1
- Minimum time of the subinterval. Clipped to getMaxTime() if greater than it.- Returns:
- Computed length curve for the specified time subinterval.
-
GetMaxTime
public float GetMaxTime()
Get the maximum time value for which this curve is defined.- Returns:
- Maximum time value for curve.
-
GetMinTime
public float GetMinTime()
Get the minimum time value for which this curve is defined.- Returns:
- Minimum time value for curve.
-
GetNormal
public Vector3f GetNormal(float fTime)
Normal at a point on the curve. @see GetTangent
-
GetPosition
public abstract Vector3f GetPosition(float fTime)
Get the 3D coordinates of the position along the curve evaluated for the input time value.- Parameters:
fTime
- Input time value which must be within the range for which this curve is defined.- Returns:
- New instance created to contain the 3D coordinates of the computed position. If the time value is less than getMinTime() then the coordinates of the point at the start of the curve is returned. If the time value is greater than getMaxTime() then the coordinates of the point at the end of the curve is returned.
-
GetSecondDerivative
public abstract Vector3f GetSecondDerivative(float fTime)
Get the 3D coordinates of the 2nd derivative vector at the point along the curve evaluated for the input time value.- Parameters:
fTime
- Input time value which must be within the range for which this curve is defined.- Returns:
- New instance created to contain the 3D coordinates of the computed 1st derivative vector. If the time value is less than getMinTime() then the 2nd derivative vector at the start of the curve is returned. If the time value is greater than getMaxTime() then the 2nd derivative vector at the end of the curve is returned.
-
GetSpeed
public float GetSpeed(float fTime)
Get the speed at the point along the curve evaluated for the input time value. The speed is the length of the 1st derivative vector.- Parameters:
fTime
- Input time value which must be within the range for which this curve is defined.- Returns:
- The computed speed. If the time value is less than getMinTime() then the speed at the start of the curve is returned. If the time value is greater than getMaxTime() then the speed at the end of the curve is returned.
-
GetTangent
public Vector3f GetTangent(float fTime)
Get the 3D coordinates of the tangent vector at the point along the curve evaluated for the input time value. The tangent vector is the normalized direction of the 1st derivative vector.- Parameters:
fTime
- float Input time value which must be within the range for which this curve is defined.- Returns:
- Vector3f New instance created to contain the 3D coordinates of the computed tangent vector. If the time value is less than getMinTime() then the tangent vector at the start of the curve is returned. If the time value is greater than getMaxTime() then the tangent vector at the end of the curve is returned.
-
GetThirdDerivative
public abstract Vector3f GetThirdDerivative(float fTime)
-
GetTime
public float GetTime(float fLength)
Locate the time value associated with this arc length along the curve. Use 32 iterations and tolerance of 1e-06- Parameters:
fLength
- Input arc length- Returns:
- Time value
- See Also:
GetTime(float, int, float)
-
GetTime
public abstract float GetTime(float fLength, int iIterations, float fTolerance)
Re-parameterize the curve where the time value is defined as a function of arc length. Location the time value associated with this arc length along the curve.- Parameters:
fLength
- Input arc length for which the associated time is to be determined. This length is measured from the starting point of the curve which is at the getMinTime().iIterations
- iterations to run Newton's methodfTolerance
- tolerance for early termination- Returns:
- Time value associated with this arc length along the curve. The returned value is always within the range of getMinTime() and getMaxTime().
-
GetTorsion
public float GetTorsion(float fTime)
Torsion at a point on the curve. @see GetTangent
-
GetTotalLength
public float GetTotalLength()
Get the length total length of the curve from start to end.- Returns:
- Length of the entire curve.
-
GetVariation
public abstract float GetVariation(float fT0, float fT1, Vector3f pkP0, Vector3f pkP1)
Subdivision by variation. The pointers pkP0 and pkP1 correspond to the curve points at fT0 and fT1. If the pointer values are not null, the assumption is that the caller has passed in the curve points. Otherwise, the function computes the curve points.- Parameters:
fT0
- point 0pkP0
- curvature at point 0, may be nullfT1
- point 1pkP1
- curvature at point 1, may be null- See Also:
SubdivideByVariation(float, int, int, Vector3f[])
-
SetTimeInterval
public void SetTimeInterval(float fTMin, float fTMax)
If you are interested in only a subinterval of the actual domain of the curve, you may set that subinterval with SetTimeInterval. This function requires that fTMin < fTMax.- Parameters:
fTMin
- min timefTMax
- max time
-
SubdivideByLength
public void SubdivideByLength(int iNumPoints, Vector3f[] rakPoint)
Perform subdivision
-
SubdivideByTime
public void SubdivideByTime(int iNumPoints, Vector3f[] rakPoint)
Perform subdivision
-
SubdivideByVariation
public void SubdivideByVariation(float fMinVariation, int iMaxLevel, int riNumPoints, Vector3f[] rakPoint)
-
SubdivideByVariation
protected void SubdivideByVariation(float fT0, Vector3f rkP0, float fT1, Vector3f rkP1, float fMinVariation, int iLevel, int riNumPoints, Curve3f.PointList rpkList)
Subdivision by variation. The pointers pkP0 and pkP1 correspond to the curve points at fT0 and fT1. If the pointer values are not null, the assumption is that the caller has passed in the curve points. Otherwise, the function computes the curve points.- Parameters:
fT0
- point 0rkP0
- curvature at point 0fT1
- point 1rkP1
- curvature at point 1fMinVariation
-iLevel
-riNumPoints
- number of points in listrpkList
- may be null
-
-