Package geomss.geom.cst
Class CSTShapeFunction
- java.lang.Object
-
- geomss.geom.cst.CSTShapeFunction
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,javolution.lang.Immutable
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
public final class CSTShapeFunction extends java.lang.Object implements java.lang.Cloneable, javolution.xml.XMLSerializable, javolution.lang.ValueType
A generic Class-Shape-Transform (CST) shape function implementation.Modified by: Joseph A. Huwaldt
- Version:
- January 8, 2016
- Author:
- Joseph A. Huwaldt Date: March 14, 2014
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CSTShapeFunction
copy()
Returns a copy of this CSTShapeFunction instanceallocated
by the calling thread (possibly on the stack).boolean
equals(java.lang.Object obj)
Compares this CSTShapeFunction against the specified object for strict equality (same values).Point
get2DPoint(double s)
Return a 2D point that represents the value of this shape function at the specified parametric position: (s,getValue(s)).BasicNurbsCurve
getBasisFunction()
Return the basis function for this shape function.double[]
getCoefficients()
Return the array of Bernstein Polynomial coefficients for this shape function.double[]
getDerivatives(double s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the shape function for the given parametric distance along the shape function,d^{grade}p(s)/d^{grade}s
.int
getOrder()
Return the order of this shape function.double
getValue(double s)
Return the value of this shape function at the specified parametric location.int
hashCode()
Returns the hash code for this object.boolean
isValid()
Returntrue
if this shape function contains valid and finite numerical components.static CSTShapeFunction
newInstance(int order, double... Acoefs)
Construct a new shape function of the specified order from the specified list of Bernstein Polynomial coefficients.static CSTShapeFunction
valueOf(NurbsCurve bfCrv)
Construct a new shape function from the specified 1D basis function Bezier curve.
-
-
-
Method Detail
-
newInstance
public static CSTShapeFunction newInstance(int order, double... Acoefs)
Construct a new shape function of the specified order from the specified list of Bernstein Polynomial coefficients.- Parameters:
order
- The order of the shape function to return.Acoefs
- The coefficients of the Bernstein Polynomial used to construct the shape function. If more than "order" coefficients are provided then the additional coefficients are ignored. May not be null.- Returns:
- A new shape function of the specified order from the specified list of Bernstein Polynomial coefficients.
-
valueOf
public static CSTShapeFunction valueOf(NurbsCurve bfCrv)
Construct a new shape function from the specified 1D basis function Bezier curve.- Parameters:
bfCrv
- The 1D basis function Bezier curve used to define this shape function. May not be null.- Returns:
- A new shape function based on the specified 1D basis function Bezier curve.
-
getOrder
public int getOrder()
Return the order of this shape function.- Returns:
- order of shape function (degree + 1)
- See Also:
getCoefficients()
-
getBasisFunction
public BasicNurbsCurve getBasisFunction()
Return the basis function for this shape function. The returned NURBS curve will always represent a 1D Bezier curve.- Returns:
- The basis function for this shape function.
- See Also:
getCoefficients()
-
getValue
public double getValue(double s)
Return the value of this shape function at the specified parametric location.- Parameters:
s
- The parametric distance along the curve to calculate the value of this shape function at.- Returns:
- The value of this shape function at the specified parametric location.
-
get2DPoint
public Point get2DPoint(double s)
Return a 2D point that represents the value of this shape function at the specified parametric position: (s,getValue(s)).- Parameters:
s
- The parametric distance along the curve to calculate the value of this shape function at.- Returns:
- A 2D point that represents the value of this shape function at the specified parametric position: P(s) = getValue(s).
-
getDerivatives
public double[] getDerivatives(double s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the shape function for the given parametric distance along the shape function,d^{grade}p(s)/d^{grade}s
.Example:
1st derivative (grade = 1), this returns[p(s), dp(s)/ds]
;
2nd derivative (grade = 2), this returns[p(s), dp(s)/ds, d^2p(s)/d^2s]
; etc.- Parameters:
s
- Parametric distance to calculate derivatives for (0.0 to 1.0 inclusive).grade
- The maximum grade to calculate the derivatives for (1=1st derivative, 2=2nd derivative, etc)- Returns:
- An array of derivatives up to the specified grade of the shape function at the specified parametric position. The returned array was allocated using javolution.context.ArrayFactory.DOUBLES_FACTORY, could be longer than the number of derivatives requested, and could be recycled by the user when no longer needed.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0.
-
getCoefficients
public double[] getCoefficients()
Return the array of Bernstein Polynomial coefficients for this shape function. The array will have a length of the order of the polynomial.- Returns:
- The array of Bernstein Polynomial coefficients for this shape function.
- See Also:
getOrder()
,getBasisFunction()
-
isValid
public boolean isValid()
Returntrue
if this shape function contains valid and finite numerical components. A value offalse
will be returned if any of the values are NaN or Inf.- Returns:
- true if this shape function contains valid and finite numerical values.
-
equals
public boolean equals(java.lang.Object obj)
Compares this CSTShapeFunction against the specified object for strict equality (same values).- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare with.- Returns:
true
if this object is identical to that object;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the hash code value.
-
copy
public CSTShapeFunction copy()
Returns a copy of this CSTShapeFunction instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfacejavolution.lang.ValueType
- Returns:
- an identical and independent copy of this object.
-
-