Class NurbsCurve

    • Method Detail

      • getControlPoints

        public abstract java.util.List<ControlPointgetControlPoints()
        Return a list of control points for this curve.
        Returns:
        the ordered control points
      • getKnotVector

        public abstract KnotVector getKnotVector()
        Return the knot vector of this curve.
        Returns:
        The knot vector.
      • getDegree

        public abstract int getDegree()
        Return the degree of the NURBS curve.
        Returns:
        degree of curve
      • immutable

        public abstract BasicNurbsCurve immutable()
        Return an immutable version of this NURBS curve.
        Returns:
        an immutable version of this curve.
      • reverse

        public NurbsCurve reverse()
        Return a new curve that is identical to this one, but with the parameterization reversed.
        Returns:
        A new curve that is identical to this one but with the parameterization reversed.
      • insertKnot

        public BasicNurbsCurve insertKnot​(double s,
                                          int numInsertions)
        Create and return a new NURBS curve that is geometrically identical to this one but with a new knot inserted at the specified parametric location. The parameterization of the new curve is identical to this curve, but the new curve will have a new knot at the specified location and a new set of control points.
        Parameters:
        s - The parametric location where the knot is to be inserted.
        numInsertions - The number of times that the knot should be inserted at the specified position.
        Returns:
        A new NURBS curve that is identical to this one, but with a new knot inserted at the specified location.
      • refineKnotVector

        public BasicNurbsCurve refineKnotVector​(double[] newKnots)
        Create and return a new NURBS curve that is geometrically identical to this one but with the specified list of knots inserted into it's knot vector. The parameterization of the new curve is identical to this curve, but the new curve will have the new knots at the specified locations and a new set of control points. This is more efficient than repeatedly calling insertKnot() for multiple knot insertions.
        Parameters:
        newKnots - The parametric locations where the knots are to be inserted.
        Returns:
        A new NURBS curve that is identical to this one, but with the new knots inserted at the specified locations.
      • refineKnotVector

        public BasicNurbsCurve refineKnotVector​(Float64Vector newKnots)
        Create and return a new NURBS curve that is geometrically identical to this one but with the specified list of knots inserted into it's knot vector. The parameterization of the new curve is identical to this curve, but the new curve will have the new knots at the specified locations and a new set of control points. This is more efficient than repeatedly calling insertKnot() for multiple knot insertions.
        Parameters:
        newKnots - The parametric locations where the knots are to be inserted. May not be null.
        Returns:
        A new NURBS curve that is identical to this one, but with the new knots inserted at the specified locations.
      • mergeKnotVector

        public NurbsCurve mergeKnotVector​(Float64Vector Um)
        Return a NURBS curve that is geometrically identical to this one but with the specified list of knots merged into it's knot vector. The parameterization of the new curve is identical to this curve, but the new curve will have any new knots at the specified locations added and a new set of control points. If the input knot list matches the knot list of this curve, then this curve is returned.
        Parameters:
        Um - The knot vector to merge with this curve's knot vector. May not be null.
        Returns:
        A NURBS curve that is identical to this one, but with the merger of the input knot vector and this curve's knot vector.
      • removeKnot

        public NurbsCurve removeKnot​(int index,
                                     int numRemovals,
                                     Parameter<javax.measure.quantity.Length> tolerance)
        Attempts to remove the knot with the specified index from this NURBS curve the specified number of times. If the knot can not be removed without changing the shape of the curve, then a reference to this curve is returned: if (crv == crv.removeKnot(...)) { no knots removed }.
        Parameters:
        index - The index of the knot to be removed (degree + 1 ≤ index < knot vector length - degree).
        numRemovals - The number of times that the knot at "index" should be removed (1 ≤ num ≤ multiplicity of the knot). If numRemovals is > multiplicity of the knot, then numRemovals is set to the multiplicity of the knot.
        tolerance - The knot(s) specified will be removed as long as the deviation of the curve is everywhere less than this tolerance. May not be null.
        Returns:
        A new NURBS curve that is identical to this one (to within the specified tolerance), but with the specified knot removed or a reference to this curve if the knot could not be removed.
      • getArcLength

        public Parameter<javax.measure.quantity.Length> getArcLength​(double s1,
                                                                     double s2,
                                                                     double eps)
        Return the arc length of a segment of this curve.
        Specified by:
        getArcLength in interface Curve<NurbsCurve>
        Overrides:
        getArcLength in class AbstractCurve<NurbsCurve>
        Parameters:
        s1 - The starting parametric distance along the curve to begin the arc-length calculation from.
        s2 - The ending parametric distance along the curve to end the arc-length calculation at.
        eps - The desired fractional accuracy on the arc-length.
        Returns:
        The arc length of the specified segment of the curve.
      • gridToTolerance

        public PointString<SubrangePointgridToTolerance​(Parameter<javax.measure.quantity.Length> tol)
        Return a string of points that are gridded onto the curve with the number of points and spacing chosen to result in straight line segments between the points that have mid-points that are all within the specified tolerance of this curve.
        Specified by:
        gridToTolerance in interface Curve<NurbsCurve>
        Overrides:
        gridToTolerance in class AbstractCurve<NurbsCurve>
        Parameters:
        tol - The maximum distance that a straight line between gridded points may deviate from this curve. May not be null.
        Returns:
        A string of subrange points gridded onto the curve.
      • getTransformed

        public NurbsCurveTrans getTransformed​(GTransform transform)
        Returns transformed version of this element. The returned object implements GeomTransform and contains this element as a child.
        Parameters:
        transform - The transformation to apply to this geometry. May not be null.
        Returns:
        A new triangle that is identical to this one with the specified transformation applied.
        Throws:
        DimensionException - if this point is not 3D.
      • splitAt

        public GeomList<NurbsCurvesplitAt​(double s)
        Split this NurbsCurve 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).
        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.
      • intersect

        public GeomList<PointString<SubrangePoint>> intersect​(LineSegment line,
                                                              Parameter<javax.measure.quantity.Length> tol)
        Return the intersection between a line segment and this curve.
        Specified by:
        intersect in interface Curve<NurbsCurve>
        Overrides:
        intersect in class AbstractCurve<NurbsCurve>
        Parameters:
        line - The line segment to intersect. May not be null.
        tol - Tolerance (in physical space) to refine the point positions to. May not be null.
        Returns:
        A list containing two PointString instances each containing zero or more subrange points, on this curve and the input line segment respectively, made by the intersection of this curve with the specified line segment. If no intersections are found a list of two empty PointStrings are returned.
      • toNurbs

        public NurbsCurve toNurbs​(Parameter<javax.measure.quantity.Length> tol)
        Return a NURBS curve representation of this curve to within the specified tolerance. This implementation returns a reference to this curve itself since it is already a NURBS curve and the tolerance parameter is ignored.
        Parameters:
        tol - Ignored. May pass null.
        Returns:
        A reference to this NURBS curve is returned.
      • toNurbs

        public NurbsCurve toNurbs()
        Return a NURBS curve representation of this curve. This implementation returns a reference to this curve itself since it is already a NURBS curve.
        Returns:
        A reference to this NURBS curve is returned.
      • isValid

        public boolean isValid()
        Return true if this NurbsCurve contains valid and finite numerical components. A value of false will be returned if any of the control point values or knots are NaN or Inf.
        Returns:
        true if this curve contains valid and finite values.
      • isLine

        public boolean isLine​(Parameter<javax.measure.quantity.Length> tol)
        Returns true if this curve is a line to within the specified tolerance.
        Specified by:
        isLine in interface Curve<NurbsCurve>
        Overrides:
        isLine in class AbstractCurve<NurbsCurve>
        Parameters:
        tol - The tolerance for determining if this curve is a line. If null is passed, then exact linearity is required.
        Returns:
        true if this curve is a line.
      • isPlanar

        public boolean isPlanar​(Parameter<javax.measure.quantity.Length> tol)
        Return true if this curve is planar or false if it is not.
        Specified by:
        isPlanar in interface Curve<NurbsCurve>
        Overrides:
        isPlanar in class AbstractCurve<NurbsCurve>
        Parameters:
        tol - The geometric tolerance to use in determining if the curve is planar. May not be null.
        Returns:
        true if this curve is planar.
      • toText

        public javolution.text.Text toText()
        Returns the text representation of this geometry element that consists of the name followed by the control point values, followed by the knot vector. For example:
           {aCurve = {{{1 ft, 0 ft}, 1.0}, {{0 ft, 1 ft}, 0.25}, {{-1 ft, 0 ft}, 1.0}},{degree=2,{0.0, 0.0, 0.0, 1.0, 1.0, 1.0}}}
         
        If there is no name, then the output looks like this:
           {{{{1 ft, 0 ft}, 1.0}, {{0 ft, 1 ft}, 0.25}, {{-1 ft, 0 ft}, 1.0}},{degree=2,{0.0, 0.0, 0.0, 1.0, 1.0, 1.0}}}
         
        Specified by:
        toText in interface GeomElement<NurbsCurve>
        Overrides:
        toText in class AbstractGeomElement<NurbsCurve>
        Returns:
        the text representation of this geometry element.