Class 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
    • 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 planar BasicCSTCurve 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, planar BasicCSTCurve 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
      • 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 class CSTCurve
        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.
        Specified by:
        getChord in class CSTCurve
        Returns:
        The chord length 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.
        Specified by:
        getOrigin in class CSTCurve
        Returns:
        The origin of the leading edge of this curve.
      • getXhat

        public Vector<javax.measure.quantity.Dimensionless> getXhat()
        Return the chord-wise direction of this curve (the curve X-direction).
        Specified by:
        getXhat in class CSTCurve
        Returns:
        The chord-wise direction of this curve.
      • 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).
        Specified by:
        getYhat in class CSTCurve
        Returns:
        The in-plane direction of this curve perpendicular to Xhat.
      • 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 interface GeomElement<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 interface Curve<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 from 0 to grade 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 interface Curve<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 interface GeomElement<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 interface GeomElement<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.
        Specified by:
        reverse in interface Curve<CSTCurve>
        Returns:
        A new curve identical to this one, but with the parameterization reversed.
      • splitAt

        public GeomList<CSTCurvesplitAt​(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.
        Specified by:
        splitAt in interface Curve<CSTCurve>
        Parameters:
        s - The parametric position where this curve should be split (must not be 0 or 1!).
        Returns:
        A list containing two curves: 0 == the lower curve, 1 == the upper curve.
      • isValid

        public boolean isValid()
        Return true if this curve contains valid and finite numerical components. A value of false will be returned if any of the coordinate values are NaN or Inf.
        Specified by:
        isValid in interface GeomElement<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 interface GeomElement<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 interface Curve<CSTCurve>
        Specified by:
        to in interface GeomElement<CSTCurve>
        Specified by:
        to in interface ParametricGeometry<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 interface Curve<CSTCurve>
        Specified by:
        toDimension in interface GeomElement<CSTCurve>
        Specified by:
        toDimension in interface ParametricGeometry<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.
        Specified by:
        toNurbs in interface Curve<CSTCurve>
        Parameters:
        tol - The greatest possible difference between this curve and the NURBS representation returned. May not be null.
        Returns:
        A NURBS curve that represents this curve to within the specified tolerance.
      • immutable

        public BasicCSTCurve immutable()
        Return an immutable version of this CST curve. This implementation simply returns this BasicCSTCurve instance.
        Specified by:
        immutable in class CSTCurve
        Returns:
        an immutable version of this curve.
      • 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 class AbstractGeomElement<CSTCurve>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this point is identical to that point; false otherwise.
      • recycle

        public static void recycle​(BasicCSTCurve instance)
        Recycles a BasicCSTCurve instance immediately (on the stack when executing in a StackContext).
        Parameters:
        instance - The instance to be recycled.