Package geomss.geom.cst
Class BasicCSTCurve
- java.lang.Object
-
- geomss.geom.AbstractGeomElement<T>
-
- geomss.geom.AbstractCurve<CSTCurve>
-
- geomss.geom.cst.CSTCurve
-
- geomss.geom.cst.BasicCSTCurve
-
- All Implemented Interfaces:
Curve<CSTCurve>
,GeomElement<CSTCurve>
,ParametricGeometry<CSTCurve>
,Transformable<CSTCurve>
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
,javolution.lang.Immutable
,javolution.lang.Reusable
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
public final class BasicCSTCurve extends CSTCurve implements javolution.lang.ValueType
An implementation of the Class-Shape-Transform (CST) planar curve. This curve type is useful for defining smooth aircraft component shapes with a minimum number of defining parameters.Modified by: Joseph A. Huwaldt
- Version:
- December 25, 2019
- Author:
- Joseph A. Huwaldt, Date: March 14, 2014
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class geomss.geom.AbstractCurve
GTOL
-
Fields inherited from class geomss.geom.AbstractGeomElement
RESOURCES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicCSTCurve
changeBFCoefficients(int order, double... Acoefs)
Return a copy of this CSTCurve with the shape function Bernstein Polynomial coefficients changed to the specified coefficients.BasicCSTCurve
changeCFunction(CSTClassFunction Cf)
Return a copy of this CSTCurve with the class function changed to the specified class function.BasicCSTCurve
changeChord(Parameter<javax.measure.quantity.Length> chord)
Return a copy of this CSTCurve with the chord length changed to the specified value.BasicCSTCurve
changeOffsetTE(double offsetTE_c)
Return a copy of this CSTCurve with the trailing edge offset from the chord-line to chord ratio changed to the specified value.BasicCSTCurve
changeOffsetTE(Parameter<javax.measure.quantity.Length> offsetTE)
Return a copy of this CSTCurve with the trailing edge offset from the chord-line changed to the specified value.BasicCSTCurve
changeOrigin(Point origin)
Return a copy of this CSTCurve with the curve origin or leading-edge point changed to the specified value.BasicCSTCurve
changeSFunction(CSTShapeFunction Sf)
Return a copy of this CSTCurve with the shape function changed to the specified shape function.BasicCSTCurve
copy()
Returns a copy of thisBasicCSTCurve
instanceallocated
by the calling thread (possibly on the stack).BasicCSTCurve
copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).boolean
equals(java.lang.Object obj)
Compares this BasicCSTCurve against the specified object for strict equality (same values and same units).Point
getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).Point
getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).CSTClassFunction
getCFunction()
Return the class function associated with this CST curve.Parameter<javax.measure.quantity.Length>
getChord()
Return the chord length of the curve.Parameter<javax.measure.quantity.Length>
getOffsetTE()
Return the offset of the trailing edge of the curve from the chord line.int
getOrder()
Return the order of this CST curve.Point
getOrigin()
Return the origin of the leading edge of this curve.int
getPhyDimension()
Returns the number of physical dimensions of the geometry element.Point
getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve,p(s)
.java.util.List<Vector<javax.measure.quantity.Length>>
getSDerivatives(double s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the curve for the given parametric distance along the curve,d^{grade}p(s)/d^{grade}s
.CSTShapeFunction
getSFunction()
Return the shape function associated with this CST curve.javax.measure.unit.Unit<javax.measure.quantity.Length>
getUnit()
Returns the unit in which this curve is stated.Vector<javax.measure.quantity.Dimensionless>
getXhat()
Return the chord-wise direction of this curve (the curve X-direction).Vector<javax.measure.quantity.Dimensionless>
getYhat()
Return the in-plane direction of this curve perpendicular to the chord-wise direction (the curve Y-direction).int
hashCode()
Returns the hash code for this parameter.BasicCSTCurve
immutable()
Return an immutable version of this CST curve.boolean
isValid()
Returntrue
if this curve contains valid and finite numerical components.static BasicCSTCurve
newInstance(CSTClassFunction Cf, CSTShapeFunction Sf, double dZTE_c)
Return a new 2D, planarBasicCSTCurve
instance using the supplied input parameters with the origin at (0,0), a chord length of 1.0 m and with the chord aligned with the X-axis.static BasicCSTCurve
newInstance(CSTClassFunction Cf, CSTShapeFunction Sf, Parameter<javax.measure.quantity.Length> offsetTE, Point origin, Parameter<javax.measure.quantity.Length> chord, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat)
Return a new planarBasicCSTCurve
instance using the supplied input parameters.static void
recycle(BasicCSTCurve instance)
Recycles aBasicCSTCurve
instance immediately (on the stack when executing in a StackContext).CSTCurve
reverse()
Return a new curve that is identical to this one, but with the parameterization reversed.GeomList<CSTCurve>
splitAt(double s)
Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions).BasicCSTCurve
to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
Returns the equivalent to this curve but stated in the specified unit.BasicCSTCurve
toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions.NurbsCurve
toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS curve representation of this curve to within the specified tolerance.-
Methods inherited from class geomss.geom.cst.CSTCurve
getTransformed, isDegenerate, isPlanar, size
-
Methods inherited from class geomss.geom.AbstractCurve
extractGrid, getArcLength, getArcLength, getArcLength, getBinormal, getBinormal, getClosest, getClosest, getClosest, getClosest, getClosest, getClosest, getCurvature, getCurvature, getDerivatives, getEnclosedArea, getFarthest, getFarthest, getFarthest, getLimitPoint, getParDimension, getPoint, getPoint, getPointAtArcLength, getPrincipalNormal, getPrincipalNormal, getRealPoint, getSDerivative, getSDerivatives, getTangencyPoint, getTangent, getTangent, getTorsion, getTorsion, getVariationOfCurvature, getVariationOfCurvature, gridToTolerance, intersect, intersect, intersect, intersect, intersect, isCircular, isLine, splitAt
-
Methods inherited from class geomss.geom.AbstractGeomElement
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString, toText
-
Methods inherited from interface geomss.geom.GeomElement
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toText
-
-
-
-
Method Detail
-
newInstance
public static BasicCSTCurve newInstance(CSTClassFunction Cf, CSTShapeFunction Sf, Parameter<javax.measure.quantity.Length> offsetTE, Point origin, Parameter<javax.measure.quantity.Length> chord, GeomVector<javax.measure.quantity.Dimensionless> xhat, GeomVector<javax.measure.quantity.Dimensionless> yhat)
Return a new planarBasicCSTCurve
instance using the supplied input parameters.- Parameters:
Cf
- The class function for this BasicCSTCurve. May not be null.Sf
- The shape function for this BasicCSTCurve. May not be null.offsetTE
- The trailing edge offset from the chord-line for this BasicCSTCurve. May not be null.origin
- The origin of the leading edge of this curve (gives the curve location). May not be null.chord
- The chord length for this curve (gives the curve scale). May not be null.xhat
- The chord-wise direction of this curve (the curve X-axis direction). May not be null.yhat
- The direction perpendicular to xhat for this curve (the curve Y-axis direction). May not be null.- Returns:
- A new BasicCSTCurve instance
-
newInstance
public static BasicCSTCurve newInstance(CSTClassFunction Cf, CSTShapeFunction Sf, double dZTE_c)
Return a new 2D, planarBasicCSTCurve
instance using the supplied input parameters with the origin at (0,0), a chord length of 1.0 m and with the chord aligned with the X-axis.- Parameters:
Cf
- The class function for this BasicCSTCurve. May not be null.Sf
- The shape function for this BasicCSTCurve. May not be null.dZTE_c
- The trailing edge offset from the chord-line to chord length ratio for this BasicCSTCurve.- Returns:
- A new BasicCSTCurve instance
-
getCFunction
public CSTClassFunction getCFunction()
Return the class function associated with this CST curve.- Specified by:
getCFunction
in classCSTCurve
- Returns:
- The class function associated with this CST curve.
-
getSFunction
public CSTShapeFunction getSFunction()
Return the shape function associated with this CST curve.- Specified by:
getSFunction
in classCSTCurve
- Returns:
- The shape function associated with this CST curve.
-
getOffsetTE
public Parameter<javax.measure.quantity.Length> getOffsetTE()
Return the offset of the trailing edge of the curve from the chord line.- Specified by:
getOffsetTE
in classCSTCurve
- Returns:
- The offset of the trailing edge of the curve from the chord line.
-
getChord
public Parameter<javax.measure.quantity.Length> getChord()
Return the chord length of the curve. This defines the scale or size of the curve.
-
getOrigin
public Point getOrigin()
Return the origin of the leading edge of this curve. This defines the s=0 location of the curve in space.
-
getXhat
public Vector<javax.measure.quantity.Dimensionless> getXhat()
Return the chord-wise direction of this curve (the curve X-direction).
-
getYhat
public Vector<javax.measure.quantity.Dimensionless> getYhat()
Return the in-plane direction of this curve perpendicular to the chord-wise direction (the curve Y-direction).
-
changeCFunction
public BasicCSTCurve changeCFunction(CSTClassFunction Cf)
Return a copy of this CSTCurve with the class function changed to the specified class function.- Parameters:
Cf
- The new class function for this BasicCSTCurve. May not be null.- Returns:
- A copy of this CSTCurve with the class function changed to the specified class function.
-
changeSFunction
public BasicCSTCurve changeSFunction(CSTShapeFunction Sf)
Return a copy of this CSTCurve with the shape function changed to the specified shape function.- Parameters:
Sf
- The new shape function for this BasicCSTCurve. May not be null.- Returns:
- A copy of this CSTCurve with the shape function changed to the specified shape function.
-
changeBFCoefficients
public BasicCSTCurve changeBFCoefficients(int order, double... Acoefs)
Return a copy of this CSTCurve with the shape function Bernstein Polynomial coefficients changed to the specified coefficients.- Parameters:
order
- The order of the shape function to use.Acoefs
- The new 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 copy of this CSTCurve with the shape function Bernstein Polynomial coefficients changed to the specified coefficients.
-
changeOffsetTE
public BasicCSTCurve changeOffsetTE(Parameter<javax.measure.quantity.Length> offsetTE)
Return a copy of this CSTCurve with the trailing edge offset from the chord-line changed to the specified value.- Parameters:
offsetTE
- The new trailing edge offset from the chord-line for this BasicCSTCurve. May not be null.- Returns:
- A copy of this CSTCurve with the trailing edge offset changed to the specified value.
-
changeOffsetTE
public BasicCSTCurve changeOffsetTE(double offsetTE_c)
Return a copy of this CSTCurve with the trailing edge offset from the chord-line to chord ratio changed to the specified value.- Parameters:
offsetTE_c
- The new trailing edge offset from the chord-line to chord ratio for this BasicCSTCurve.- Returns:
- A copy of this CSTCurve with the trailing edge offset changed to the specified value.
-
changeOrigin
public BasicCSTCurve changeOrigin(Point origin)
Return a copy of this CSTCurve with the curve origin or leading-edge point changed to the specified value.- Parameters:
origin
- The new origin of the leading edge of this curve (gives the curve location). May not be null.- Returns:
- A copy of this CSTCurve with the origin changed to the specified value.
-
changeChord
public BasicCSTCurve changeChord(Parameter<javax.measure.quantity.Length> chord)
Return a copy of this CSTCurve with the chord length changed to the specified value.- Parameters:
chord
- The chord length for this curve (gives the curve scale). May not be null.- Returns:
- A copy of this CSTCurve with the chord length changed to the specified value.
-
getPhyDimension
public int getPhyDimension()
Returns the number of physical dimensions of the geometry element.- Specified by:
getPhyDimension
in interfaceGeomElement<CSTCurve>
- Returns:
- The number of physical dimensions of the geometry element.
-
getOrder
public int getOrder()
Return the order of this CST curve.- Returns:
- order of this curve (degree + 1)
-
getRealPoint
public Point getRealPoint(double s)
Calculate a point on the curve for the given parametric distance along the curve,p(s)
.- Specified by:
getRealPoint
in interfaceCurve<CSTCurve>
- Parameters:
s
- parametric distance to calculate a point for (0.0 to 1.0 inclusive).- Returns:
- the calculated point
-
getSDerivatives
public java.util.List<Vector<javax.measure.quantity.Length>> getSDerivatives(double s, int grade)
Calculate all the derivatives from0
tograde
with respect to parametric distance on the curve for the given parametric distance along the curve,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.- Specified by:
getSDerivatives
in interfaceCurve<CSTCurve>
- 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:
- A list of derivatives up to the specified grade of the curve at the specified parametric position.
- Throws:
java.lang.IllegalArgumentException
- if the grade is < 0.
-
getBoundsMin
public Point getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).- Specified by:
getBoundsMin
in interfaceGeomElement<CSTCurve>
- Returns:
- The minimum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no geometry.
-
getBoundsMax
public Point getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).- Specified by:
getBoundsMax
in interfaceGeomElement<CSTCurve>
- Returns:
- The maximum bounding box coordinate for this geometry element.
- Throws:
java.lang.IndexOutOfBoundsException
- if this list contains no elements.
-
reverse
public CSTCurve reverse()
Return a new curve that is identical to this one, but with the parameterization reversed. This does not change the origin or axis directions, but only the curve parameterization; what was s=0 will become s=1, etc.
-
splitAt
public GeomList<CSTCurve> splitAt(double s)
Split this curve at the specified parametric position returning a list containing two curves (a lower curve with smaller parametric positions than "s" and an upper curve with larger parametric positions). The origin, chord length, and trailing edge offset from chord-line will be identical for the the returned segments and this curve. The only change is in the parameterization.
-
isValid
public boolean isValid()
Returntrue
if this curve contains valid and finite numerical components. A value offalse
will be returned if any of the coordinate values are NaN or Inf.- Specified by:
isValid
in interfaceGeomElement<CSTCurve>
- Returns:
- true if this element contains valid and finite numerical values.
-
getUnit
public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
Returns the unit in which this curve is stated.- Specified by:
getUnit
in interfaceGeomElement<CSTCurve>
- Returns:
- The unit that this curves points are stated in.
-
to
public BasicCSTCurve to(javax.measure.unit.Unit<javax.measure.quantity.Length> unit) throws javax.measure.converter.ConversionException
Returns the equivalent to this curve but stated in the specified unit.- Specified by:
to
in interfaceCurve<CSTCurve>
- Specified by:
to
in interfaceGeomElement<CSTCurve>
- Specified by:
to
in interfaceParametricGeometry<CSTCurve>
- Parameters:
unit
- the length unit of the curve to be returned. May not be null.- Returns:
- an equivalent to this curve but stated in the specified unit.
- Throws:
javax.measure.converter.ConversionException
- if the the input unit is not a length unit.
-
toDimension
public BasicCSTCurve toDimension(int newDim)
Return the equivalent of this curve converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.- Specified by:
toDimension
in interfaceCurve<CSTCurve>
- Specified by:
toDimension
in interfaceGeomElement<CSTCurve>
- Specified by:
toDimension
in interfaceParametricGeometry<CSTCurve>
- Parameters:
newDim
- The dimension of the curve to return.- Returns:
- The equivalent of this curve converted to the new dimensions.
-
toNurbs
public NurbsCurve toNurbs(Parameter<javax.measure.quantity.Length> tol)
Return a NURBS curve representation of this curve to within the specified tolerance.
-
copy
public BasicCSTCurve copy()
Returns a copy of thisBasicCSTCurve
instanceallocated
by the calling thread (possibly on the stack).- Specified by:
copy
in interfaceCurve<CSTCurve>
- Specified by:
copy
in interfaceGeomElement<CSTCurve>
- Specified by:
copy
in interfaceParametricGeometry<CSTCurve>
- Specified by:
copy
in interfacejavolution.lang.ValueType
- Returns:
- an identical and independent copy of this curve.
-
copyToReal
public BasicCSTCurve copyToReal()
Return a copy of this object with any transformations or subranges removed (applied).- Specified by:
copyToReal
in interfaceCurve<CSTCurve>
- Specified by:
copyToReal
in interfaceGeomElement<CSTCurve>
- Returns:
- A copy of this object with any transformations or subranges removed (applied).
-
immutable
public BasicCSTCurve immutable()
Return an immutable version of this CST curve. This implementation simply returns this BasicCSTCurve instance.
-
equals
public boolean equals(java.lang.Object obj)
Compares this BasicCSTCurve against the specified object for strict equality (same values and same units).- Overrides:
equals
in classAbstractGeomElement<CSTCurve>
- Parameters:
obj
- the object to compare with.- Returns:
true
if this point is identical to that point;false
otherwise.
-
hashCode
public int hashCode()
Returns the hash code for this parameter.- Overrides:
hashCode
in classAbstractGeomElement<CSTCurve>
- Returns:
- the hash code value.
-
recycle
public static void recycle(BasicCSTCurve instance)
Recycles aBasicCSTCurve
instance immediately (on the stack when executing in a StackContext).- Parameters:
instance
- The instance to be recycled.
-
-