Package geomss.geom

Class LineSegTrans

    • Method Detail

      • newInstance

        public static LineSegTrans newInstance​(LineSegment child,
                                               GTransform transform)
        Returns a 3D LineSegTrans instance holding the specified LineSegment and GTransform.
        Parameters:
        child - The LineSegment that is the child of this transform element (may not be null).
        transform - The transform held by this transform element (may not be null).
        Returns:
        the transform element having the specified values.
      • setTransform

        public void setTransform​(GTransform transform)
        Sets the transformation represented by this transformation element.
        Specified by:
        setTransform in interface GeomTransform<LineSegment>
        Parameters:
        transform - The transform to set this transform element to (may not be null).
      • getStart

        public GeomPoint getStart()
        Return the starting point of the line segment.
        Specified by:
        getStart in class LineSegment
        Returns:
        The starting point of the line segment.
      • getEnd

        public GeomPoint getEnd()
        Return the end point of the line segment.
        Specified by:
        getEnd in class LineSegment
        Returns:
        The end point of the lien segment.
      • getDerivativeVector

        public GeomVector<javax.measure.quantity.Length> getDerivativeVector()
        Return the dimensional derivative vector for this line segment. The length of this vector is the length of the line segment, the origin is at the start point and the end of the vector is the line end.
        Specified by:
        getDerivativeVector in class LineSegment
        Returns:
        The dimensional derivative vector for this line segment.
      • getUnitVector

        public GeomVector<javax.measure.quantity.Dimensionless> getUnitVector()
        Get unit direction vector for the line segment.
        Specified by:
        getUnitVector in class LineSegment
        Returns:
        A unit vector indicating the direction of this line segment.
      • size

        public int size()
        Returns the number of child-elements that make up this geometry element. This implementation returns the size in the child curve.
        Specified by:
        size in interface GeomElement<LineSegment>
        Overrides:
        size in class LineSegment
        Returns:
        The number of points in this line segment (always returns 2).
      • 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<LineSegment>
        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<LineSegment>
        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.
      • reverse

        public LineSegTrans reverse()
        Return a new curve that is identical to this one, but with the parameterization reversed.
        Specified by:
        reverse in interface Curve<LineSegment>
        Returns:
        A new curve that is identical to this one, but with the parameterization reversed.
      • 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<LineSegment>
        Returns:
        The minimum bounding box coordinate for this geometry element.
        Throws:
        java.lang.IndexOutOfBoundsException - if this list contains no elements.
      • 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<LineSegment>
        Returns:
        The maximum bounding box coordinate for this geometry element.
        Throws:
        java.lang.IndexOutOfBoundsException - if this list contains no elements.
      • 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<LineSegment>
        Overrides:
        getUnit in class LineSegment
        Returns:
        The unit in which this curve is stated.
      • to

        public LineSegTrans 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<LineSegment>
        Specified by:
        to in interface GeomElement<LineSegment>
        Specified by:
        to in interface ParametricGeometry<LineSegment>
        Specified by:
        to in interface PointGeometry<LineSegment>
        Specified by:
        to in class LineSegment
        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 LineSegTrans toDimension​(int newDim)
        Return the equivalent of this line segment converted to the specified number of physical dimensions. This implementation will throw an exception if the specified dimension is anything other than 3.
        Specified by:
        toDimension in interface Curve<LineSegment>
        Specified by:
        toDimension in interface GeomElement<LineSegment>
        Specified by:
        toDimension in interface ParametricGeometry<LineSegment>
        Parameters:
        newDim - The dimension of the line segment to return. MUST equal 3.
        Returns:
        The equivalent of this line segment converted to the new dimensions.
        Throws:
        java.lang.IllegalArgumentException - if the new dimension is anything other than 3.
      • toNurbs

        public NurbsCurve toNurbs​(Parameter<javax.measure.quantity.Length> tol)
        Return a transformed NURBS curve representation of this line segment. An exact representation is returned and the tolerance parameter is ignored.
        Specified by:
        toNurbs in interface Curve<LineSegment>
        Overrides:
        toNurbs in class LineSegment
        Parameters:
        tol - Ignored. May pass null.
        Returns:
        A transformed NURBS curve that exactly represents this line segment.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this LineSegTrans against the specified object for strict equality.
        Overrides:
        equals in class AbstractGeomElement<LineSegment>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this transform is identical to that transform; false otherwise.
      • recycle

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