Package geomss.geom

Class LineSeg

    • Method Detail

      • valueOf

        public static LineSeg valueOf​(Point p0,
                                      Point p1)
        Returns a LineSeg instance with the specified end points. The units of the curve will be the units of the start point.
        Parameters:
        p0 - The start (beginning) of the line segment. May not be null.
        p1 - The end of the line segment. May not be null.
        Returns:
        A LineSeg instance that represents a line between the input points.
      • valueOf

        public static LineSeg valueOf​(Point p0,
                                      GeomVector<javax.measure.quantity.Length> Ldir)
        Returns a LineSeg instance with the specified start point and direction/length vector. The units of the curve will be the units of the start point.
        Parameters:
        p0 - The start (beginning) of the line segment. May not be null.
        Ldir - The vector defining the direction and length of the line segment. May not be null.
        Returns:
        A line segment from the input point in the direction and length of the input vector.
      • valueOf

        public static LineSeg valueOf​(Curve lineCrv)
        Returns a LineSeg that represents a straight line between the end points of the input curve. WARNING: No check is made that the input curve is truly a straight line. The end points of the input curve are simply used to define a straight line segment.
        Parameters:
        lineCrv - A curve from which the end points will be used to define a line segment. May not be null.
        Returns:
        The line segment between the end points of the input curve.
        See Also:
        Curve.isLine(jahuwaldt.js.param.Parameter<javax.measure.quantity.Length>)
      • recycle

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

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

        public Point getEnd()
        Return the end point of the line segment.
        Specified by:
        getEnd in class LineSegment
        Returns:
        The end point of this line segment.
      • getUnitVector

        public Vector<javax.measure.quantity.Dimensionless> getUnitVector()
        Get a unit direction vector for the line segment.
        Specified by:
        getUnitVector in class LineSegment
        Returns:
        A unit vector indicating the direction of this line 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.
      • getRealPoint

        public Point getRealPoint​(double s)
        Calculate a point on the curve for the given parametric distance along the curve.
        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.
      • getArcLength

        public Parameter<javax.measure.quantity.Length> getArcLength​(double eps)
        Return the total arc length of this curve.
        Specified by:
        getArcLength in interface Curve<LineSegment>
        Overrides:
        getArcLength in class AbstractCurve<LineSegment>
        Parameters:
        eps - The desired fractional accuracy on the arc-length. For this curve type, this parameter is ignored and the exact arc length is always returned.
        Returns:
        The total arc length of the curve.
      • reverse

        public LineSegment 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.
      • 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.
      • toDimension

        public LineSeg toDimension​(int newDim)
        Return a copy 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<LineSegment>
        Specified by:
        toDimension in interface GeomElement<LineSegment>
        Specified by:
        toDimension in interface ParametricGeometry<LineSegment>
        Parameters:
        newDim - The dimension of the curve to return.
        Returns:
        This curve converted to the new dimensions.
      • to

        public LineSeg to​(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
                   throws javax.measure.converter.ConversionException
        Returns the equivalent to this element 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 element to be returned. May not be null.
        Returns:
        an equivalent to this element but stated in the specified unit.
        Throws:
        javax.measure.converter.ConversionException - if the the input unit is not a length unit.
      • equals

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