# OCC.FairCurve module

class `FairCurve_Batten`(*args)

  Bases: `object`

  - 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: | P1 (gp_Pnt2d) – P2 (gp_Pnt2d) – Height (float) – Slope (float) – default value is 0
  Return type: | None

  `Compute`()
    - 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: | Code (FairCurve_AnalysisCode &) – NbIterations (int) – default value is 50 Tolerance (float) – default value is 1.0e-3
    Return type: | bool

  `Curve`()
    - Returns the computed curve a 2d BSpline.

    Return type: | Handle_Geom2d_BSplineCurve

  `Delete`()

    Return type: | void

  `DumpToString`()

    FairCurve_Batten_DumpToString(FairCurve_Batten self) -> std::string

  `GetAngle1`()
    - Returns the established first angle.

    Return type: | float

  `GetAngle2`()
    - Returns the established second angle.

    Return type: | float

  `GetConstraintOrder1`()
    - Returns the established first constraint order.

    Return type: | int

  `GetConstraintOrder2`()
    - Returns the established second constraint order.

    Return type: | int

  `GetFreeSliding`()
    - 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.

    Return type: | bool

  `GetHeight`()
    - Returns the thickness of the lathe.

    Return type: | float

  `GetP1`()
    - Returns the established location of the point P1.

    Return type: | gp_Pnt2d

  `GetP2`()
    - Returns the established location of the point P2.

    Return type: | gp_Pnt2d

  `GetSlidingFactor`()
    - Returns the initial sliding factor.

    Return type: | float

  `GetSlope`()
    - Returns the established slope value.

    Return type: | float

  `SetAngle1`()
    - Allows you to change the angle Angle1 at the first point, P1. The default setting is 0.

    Parameters: | Angle1 (float) –
    Return type: | None

  `SetAngle2`()
    - Allows you to change the angle Angle2 at the second point, P2. The default setting is 0.

    Parameters: | Angle2 (float) –
    Return type: | None

  `SetConstraintOrder1`()
    - 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: | ConstraintOrder (int) –
    Return type: | None

  `SetConstraintOrder2`()
    - 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: | ConstraintOrder (int) –
    Return type: | None

  `SetFreeSliding`()
    - 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: | FreeSliding (bool) –
    Return type: | None

  `SetHeight`()
    - Allows you to change the height of the deformation. Raises NegativeValue; – if Height <= 0 if Height <= 0

    Parameters: | Height (float) –
    Return type: | None

  `SetP1`()
    - 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: | P1 (gp_Pnt2d) –
    Return type: | None

  `SetP2`()
    - 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: | P2 (gp_Pnt2d) –
    Return type: | None

  `SetSlidingFactor`()
    - 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: | SlidingFactor (float) –
    Return type: | None

  `SetSlope`()
    - Allows you to set the slope value, Slope.

    Parameters: | Slope (float) –
    Return type: | None

  `SlidingOfReference`()
    - 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.

    Return type: | float

  `thisown`

    The membership flag

class `FairCurve_BattenLaw`(*args)

  Bases: `OCC.math.math_Function`

  - 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: | Heigth (float) – Slope (float) – Sliding (float) –
  Return type: | None

  `SetHeigth`()
    - Change the value of Heigth at the middle point.

    Parameters: | Heigth (float) –
    Return type: | None

  `SetSliding`()
    - Change the value of sliding

    Parameters: | Sliding (float) –
    Return type: | None

  `SetSlope`()
    - Change the value of the geometric slope.

    Parameters: | Slope (float) –
    Return type: | None

  `thisown`

    The membership flag

class `FairCurve_DistributionOfEnergy`(*args, **kwargs)

  Bases: `OCC.math.math_FunctionSet`

  `SetDerivativeOrder`()

    Parameters: | DerivativeOrder (int) –
    Return type: | None

  `thisown`

    The membership flag

class `FairCurve_DistributionOfJerk`(*args)

  Bases: `OCC.FairCurve.FairCurve_DistributionOfEnergy`

  Parameters: | BSplOrder (int) – FlatKnots (Handle_TColStd_HArray1OfReal &) – Poles (Handle_TColgp_HArray1OfPnt2d) – DerivativeOrder (int) – Law (FairCurve_BattenLaw &) – NbValAux (int) – default value is 0
  Return type: | None

  `thisown`

    The membership flag

class `FairCurve_DistributionOfSagging`(*args)

  Bases: `OCC.FairCurve.FairCurve_DistributionOfEnergy`

  Parameters: | BSplOrder (int) – FlatKnots (Handle_TColStd_HArray1OfReal &) – Poles (Handle_TColgp_HArray1OfPnt2d) – DerivativeOrder (int) – Law (FairCurve_BattenLaw &) – NbValAux (int) – default value is 0
  Return type: | None

  `thisown`

    The membership flag

class `FairCurve_DistributionOfTension`(*args)

  Bases: `OCC.FairCurve.FairCurve_DistributionOfEnergy`

  Parameters: | BSplOrder (int) – FlatKnots (Handle_TColStd_HArray1OfReal &) – Poles (Handle_TColgp_HArray1OfPnt2d) – DerivativeOrder (int) – LengthSliding (float) – Law (FairCurve_BattenLaw &) – NbValAux (int) – default value is 0 Uniform (bool) – default value is Standard_False
  Return type: | None

  `SetLengthSliding`()
    - change the length sliding

    Parameters: | LengthSliding (float) –
    Return type: | None

  `thisown`

    The membership flag

class `FairCurve_Energy`(*args, **kwargs)

  Bases: `OCC.math.math_MultipleVarFunctionWithHessian`

  `Poles`()
    - return the poles

    Return type: | Handle_TColgp_HArray1OfPnt2d

  `Values`()
    - 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: | X (math_Vector &) – E (float &) – G (math_Vector &) –
    Return type: | bool

    - 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: | X (math_Vector &) – E (float &) – G (math_Vector &) – H (math_Matrix &) –
    Return type: | bool

  `Variable`()
    - compute the variables <X> wich correspond with the field <MyPoles>

    Parameters: | X (math_Vector &) –
    Return type: | bool

  `thisown`

    The membership flag

class `FairCurve_EnergyOfBatten`(*args)

  Bases: `OCC.FairCurve.FairCurve_Energy`

  - Angles corresspond to the Ox axis

  Parameters: | BSplOrder (int) – FlatKnots (Handle_TColStd_HArray1OfReal &) – Poles (Handle_TColgp_HArray1OfPnt2d) – ContrOrder1 (int) – ContrOrder2 (int) – Law (FairCurve_BattenLaw &) – LengthSliding (float) – FreeSliding (bool) – default value is Standard_True Angle1 (float) – default value is 0 Angle2 (float) – default value is 0
  Return type: | None

  `LengthSliding`()
    - return the lengthSliding = P1P2 + Sliding

    Return type: | float

  `Status`()
    - return the status

    Return type: | FairCurve_AnalysisCode

  `thisown`

    The membership flag

class `FairCurve_EnergyOfMVC`(*args)

  Bases: `OCC.FairCurve.FairCurve_Energy`

  - Angles corresspond to the Ox axis

  Parameters: | BSplOrder (int) – FlatKnots (Handle_TColStd_HArray1OfReal &) – Poles (Handle_TColgp_HArray1OfPnt2d) – ContrOrder1 (int) – ContrOrder2 (int) – Law (FairCurve_BattenLaw &) – PhysicalRatio (float) – LengthSliding (float) – FreeSliding (bool) – default value is Standard_True Angle1 (float) – default value is 0 Angle2 (float) – default value is 0 Curvature1 (float) – default value is 0 Curvature2 (float) – default value is 0
  Return type: | None

  `LengthSliding`()
    - return the lengthSliding = P1P2 + Sliding

    Return type: | float

  `Status`()
    - return the status

    Return type: | FairCurve_AnalysisCode

  `thisown`

    The membership flag

class `FairCurve_MinimalVariation`(*args)

  Bases: `OCC.FairCurve.FairCurve_Batten`

  - 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: | P1 (gp_Pnt2d) – P2 (gp_Pnt2d) – Heigth (float) – Slope (float) – default value is 0 PhysicalRatio (float) – default value is 0
  Return type: | None

  `DumpToString`()

    FairCurve_MinimalVariation_DumpToString(FairCurve_MinimalVariation self) -> std::string

  `GetCurvature1`()
    - Returns the first established curvature.

    Return type: | float

  `GetCurvature2`()
    - Returns the second established curvature.

    Return type: | float

  `GetPhysicalRatio`()
    - Returns the physical ratio, or kind of energy.

    Return type: | float

  `SetCurvature1`()
    - Allows you to set a new constraint on curvature at the first point.

    Parameters: | Curvature (float) –
    Return type: | None

  `SetCurvature2`()
    - Allows you to set a new constraint on curvature at the second point.

    Parameters: | Curvature (float) –
    Return type: | None

  `SetPhysicalRatio`()
    - 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: | Ratio (float) –
    Return type: | None

  `thisown`

    The membership flag

class `FairCurve_Newton`(*args)

  Bases: `OCC.math.math_NewtonMinimum`

  - – Given the starting point StartingPoint, 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: Obsolete Constructor (because IsConverged can not be redefined with this. )

  Parameters: | F (math_MultipleVarFunctionWithHessian &) – StartingPoint (math_Vector &) – SpatialTolerance (float) – default value is 1.0e-7 CriteriumTolerance (float) – default value is 1.0e-2 NbIterations (int) – default value is 40 Convexity (float) – default value is 1.0e-6 WithSingularity (bool) – default value is Standard_True
  Return type: | None

  - 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: | F (math_MultipleVarFunctionWithHessian &) – SpatialTolerance (float) – default value is 1.0e-7 Tolerance (float) – default value is 1.0e-7 NbIterations (int) – default value is 40 Convexity (float) – default value is 1.0e-6 WithSingularity (bool) – default value is Standard_True
  Return type: | None

  `thisown`

    The membership flag

class `SwigPyIterator`(*args, **kwargs)

  Bases: `object`

  `advance`()
  `copy`()
  `decr`()
  `distance`()
  `equal`()
  `incr`()
  `next`()
  `previous`()
  `thisown`

    The membership flag

  `value`()

`register_handle`(handle, base_object)

  Inserts the handle into the base object to prevent memory corruption in certain cases