OpenCascade.js
API ReferenceFoundationClassesTKMath

BSplCLib

OCCT package BSplCLib: BSplCLib_Cache, BSplCLib_EvaluatorFunction, BSplCLib_KnotDistribution, BSplCLib_MultDistribution.

BSplCLib_Cache

A cache class for Bezier and B-spline curves.
Defines all data, that can be cached on a span of a curve. The data should be recalculated in going from span to span.

Constructors(2)

  • constructor(theDegree: number, thePeriodic: boolean, theFlatKnots: NCollection_Array1_double, thePoles2d: NCollection_Array1_gp_Pnt2d, theWeights?: NCollection_Array1_double): BSplCLib_Cache

    Constructor, prepares data structures for caching values on a 2d curve.

    Parameters (5)
    • theDegree
      degree of the curve
    • thePeriodic
      identify whether the curve is periodic
    • theFlatKnots
      knots of Bezier/B-spline curve (with repetitions)
    • thePoles2d
      array of poles of 2D curve
    • theWeights
      array of weights of corresponding poles
  • constructor(theDegree: number, thePeriodic: boolean, theFlatKnots: NCollection_Array1_double, thePoles: NCollection_Array1_gp_Pnt, theWeights?: NCollection_Array1_double): BSplCLib_Cache

    Constructor, prepares data structures for caching values on a 3d curve.

    Parameters (5)
    • theDegree
      degree of the curve
    • thePeriodic
      identify whether the curve is periodic
    • theFlatKnots
      knots of Bezier/B-spline curve (with repetitions)
    • thePoles
      array of poles of 3D curve
    • theWeights
      array of weights of corresponding poles

Static methods(2)

Instance methods(20)

  • IsCacheValid(theParameter: number): boolean

    Verifies validity of the cache using flat parameter of the point.

    Parameters (1)
    • theParameter
      parameter of the point placed in the span
  • BuildCache(theParameter: number, theFlatKnots: NCollection_Array1_double, thePoles2d: NCollection_Array1_gp_Pnt2d, theWeights: NCollection_Array1_double): void

    Recomputes the cache data for 2D curves. Does not verify validity of the cache.

    Parameters (4)
    • theParameter
      the value on the knot's axis to identify the span
    • theFlatKnots
      knots of Bezier/B-spline curve (with repetitions)
    • thePoles2d
      array of poles of 2D curve
    • theWeights
      array of weights of corresponding poles
  • BuildCache(theParameter: number, theFlatKnots: NCollection_Array1_double, thePoles: NCollection_Array1_gp_Pnt, theWeights: NCollection_Array1_double): void

    Recomputes the cache data for 3D curves. Does not verify validity of the cache.

    Parameters (4)
    • theParameter
      the value on the knot's axis to identify the span
    • theFlatKnots
      knots of Bezier/B-spline curve (with repetitions)
    • thePoles
      array of poles of 3D curve
    • theWeights
      array of weights of corresponding poles
  • D0(theParameter: number, thePoint: gp_Pnt2d): void

    Calculates the point on the curve in the specified parameter.

    Parameters (2)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
  • D0(theParameter: number, thePoint: gp_Pnt): void

    Calculates the point on the curve in the specified parameter.

    Parameters (2)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
  • D1(theParameter: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d): void

    Calculates the point on the curve and its first derivative in the specified parameter.

    Parameters (3)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (first derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D1(theParameter: number, thePoint: gp_Pnt, theTangent: gp_Vec): void

    Calculates the point on the curve and its first derivative in the specified parameter.

    Parameters (3)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (first derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D2(theParameter: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d, theCurvature: gp_Vec2d): void

    Calculates the point on the curve and two derivatives in the specified parameter.

    Parameters (4)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (1st derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      curvature vector (2nd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D2(theParameter: number, thePoint: gp_Pnt, theTangent: gp_Vec, theCurvature: gp_Vec): void

    Calculates the point on the curve and two derivatives in the specified parameter.

    Parameters (4)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (1st derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      curvature vector (2nd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D3(theParameter: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d, theCurvature: gp_Vec2d, theTorsion: gp_Vec2d): void

    Calculates the point on the curve and three derivatives in the specified parameter.

    Parameters (5)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (1st derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      curvature vector (2nd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theTorsion
      second curvature vector (3rd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D3(theParameter: number, thePoint: gp_Pnt, theTangent: gp_Vec, theCurvature: gp_Vec, theTorsion: gp_Vec): void

    Calculates the point on the curve and three derivatives in the specified parameter.

    Parameters (5)
    • theParameter
      parameter of calculation of the value
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
    • theTangent
      tangent vector (1st derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      curvature vector (2nd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
    • theTorsion
      second curvature vector (3rd derivatives) for the curve in the calculated point Mutated in place; read the updated value from this argument after the call.
  • D0Local(theLocalParam: number, thePoint: gp_Pnt): void

    Calculates the 3D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.

    Parameters (2)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
  • D0Local(theLocalParam: number, thePoint: gp_Pnt2d): void

    Calculates the 2D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.

    Parameters (2)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the result of calculation (the point on the curve) Mutated in place; read the updated value from this argument after the call.
  • D1Local(theLocalParam: number, thePoint: gp_Pnt, theTangent: gp_Vec): void

    Calculates the 3D point and first derivative using pre-computed local parameter.

    Parameters (3)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
  • D1Local(theLocalParam: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d): void

    Calculates the 2D point and first derivative using pre-computed local parameter.

    Parameters (3)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
  • D2Local(theLocalParam: number, thePoint: gp_Pnt, theTangent: gp_Vec, theCurvature: gp_Vec): void

    Calculates the 3D point, first and second derivatives using pre-computed local parameter.

    Parameters (4)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      second derivative (curvature vector) Mutated in place; read the updated value from this argument after the call.
  • D2Local(theLocalParam: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d, theCurvature: gp_Vec2d): void

    Calculates the 2D point, first and second derivatives using pre-computed local parameter.

    Parameters (4)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      second derivative (curvature vector) Mutated in place; read the updated value from this argument after the call.
  • D3Local(theLocalParam: number, thePoint: gp_Pnt, theTangent: gp_Vec, theCurvature: gp_Vec, theTorsion: gp_Vec): void

    Calculates the 3D point, first, second and third derivatives using pre-computed local parameter.

    Parameters (5)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      second derivative (curvature vector) Mutated in place; read the updated value from this argument after the call.
    • theTorsion
      third derivative (torsion vector) Mutated in place; read the updated value from this argument after the call.
  • D3Local(theLocalParam: number, thePoint: gp_Pnt2d, theTangent: gp_Vec2d, theCurvature: gp_Vec2d, theTorsion: gp_Vec2d): void

    Calculates the 2D point, first, second and third derivatives using pre-computed local parameter.

    Parameters (5)
    • theLocalParam
      pre-computed local parameter: (Param - SpanStart) / SpanLength
    • thePoint
      the point on the curve Mutated in place; read the updated value from this argument after the call.
    • theTangent
      first derivative (tangent vector) Mutated in place; read the updated value from this argument after the call.
    • theCurvature
      second derivative (curvature vector) Mutated in place; read the updated value from this argument after the call.
    • theTorsion
      third derivative (torsion vector) Mutated in place; read the updated value from this argument after the call.

BSplCLib_EvaluatorFunction

Instance methods(1)

  • Evaluate(theDerivativeRequest: number, theStartEnd: number, theParameter: number, theResult: number, theErrorCode: number): { theResult: number; theErrorCode: number }

    Function evaluation method to be defined by descendant.

    Parameters (5)
    • theDerivativeRequest
    • theStartEnd
    • theParameter
    • theResult
    • theErrorCode
    Returns

    A result object with fields:

    • theResult: updated value from the call.
    • theErrorCode: updated value from the call.