A NURBS curve implementation that can be used by other curve classes

Constructors

  • Creates a NURBS curve from degree, knots, control points, and optional weights.

    When weights is omitted, all control points receive a weight of 1.0 (non-rational B-spline).

    Parameters

    • degree: number

      Polynomial degree p of the basis functions

    • knots: number[]

      Non-decreasing knot vector of length n + p + 1

    • controlPoints: AcGeVector3dLike[]

      Control points in curve order

    • Optionalweights: number[]

      Optional rational weights aligned with control points

    Returns AcGeNurbsCurve

Methods

  • Return a deep-cloned copy of this NURBS curve.

    Returns AcGeNurbsCurve

  • Get the degree of the NURBS curve

    Returns number

  • Evaluates position and parametric derivatives at parameter u.

    Returns the rational NURBS point together with first- and second-order parametric derivatives computed analytically from the basis functions.

    Parameters

    • u: number

      Curve parameter in the valid knot span

    Returns AcGeNurbsEvaluation

    Position point, first derivative deriv1, and second derivative deriv2

  • Samples a 2D path with analytic tangents for planar offset.

    Builds an initial uniform parameter list scaled by curve length and offset distance, then refines intervals where |offsetDist| * |curvature| exceeds 0.85 (potential cusp region). Each final sample includes a unit tangent derived from the analytic first derivative.

    Parameters

    • offsetDist: number

      Signed offset distance used to choose sample density

    • OptionalmaxSamples: number

      Upper bound on the number of returned samples (default 512)

    Returns { points: AcGePoint2d[]; tangents: AcGePoint2d[] }

    XY samples and matching unit tangents in parameter order

  • Get the valid parameter range for this curve

    Returns { end: number; start: number }

  • Get points along the curve

    Parameters

    • divisions: number

      Number of divisions to create

    Returns number[][]

    Array of points along the curve

  • Check if the curve is closed by comparing start and end points

    Parameters

    • Optionaltolerance: number

    Returns boolean

  • Get the knot vector

    Returns number[]

  • Calculate curve length using numerical integration

    Returns number

  • Returns the nearest point on this NURBS curve to the given point.

    Evaluates the curve at uniform steps in parameter space over the valid knot span.

    Parameters

    • point: AcGeVector3dLike

      Query point.

    • Optionalsamples: number

      Number of interior samples (default 64).

    Returns AcGeVector3dLike

  • Calculates a point on the curve at parameter u.

    Delegates to evaluate and returns only the position component.

    Parameters

    • u: number

      Curve parameter in the valid knot span

    Returns number[]

    Evaluated point as [x, y, z]

  • Signed curvature in the XY plane at parameter u.

    Uses the standard planar formula (x'y'' - y'x'') / (x'^2 + y'^2)^(3/2) applied to the parametric derivatives from evaluate.

    Parameters

    • u: number

      Curve parameter in the valid knot span

    Returns number

    Signed curvature; positive indicates counterclockwise bending

  • Get the weights

    Returns number[]

  • Create a NURBS curve from control points and knots

    Parameters

    • degree: number
    • knots: number[]
    • controlPoints: AcGeVector3dLike[]
    • Optionalweights: number[]

    Returns AcGeNurbsCurve

  • Create a NURBS curve from fit points using interpolation

    Parameters

    • points: number[][]
    • degree: number
    • Optionalparameterization: AcGeKnotParameterizationType
    • OptionalstartTangent: number[]
    • OptionalendTangent: number[]

    Returns AcGeNurbsCurve

  • Create fit points for a closed NURBS curve using Catmull-Rom interpolation

    Parameters

    Returns AcGePoint3d[]