OpenCascade.js
API ReferenceModelingAlgorithmsTKGeomAlgo

FairCurve

OCCT package FairCurve: FairCurve_AnalysisCode, FairCurve_Batten, FairCurve_BattenLaw, FairCurve_DistributionOfEnergy, and 8 more bound classes.

FairCurve_Batten

Constructs curves with a constant or linearly increasing section to be used in the design of wooden or plastic battens. These curves are two-dimensional, and simulate physical splines or battens.

Constructors(1)

  • constructor(P1: gp_Pnt2d, P2: gp_Pnt2d, Height: number, Slope?: number): FairCurve_Batten

    Constructor with the two points and the geometrical characteristics of the batten (elastic beam) Height is the height of the deformation, and Slope is the slope value, initialized at 0. The user can then supply the desired slope value by the method, SetSlope. Other parameters are initialized as follow :

    • FreeSliding = False
    • ConstraintOrder1 = 1
    • ConstraintOrder2 = 1
    • Angle1 = 0
    • Angle2 = 0
    • SlidingFactor = 1 Exceptions NegativeValue if Height is less than or equal to 0. NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.
    Parameters (4)
    • P1
    • P2
    • Height
    • Slope

Instance methods(23)

  • SetFreeSliding(FreeSliding: boolean): void

    Freesliding is initialized with the default setting false. When Freesliding is set to true and, as a result, sliding is free, the sliding factor is automatically computed to satisfy the equilibrium of the batten.

    Parameters (1)
    • FreeSliding
  • SetConstraintOrder1(ConstraintOrder: number): void

    Allows you to change the order of the constraint on the first point. ConstraintOrder has the default setting of 1. The following settings are available:

    • 0-the curve must pass through a point
    • 1-the curve must pass through a point and have a given tangent
    • 2-the curve must pass through a point, have a given tangent and a given curvature. The third setting is only valid for FairCurve_MinimalVariation curves. These constraints, though geometric, represent the mechanical constraints due, for example, to the resistance of the material the actual physical batten is made of.
    Parameters (1)
    • ConstraintOrder
  • SetConstraintOrder2(ConstraintOrder: number): void

    Allows you to change the order of the constraint on the second point. ConstraintOrder is initialized with the default setting of 1. The following settings are available:

    • 0-the curve must pass through a point
    • 1-the curve must pass through a point and have a given tangent
    • 2-the curve must pass through a point, have a given tangent and a given curvature. The third setting is only valid for FairCurve_MinimalVariation curves. These constraints, though geometric, represent the mechanical constraints due, for example, to the resistance of the material the actual physical batten is made of.
    Parameters (1)
    • ConstraintOrder
  • SetP1(P1: gp_Pnt2d): void

    Allows you to change the location of the point, P1, and in doing so, modify the curve. Warning This method changes the angle as well as the point. Exceptions NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.

    Parameters (1)
    • P1
  • SetP2(P2: gp_Pnt2d): void

    Allows you to change the location of the point, P1, and in doing so, modify the curve. Warning This method changes the angle as well as the point. Exceptions NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case.

    Parameters (1)
    • P2
  • SetAngle1(Angle1: number): void

    Allows you to change the angle Angle1 at the first point, P1. The default setting is 0.

    Parameters (1)
    • Angle1
  • SetAngle2(Angle2: number): void

    Allows you to change the angle Angle2 at the second point, P2. The default setting is 0.

    Parameters (1)
    • Angle2
  • SetHeight(Height: number): void

    Allows you to change the height of the deformation. Raises NegativeValue; - if Height <= 0 if Height <= 0.

    Parameters (1)
    • Height
  • SetSlope(Slope: number): void

    Allows you to set the slope value, Slope.

    Parameters (1)
    • Slope
  • SetSlidingFactor(SlidingFactor: number): void

    Allows you to change the ratio SlidingFactor. This compares the length of the batten and the reference length, which is, in turn, a function of the constraints. This modification has one of the following two effects:

    • if you increase the value, it inflates the batten
    • if you decrease the value, it flattens the batten. When sliding is free, the sliding factor is automatically computed to satisfy the equilibrium of the batten. When sliding is imposed, a value is required for the sliding factor. SlidingFactor is initialized with the default setting of 1.
    Parameters (1)
    • SlidingFactor
  • Compute(Code: FairCurve_AnalysisCode, NbIterations: number, Tolerance: number): { returnValue: boolean; Code: FairCurve_AnalysisCode }

    Performs the algorithm, using the arguments Code, NbIterations and Tolerance and computes the curve with respect to the constraints. Code will have one of the following values:

    • OK
    • NotConverged
    • InfiniteSliding
    • NullHeight The parameters Tolerance and NbIterations control how precise the computation is, and how long it will take.
    Parameters (3)
    • Code
    • NbIterations
    • Tolerance
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • Code: updated value from the call.
  • Computes the real number value for length Sliding of Reference for new constraints. If you want to give a specific length to a batten curve, use the following syntax: b.SetSlidingFactor(L / b.SlidingOfReference()) where b is the name of the batten curve object.

  • GetFreeSliding(): boolean

    Returns the initial free sliding value, false by default. Free sliding is generally more aesthetically pleasing than constrained sliding. However, the computation can fail with values such as angles greater than PI/2. This is because the resulting batten length is theoretically infinite.

  • Returns the established first constraint order.

  • Returns the established second constraint order.

  • Returns the established location of the point P1.

  • Returns the established location of the point P2.

  • GetAngle1(): number

    Returns the established first angle.

  • GetAngle2(): number

    Returns the established second angle.

  • GetHeight(): number

    Returns the thickness of the lathe.

  • GetSlope(): number

    Returns the established slope value.

  • Returns the initial sliding factor.

  • Returns the computed curve a 2d BSpline.

FairCurve_BattenLaw

This class compute the Heigth of an batten.

Constructors(1)

  • constructor(Heigth: number, Slope: number, Sliding: number): FairCurve_BattenLaw

    Constructor of linear batten with Heigth : the Heigth at the middle point Slope : the geometric slope of the batten Sliding : Active Length of the batten without extension.

    Parameters (3)
    • Heigth
    • Slope
    • Sliding

Instance methods(4)

  • SetSliding(Sliding: number): void

    Change the value of sliding.

    Parameters (1)
    • Sliding
  • SetHeigth(Heigth: number): void

    Change the value of Heigth at the middle point.

    Parameters (1)
    • Heigth
  • SetSlope(Slope: number): void

    Change the value of the geometric slope.

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

    computes the value of the heigth for the parameter T on the neutral fibber

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

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

FairCurve_DistributionOfJerk

Compute the "Jerk" distribution.

Constructors(1)

Instance methods(1)

  • Value(X: math_Vector, F: math_Vector): boolean

    computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F

FairCurve_DistributionOfSagging

Compute the Sagging Distribution.

Constructors(1)

Instance methods(1)

  • Value(X: math_Vector, F: math_Vector): boolean

    computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F

FairCurve_DistributionOfTension

Compute the Tension Distribution.

Constructors(1)

Instance methods(2)

  • SetLengthSliding(LengthSliding: number): void

    change the length sliding

    Parameters (1)
    • LengthSliding
  • Value(X: math_Vector, F: math_Vector): boolean

    computes the values <F> of the functions for the variable <X>. returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F

FairCurve_Energy

necessary methodes to compute the energy of an FairCurve.

Instance methods(7)

  • NbVariables(): number

    returns the number of variables of the energy.

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

    computes the values of the Energys E for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • F
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Gradient(X: math_Vector, G: math_Vector): boolean

    computes the gradient <G> of the energys for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (2)
    • X
    • G
  • Values(X: math_Vector, F: number, G: math_Vector): { returnValue: boolean; F: number }

    computes the Energy <E> and the gradient <G> of the energy for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (3)
    • X
    • F
    • G
    Returns

    A result object with fields:

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

    computes the Energy <E>, the gradient <G> and the Hessian <H> of the energy for the variable <X>. Returns True if the computation was done successfully, False otherwise.

    Parameters (4)
    • X
    • F
    • G
    • H
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • F: updated value from the call.
  • Variable(X: math_Vector): boolean

    compute the variables <X> which correspond with the field <MyPoles>

    Parameters (1)
    • X
  • return the poles

FairCurve_EnergyOfBatten

Energy Criterium to minimize in Batten.

Constructors(1)

Instance methods(3)

FairCurve_EnergyOfMVC

Energy Criterium to minimize in MinimalVariationCurve.

Constructors(1)

Instance methods(3)

FairCurve_MinimalVariation

Computes a 2D curve using an algorithm which minimizes tension, sagging, and jerk energy. As in FairCurve_Batten, two reference points are used. Unlike that class, FairCurve_MinimalVariation requires curvature settings at the first and second reference points. These are defined by the rays of curvature desired at each point.

Constructors(1)

  • constructor(P1: gp_Pnt2d, P2: gp_Pnt2d, Heigth: number, Slope?: number, PhysicalRatio?: number): FairCurve_MinimalVariation

    Constructs the two contact points P1 and P2 and the geometrical characteristics of the batten (elastic beam) These include the real number values for height of deformation Height, slope value Slope, and kind of energy PhysicalRatio. The kinds of energy include:

    • Jerk (0)
    • Sagging (1). Note that the default setting for Physical Ration is in FairCurve_Batten Other parameters are initialized as follow :
    • FreeSliding = False
    • ConstraintOrder1 = 1
    • ConstraintOrder2 = 1
    • Angle1 = 0
    • Angle2 = 0
    • Curvature1 = 0
    • Curvature2 = 0
    • SlidingFactor = 1 Warning If PhysicalRatio equals 1, you cannot impose constraints on curvature. Exceptions NegativeValue if Height is less than or equal to 0. NullValue if the distance between P1 and P2 is less than or equal to the tolerance value for distance in Precision::Confusion: P1.IsEqual(P2, Precision::Confusion()). The function gp_Pnt2d::IsEqual tests to see if this is the case. Definition of the geometricals constraints
    Parameters (5)
    • P1
    • P2
    • Heigth
    • Slope
    • PhysicalRatio

Instance methods(7)

  • SetCurvature1(Curvature: number): void

    Allows you to set a new constraint on curvature at the first point.

    Parameters (1)
    • Curvature
  • SetCurvature2(Curvature: number): void

    Allows you to set a new constraint on curvature at the second point.

    Parameters (1)
    • Curvature
  • SetPhysicalRatio(Ratio: number): void

    Allows you to set the physical ratio Ratio. The kinds of energy which you can specify include: 0 is only "Jerk" Energy 1 is only "Sagging" Energy like batten Warning: if Ratio is 1 it is impossible to impose curvature constraints. Raises DomainError if Ratio < 0 or Ratio > 1.

    Parameters (1)
    • Ratio
  • Compute(Code: FairCurve_AnalysisCode, NbIterations: number, Tolerance: number): { returnValue: boolean; Code: FairCurve_AnalysisCode }

    Computes the curve with respect to the constraints, NbIterations and Tolerance. The tolerance setting allows you to control the precision of computation, and the maximum number of iterations allows you to set a limit on computation time.

    Parameters (3)
    • Code
    • NbIterations
    • Tolerance
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • Code: updated value from the call.
  • GetCurvature1(): number

    Returns the first established curvature.

  • GetCurvature2(): number

    Returns the second established curvature.

  • Returns the physical ratio, or kind of energy.

FairCurve_Newton

math_NewtonMinimum

Algorithm of Optimization used to make "FairCurve".

Constructors(1)

  • constructor(theFunction: math_MultipleVarFunctionWithHessian, theSpatialTolerance?: number, theCriteriumTolerance?: number, theNbIterations?: number, theConvexity?: number, theWithSingularity?: boolean): FairCurve_Newton

    The tolerance required on the solution is given by Tolerance. Iteration are stopped if (!WithSingularity) and H(F(Xi)) is not definite positive (if the smaller eigenvalue of H < Convexity) or IsConverged() returns True for 2 successives Iterations. Warning: This constructor do not computation.

    Parameters (6)
    • theFunction
    • theSpatialTolerance
    • theCriteriumTolerance
    • theNbIterations
    • theConvexity
    • theWithSingularity

Instance methods(1)

  • IsConverged(): boolean

    This method is called at the end of each iteration to check the convergence: || Xi+1 - Xi || < SpatialTolerance/100 Or || Xi+1 - Xi || < SpatialTolerance and |F(Xi+1) - F(Xi)| < CriteriumTolerance * |F(xi)| It can be redefined in a sub-class to implement a specific test.