OpenCascade.js
API ReferenceModelingDataTKGeomBase

GeomLib

OCCT package GeomLib: GeomLib, GeomLib_Check2dBSplineCurve, GeomLib_CheckBSplineCurve, GeomLib_CheckCurveOnSurface, and 8 more bound classes.

GeomLib

Geom Library. This package provides an implementation of functions for basic computation on geometric entity from packages Geom and Geom2d.

Constructors(1)

Static methods(23)

  • To3d(Position: gp_Ax2, Curve2d: Geom2d_Curve): Geom_Curve

    Computes the curve 3d from package Geom corresponding to curve 2d from package Geom2d, on the plan defined with the local coordinate system Position.

    Parameters (2)
    • Position
    • Curve2d
  • Computes the curve 3d from package Geom corresponding to the curve 3d from package Geom, transformed with the transformation <GTrsf> WARNING : this method may return a null Handle if it's impossible to compute the transformation of a curve. It's not implemented when : 1) the curve is an infinite parabola or hyperbola 2) the curve is an offsetcurve.

    Parameters (2)
    • Curve
    • GTrsf
  • SameRange(Tolerance: number, Curve2dPtr: Geom2d_Curve, First: number, Last: number, RequestedFirst: number, RequestedLast: number): { NewCurve2dPtr: Geom2d_Curve; [Symbol.dispose](): void }

    Make the curve Curve2dPtr have the imposed range First to List the most economic way, that is if it can change the range without changing the nature of the curve it will try to do that. Otherwise it will produce a Bspline curve that has the required range.

    Parameters (6)
    • Tolerance
    • Curve2dPtr
    • First
    • Last
    • RequestedFirst
    • RequestedLast
    Returns

    A result object with fields:

    • NewCurve2dPtr: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • BuildCurve3d(Tolerance: number, CurvePtr: Adaptor3d_CurveOnSurface, FirstParameter: number, LastParameter: number, MaxDeviation: number, AverageDeviation: number, Continuity: GeomAbs_Shape, MaxDegree: number, MaxSegment: number): { NewCurvePtr: Geom_Curve; MaxDeviation: number; AverageDeviation: number; [Symbol.dispose](): void }
    Parameters (9)
    • Tolerance
    • CurvePtr
    • FirstParameter
    • LastParameter
    • MaxDeviation
    • AverageDeviation
    • Continuity
    • MaxDegree
    • MaxSegment
  • AdjustExtremity(P1: gp_Pnt, P2: gp_Pnt, T1: gp_Vec, T2: gp_Vec): { Curve: Geom_BoundedCurve; [Symbol.dispose](): void }
    Parameters (4)
    • P1
    • P2
    • T1
    • T2
  • ExtendCurveToPoint(Point: gp_Pnt, Cont: number, After: boolean): { Curve: Geom_BoundedCurve; [Symbol.dispose](): void }

    Extends the bounded curve Curve to the point Point. The extension is built:

    • at the end of the curve if After equals true, or
    • at the beginning of the curve if After equals false. The extension is performed according to a degree of continuity equal to Cont, which in its turn must be equal to 1, 2 or 3. This function converts the bounded curve Curve into a BSpline curve. Warning
    • Nothing is done, and Curve is not modified if Cont is not equal to 1, 2 or 3.
    • It is recommended that the extension should not be too large with respect to the size of the bounded curve Curve: Point must not be located too far from one of the extremities of Curve.
    Parameters (3)
    • Point
    • Cont
    • After
    Returns

    A result object with fields:

    • Curve: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • ExtendSurfByLength(Length: number, Cont: number, InU: boolean, After: boolean): { Surf: Geom_BoundedSurface; [Symbol.dispose](): void }

    Extends the bounded surface Surf along one of its boundaries. The chord length of the extension is equal to Length. The direction of the extension is given as:

    • the u parametric direction of Surf, if InU equals true, or
    • the v parametric direction of Surf, if InU equals false. In this parametric direction, the extension is built on the side of:
    • the last parameter of Surf, if After equals true, or
    • the first parameter of Surf, if After equals false. The extension is performed according to a degree of continuity equal to Cont, which in its turn must be equal to 1, 2 or 3. This function converts the bounded surface Surf into a BSpline surface. Warning
    • Nothing is done, and Surf is not modified if Cont is not equal to 1, 2 or 3.
    • It is recommended that Length, the size of the extension should not be too large with respect to the size of the bounded surface Surf.
    • Surf must not be a periodic BSpline surface in the parametric direction corresponding to the direction of extension.
    Parameters (4)
    • Length
    • Cont
    • InU
    • After
    Returns

    A result object with fields:

    • Surf: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • AxeOfInertia(Points: NCollection_Array1_gp_Pnt, Axe: gp_Ax2, IsSingular: boolean, Tol: number): { IsSingular: boolean }

    Compute axes of inertia, of some points <Axe>.Location() is the BaryCentre <Axe>.XDirection is the axe of upper inertia <Axe>.Direction is the Normal to the average plane IsSingular is True if points are on line Tol is used to determine singular cases.

    Parameters (4)
    • Points
    • Axe
      Mutated in place; read the updated value from this argument after the call.
    • IsSingular
    • Tol
    Returns

    A result object with fields:

    • IsSingular: updated value from the call.
  • Inertia(Points: NCollection_Array1_gp_Pnt, Bary: gp_Pnt, XDir: gp_Dir, YDir: gp_Dir, Xgap: number, YGap: number, ZGap: number): { Xgap: number; YGap: number; ZGap: number }

    Compute principale axes of inertia, and dispersion value of some points.

    Parameters (7)
    • Points
    • Bary
      Mutated in place; read the updated value from this argument after the call.
    • XDir
      Mutated in place; read the updated value from this argument after the call.
    • YDir
      Mutated in place; read the updated value from this argument after the call.
    • Xgap
    • YGap
    • ZGap
    Returns

    A result object with fields:

    • Xgap: updated value from the call.
    • YGap: updated value from the call.
    • ZGap: updated value from the call.
  • RemovePointsFromArray(NumPoints: number, InParameters: NCollection_Array1_double): { OutParameters: NCollection_HArray1_double; [Symbol.dispose](): void }

    Warning! This assume that the InParameter is an increasing sequence of real number and it will not check for that : Unpredictable result can happen if this is not satisfied. It is the caller responsibility to check for that property.
    This method makes uniform NumPoints segments S1,...SNumPoints out of the segment defined by the first parameter and the last parameter of the InParameter ; keeps only one point of the InParameters set of parameter in each of the uniform segments taking care of the first and the last parameters. For the ith segment the element of the InParameter is the one that is the first to exceed the midpoint of the segment and to fall before the midpoint of the next segment There will be at the end at most NumPoints + 1 if NumPoints > 2 in the OutParameters Array

    Parameters (2)
    • NumPoints
    • InParameters
    Returns

    A result object with fields:

    • OutParameters: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • DensifyArray1OfReal(MinNumPoints: number, InParameters: NCollection_Array1_double): { OutParameters: NCollection_HArray1_double; [Symbol.dispose](): void }

    this makes sure that there is at least MinNumPoints in OutParameters taking into account the parameters in the InParameters array provided those are in order, that is the sequence of real in the InParameter is strictly non decreasing

    Parameters (2)
    • MinNumPoints
    • InParameters
    Returns

    A result object with fields:

    • OutParameters: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • FuseIntervals(Interval1: NCollection_Array1_double, Interval2: NCollection_Array1_double, Fusion: NCollection_Sequence_double, Confusion: number, IsAdjustToFirstInterval: boolean): void

    This method fuse intervals Interval1 and Interval2 with specified Confusion.

    Parameters (5)
    • Interval1
      first interval to fuse
    • Interval2
      second interval to fuse
    • Fusion
      output interval Mutated in place; read the updated value from this argument after the call.
    • Confusion
    • IsAdjustToFirstInterval
      flag to set method of fusion, if intervals are close if false, intervals are fusing by half-division method if true, intervals are fusing by selecting value from Interval1
  • EvalMaxParametricDistance(Curve: Adaptor3d_Curve, AReferenceCurve: Adaptor3d_Curve, Tolerance: number, Parameters: NCollection_Array1_double, MaxDistance: number): { MaxDistance: number }

    this will compute the maximum distance at the parameters given in the Parameters array by evaluating each parameter the two curves and taking the maximum of the evaluated distance

    Parameters (5)
    • Curve
    • AReferenceCurve
    • Tolerance
    • Parameters
    • MaxDistance
    Returns

    A result object with fields:

    • MaxDistance: updated value from the call.
  • EvalMaxDistanceAlongParameter(Curve: Adaptor3d_Curve, AReferenceCurve: Adaptor3d_Curve, Tolerance: number, Parameters: NCollection_Array1_double, MaxDistance: number): { MaxDistance: number }

    this will compute the maximum distance at the parameters given in the Parameters array by projecting from the Curve to the reference curve and taking the minimum distance Than the maximum will be taken on those minimas.

    Parameters (5)
    • Curve
    • AReferenceCurve
    • Tolerance
    • Parameters
    • MaxDistance
    Returns

    A result object with fields:

    • MaxDistance: updated value from the call.
  • CancelDenominatorDerivative(UDirection: boolean, VDirection: boolean): { BSurf: Geom_BSplineSurface; [Symbol.dispose](): void }

    Cancel,on the boundaries,the denominator first derivative in the directions wished by the user and set its value to 1.

    Parameters (2)
    • UDirection
    • VDirection
    Returns

    A result object with fields:

    • BSurf: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • NormEstim(theSurf: Geom_Surface, theUV: gp_Pnt2d, theTol: number, theNorm: gp_Dir): number

    Estimate surface normal at the given (U, V) point.

    Parameters (4)
    • theSurf
      input surface
    • theUV
      (U, V) point coordinates on the surface
    • theTol
      estimation tolerance
    • theNorm
      computed normal Mutated in place; read the updated value from this argument after the call.
    Returns

    0 if normal estimated from D1, 1 if estimated from D2 (quasysingular), >=2 in case of failure (undefined or infinite solutions)

  • IsClosed(S: Geom_Surface, Tol: number, isUClosed: boolean, isVClosed: boolean): { isUClosed: boolean; isVClosed: boolean }

    This method defines if opposite boundaries of surface coincide with given tolerance.

    Parameters (4)
    • S
    • Tol
    • isUClosed
    • isVClosed
    Returns

    A result object with fields:

    • isUClosed: updated value from the call.
    • isVClosed: updated value from the call.
  • IsBSplUClosed(S: Geom_BSplineSurface, U1: number, U2: number, Tol: number): boolean

    Returns true if the poles of U1 isoline and the poles of U2 isoline of surface are identical according to tolerance criterion. For rational surfaces Weights(i)*Poles(i) are checked.

    Parameters (4)
    • S
    • U1
    • U2
    • Tol
  • IsBSplVClosed(S: Geom_BSplineSurface, V1: number, V2: number, Tol: number): boolean

    Returns true if the poles of V1 isoline and the poles of V2 isoline of surface are identical according to tolerance criterion. For rational surfaces Weights(i)*Poles(i) are checked.

    Parameters (4)
    • S
    • V1
    • V2
    • Tol
  • IsBzUClosed(S: Geom_BezierSurface, U1: number, U2: number, Tol: number): boolean

    Returns true if the poles of U1 isoline and the poles of U2 isoline of surface are identical according to tolerance criterion.

    Parameters (4)
    • S
    • U1
    • U2
    • Tol
  • IsBzVClosed(S: Geom_BezierSurface, V1: number, V2: number, Tol: number): boolean

    Returns true if the poles of V1 isoline and the poles of V2 isoline of surface are identical according to tolerance criterion.

    Parameters (4)
    • S
    • V1
    • V2
    • Tol
  • isIsoLine(theC2D: Adaptor2d_Curve2d, theIsU: boolean, theParam: number, theIsForward: boolean): { returnValue: boolean; theIsU: boolean; theParam: number; theIsForward: boolean }

    Checks whether the 2d curve is a isoline. It can be represented by b-spline, bezier, or geometric line. This line should have natural parameterization.

    Parameters (4)
    • theC2D
      Trimmed curve to be checked.
    • theIsU
      Flag indicating that line is u const.
    • theParam
      Line parameter.
    • theIsForward
      Flag indicating forward parameterization on a isoline.
    Returns

    A result object with fields:

    • returnValue: true when 2d curve is a line and false otherwise.
    • theIsU: Flag indicating that line is u const.
    • theParam: Line parameter.
    • theIsForward: Flag indicating forward parameterization on a isoline.
  • buildC3dOnIsoLine(theC2D: Adaptor2d_Curve2d, theSurf: Adaptor3d_Surface, theFirst: number, theLast: number, theTolerance: number, theIsU: boolean, theParam: number, theIsForward: boolean): Geom_Curve

    Builds 3D curve for a isoline. This method takes corresponding isoline from the input surface.

    Parameters (8)
    • theC2D
      Trimmed curve to be approximated.
    • theSurf
    • theFirst
    • theLast
    • theTolerance
    • theIsU
      Flag indicating that line is u const.
    • theParam
      Line parameter.
    • theIsForward
      Flag indicating forward parameterization on a isoline.
    Returns

    true when 3d curve is built and false otherwise.

GeomLib_Check2dBSplineCurve

Checks for the end tangents : whether or not those are reversed.

Constructors(1)

Instance methods(4)

  • IsDone(): boolean
  • NeedTangentFix(FirstFlag: boolean, SecondFlag: boolean): { FirstFlag: boolean; SecondFlag: boolean }
    Parameters (2)
    • FirstFlag
    • SecondFlag
  • FixTangent(FirstFlag: boolean, LastFlag: boolean): void
    Parameters (2)
    • FirstFlag
    • LastFlag
  • FixedTangent(FirstFlag: boolean, LastFlag: boolean): Geom2d_BSplineCurve

    modifies the curve by fixing the first or the last tangencies
    if Index3D not in the Range [1,Nb3dSpaces] if the Approx is not Done

    Parameters (2)
    • FirstFlag
    • LastFlag

GeomLib_CheckBSplineCurve

Checks for the end tangents : whether or not those are reversed regarding the third or n-3rd control.

Constructors(1)

Instance methods(4)

  • IsDone(): boolean
  • NeedTangentFix(FirstFlag: boolean, SecondFlag: boolean): { FirstFlag: boolean; SecondFlag: boolean }
    Parameters (2)
    • FirstFlag
    • SecondFlag
  • FixTangent(FirstFlag: boolean, LastFlag: boolean): void
    Parameters (2)
    • FirstFlag
    • LastFlag
  • FixedTangent(FirstFlag: boolean, LastFlag: boolean): Geom_BSplineCurve

    modifies the curve by fixing the first or the last tangencies
    if Index3D not in the Range [1,Nb3dSpaces] if the Approx is not Done

    Parameters (2)
    • FirstFlag
    • LastFlag

GeomLib_CheckCurveOnSurface

Computes the max distance between 3D-curve and 2D-curve in some surface.

Constructors(2)

Instance methods(9)

  • Init(theCurve: Adaptor3d_Curve, theTolRange: number): void

    Sets the data for the algorithm.

    Parameters (2)
    • theCurve
    • theTolRange
  • Init(): void

    Initializes all members by default values.

  • Perform(theCurveOnSurface: Adaptor3d_CurveOnSurface): void

    Computes the max distance for the 3d curve <myCurve> and 2d curve <theCurveOnSurface> If isMultiThread == true then computation will be performed in parallel.

    Parameters (1)
    • theCurveOnSurface
  • SetParallel(theIsParallel: boolean): void

    Sets parallel flag.

    Parameters (1)
    • theIsParallel
  • IsParallel(): boolean

    Returns true if parallel flag is set.

  • IsDone(): boolean

    Returns true if the max distance has been found.

  • ErrorStatus(): number

    Returns error status The possible values are: 0 - OK; 1 - null curve or surface or 2d curve; 2 - invalid parametric range; 3 - error in calculations.

  • MaxDistance(): number

    Returns max distance.

  • MaxParameter(): number

    Returns parameter in which the distance is maximal.

GeomLib_DenominatorMultiplier

this defines an evaluator for a function of 2 variables that will be used by CancelDenominatorDerivative in one direction.

Constructors(1)

Instance methods(1)

  • Value(UParameter: number, VParameter: number): number

    Returns the value of a(UParameter,VParameter)=.
    H0(UParameter)/Denominator(Umin,Vparameter)
    D Denominator(Umin,Vparameter)

    • -----------------------------[H1(u)]/(Denominator(Umin,Vparameter)^2) D U
    • H3(UParameter)/Denominator(Umax,Vparameter)
      D Denominator(Umax,Vparameter)
    • -----------------------------[H2(u)]/(Denominator(Umax,Vparameter)^2) D U
    Parameters (2)
    • UParameter
    • VParameter

GeomLib_Interpolate

This class is used to construct a BSpline curve by interpolation of points at given parameters. The continuity of the curve is degree - 1 and the method used when boundary conditions are not given is to use odd degrees and null the derivatives on both sides from degree -1 down to (degree+1) / 2 When even degree is given the returned curve is of degree - 1 so that the degree of the curve is odd.

Constructors(1)

Instance methods(3)

GeomLib_MakeCurvefromApprox

this class is used to construct the BSpline curve from an Approximation (ApproxAFunction from AdvApprox).

Constructors(1)

Instance methods(9)

  • IsDone(): boolean
  • Nb1DSpaces(): number

    returns the number of 1D spaces of the Approx

  • Nb2DSpaces(): number

    returns the number of 3D spaces of the Approx

  • Nb3DSpaces(): number

    returns the number of 3D spaces of the Approx

  • Curve2d(Index2d: number): Geom2d_BSplineCurve

    returns a polynomial curve whose poles correspond to the Index2d 2D space if Index2d not in the Range [1,Nb2dSpaces] if the Approx is not Done

    Parameters (1)
    • Index2d
  • Curve2d(Index1d: number, Index2d: number): Geom2d_BSplineCurve

    returns a rational curve whose poles correspond to the index2d of the 2D space and whose weights correspond to one dimensional space of index 1d if Index1d not in the Range [1,Nb1dSpaces] if Index2d not in the Range [1,Nb2dSpaces] if the Approx is not Done

    Parameters (2)
    • Index1d
    • Index2d
  • Curve2dFromTwo1d(Index1d: number, Index2d: number): Geom2d_BSplineCurve

    returns a 2D curve building it from the 1D curve in x at Index1d and y at Index2d amongst the 1D curves if Index1d not in the Range [1,Nb1dSpaces] if Index2d not in the Range [1,Nb1dSpaces] if the Approx is not Done

    Parameters (2)
    • Index1d
    • Index2d
  • Curve(Index3d: number): Geom_BSplineCurve

    returns a polynomial curve whose poles correspond to the Index3D 3D space if Index3D not in the Range [1,Nb3dSpaces] if the Approx is not Done

    Parameters (1)
    • Index3d
  • Curve(Index1D: number, Index3D: number): Geom_BSplineCurve

    returns a rational curve whose poles correspond to the index3D of the 3D space and whose weights correspond to the index1d 1D space. if Index1D not in the Range [1,Nb1dSpaces] if Index3D not in the Range [1,Nb3dSpaces] if the Approx is not Done

    Parameters (2)
    • Index1D
    • Index3D

GeomLib_PolyFunc

Polynomial Function.

Constructors(1)

Instance methods(3)

  • Value(X: number, F: number): { returnValue: boolean; F: number }

    computes the value <F>of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Derivative(X: number, D: number): { returnValue: boolean; D: number }

    computes the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (2)
    • X
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • D: updated value from the call.
  • Values(X: number, F: number, D: number): { returnValue: boolean; F: number; D: number }

    computes the value <F> and the derivative <D> of the function for the variable <X>. Returns True if the calculation were successfully done, False otherwise.

    Parameters (3)
    • X
    • F
    • D
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
    • D: updated value from the call.

GeomLib_Tool

Provides various methods with Geom2d and Geom curves and surfaces. The methods of this class compute the parameter(s) of a given point on a curve or a surface. To get the valid result the point must be located rather close to the curve (surface) or at least to allow getting unambiguous result (do not put point at center of circle...), but choice of "trust" distance between curve/surface and point is responsibility of user (parameter MaxDist). Return FALSE if the point is beyond the MaxDist limit or if computation fails.

Constructors(1)

Static methods(5)

  • Parameter(Curve: Geom_Curve, Point: gp_Pnt, MaxDist: number, U: number): { returnValue: boolean; U: number }

    Extracts the parameter of a 3D point lying on a 3D curve or at a distance less than the MaxDist value.

    Parameters (4)
    • Curve
    • Point
    • MaxDist
    • U
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • U: updated value from the call.
  • Parameter(Curve: Geom2d_Curve, Point: gp_Pnt2d, MaxDist: number, U: number): { returnValue: boolean; U: number }

    Extracts the parameter of a 2D point lying on a 2D curve or at a distance less than the MaxDist value.

    Parameters (4)
    • Curve
    • Point
    • MaxDist
    • U
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • U: updated value from the call.
  • Parameters(Surface: Geom_Surface, Point: gp_Pnt, MaxDist: number, U: number, V: number): { returnValue: boolean; U: number; V: number }

    Extracts the parameter of a 3D point lying on a surface or at a distance less than the MaxDist value.

    Parameters (5)
    • Surface
    • Point
    • MaxDist
    • U
    • V
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • U: updated value from the call.
    • V: updated value from the call.
  • ComputeDeviation(theCurve: Geom2dAdaptor_Curve, theFPar: number, theLPar: number, theStartParameter: number, theNbIters: number, thePrmOnCurve: number, thePtOnCurve: gp_Pnt2d, theVecCurvLine: gp_Vec2d, theLine: gp_Lin2d): number

    Computes parameter in theCurve (*thePrmOnCurve) where maximal deviation between theCurve and the linear segment joining its points with the parameters theFPar and theLPar is obtained. Returns the (positive) value of deviation. Returns negative value if the deviation cannot be computed. The returned parameter (in case of successful) will always be in the range [theFPar, theLPar]. Iterative method is used for computation. So, theStartParameter is needed to be set. Recommend value of theStartParameter can be found with the overloaded method. Additionally, following values can be returned (optionally):

    Parameters (9)
    • theCurve
    • theFPar
    • theLPar
    • theStartParameter
    • theNbIters
    • thePrmOnCurve
      • the parameter of thePtOnCurve;
    • thePtOnCurve
      • the point on curve where maximal deviation is achieved;
    • theVecCurvLine
      • the vector along which is computed (this vector is always perpendicular theLine);
    • theLine
      • the linear segment joining the point of theCurve having parameters theFPar and theLPar.
  • ComputeDeviation(theCurve: Geom2dAdaptor_Curve, theFPar: number, theLPar: number, theNbSubIntervals: number, theNbIters: number, thePrmOnCurve: number): number

    Computes parameter in theCurve (*thePrmOnCurve) where maximal deviation between theCurve and the linear segment joining its points with the parameters theFPar and theLPar is obtained. Returns the (positive) value of deviation. Returns negative value if the deviation cannot be computed.
    The returned parameter (in case of successful) will always be in the range [theFPar, theLPar]. theNbSubIntervals defines discretization of the given interval [theFPar, theLPar] to provide better search condition. This value should be chosen taking into account complexity of the curve in considered interval. E.g. if there are many oscillations of the curve in the interval then theNbSubIntervals mus be great number.
    However, the greater value of theNbSubIntervals the slower the algorithm will compute. theNbIters sets number of iterations.
    ATTENTION!!! This algorithm cannot compute deviation precisely (so, there is no point in setting big value of theNbIters). But it can give some start point for the overloaded method.

    Parameters (6)
    • theCurve
    • theFPar
    • theLPar
    • theNbSubIntervals
    • theNbIters
    • thePrmOnCurve