OCC.ElCLib module¶
- Purpose: Provides functions for basic geometric computations onelementary curves such as conics and lines in 2D and 3D space.This includes:- calculation of a point or derived vector on a 2D or3D curve where:- the curve is provided by the gp package, ordefined in reference form (as in the gp package),and- the point is defined by a parameter,- evaluation of the parameter corresponding to a pointon a 2D or 3D curve from gp,- various elementary computations which allow you toposition parameterized values within the period of a curve.Notes:- ElCLib stands for Elementary Curves Library.- If the curves provided by the gp package are notexplicitly parameterized, they still have an implicitparameterization, analogous to that which they inferfor the equivalent Geom or Geom2d curves.
-
class
SwigPyIterator
(*args, **kwargs)¶ Bases:
object
-
advance
()¶
-
copy
()¶
-
decr
()¶
-
distance
()¶
-
equal
()¶
-
incr
()¶
-
next
()¶
-
previous
()¶
-
thisown
¶ The membership flag
-
value
()¶
-
-
class
elclib
¶ Bases:
object
-
static
AdjustPeriodic
()¶ - Adjust U1 and U2 in the parametric range UFirst Ulast of a periodic curve, where ULast - UFirst is its period. To do this, this function: - sets U1 in the range [ UFirst, ULast ] by adding/removing the period to/from the value U1, then - sets U2 in the range [ U1, U1 + period ] by adding/removing the period to/from the value U2. Precision is used to test the equalities.
Parameters: Return type: void
-
static
CircleD1
()¶ Parameters: Return type: void
Return type: void
-
static
CircleD2
()¶ Parameters: Return type: void
Return type: void
-
static
CircleD3
()¶ Parameters: Return type: void
Return type: void
-
static
CircleDN
()¶ Parameters: Return type: Return type:
-
static
CircleParameter
()¶ Parameters: Return type: - Pos is the Axis of the Circle parametrization In the local coordinate system of the circle X (U) = Radius * Cos (U) Y (U) = Radius * Sin (U)
Parameters: Return type:
-
static
CircleValue
()¶ Parameters: Return type: Return type:
-
static
D1
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes: - the point P of parameter U, and - the first derivative vector V1 at this point. The results P and V1 are either: - a gp_Pnt point and a gp_Vec vector, for a curve in 3D space, or - a gp_Pnt2d point and a gp_Vec2d vector, for a curve in 2D space.
Parameters: - U (float) –
- L (gp_Lin2d) –
- P (gp_Pnt2d) –
- V1 (gp_Vec2d) –
- U –
- C (gp_Circ2d) –
- P –
- V1 –
- U –
- E (gp_Elips2d) –
- P –
- V1 –
- U –
- H (gp_Hypr2d) –
- P –
- V1 –
- U –
- Prb (gp_Parab2d) –
- P –
- V1 –
- U –
- L –
- P –
- V1 –
- U –
- C –
- P –
- V1 –
- U –
- E –
- P –
- V1 –
- U –
- H –
- P –
- V1 –
- U –
- Prb –
- P –
- V1 –
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
-
static
D2
()¶ - For elementary curves (circles and conics) from the gp package, computes: - the point P of parameter U, and - the first and second derivative vectors V1 and V2 at this point. The results, P, V1 and V2, are either: - a gp_Pnt point and two gp_Vec vectors, for a curve in 3D space, or - a gp_Pnt2d point and two gp_Vec2d vectors, for a curve in 2D space.
Parameters: - U (float) –
- C (gp_Circ2d) –
- P (gp_Pnt2d) –
- V1 (gp_Vec2d) –
- V2 (gp_Vec2d) –
- U –
- E (gp_Elips2d) –
- P –
- V1 –
- V2 –
- U –
- H (gp_Hypr2d) –
- P –
- V1 –
- V2 –
- U –
- Prb (gp_Parab2d) –
- P –
- V1 –
- V2 –
- U –
- C –
- P –
- V1 –
- V2 –
- U –
- E –
- P –
- V1 –
- V2 –
- U –
- H –
- P –
- V1 –
- V2 –
- U –
- Prb –
- P –
- V1 –
- V2 –
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
-
static
D3
()¶ - For elementary curves (circles, ellipses and hyperbolae) from the gp package, computes: - the point P of parameter U, and - the first, second and third derivative vectors V1, V2 and V3 at this point. The results, P, V1, V2 and V3, are either: - a gp_Pnt point and three gp_Vec vectors, for a curve in 3D space, or - a gp_Pnt2d point and three gp_Vec2d vectors, for a curve in 2D space.
Parameters: Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
- In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: void
-
static
DN
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes the vector corresponding to the Nth derivative at the point of parameter U. The result is either: - a gp_Vec vector for a curve in 3D space, or - a gp_Vec2d vector for a curve in 2D space. In the following functions N is the order of derivation and should be greater than 0
Parameters: - U (float) –
- L (gp_Lin2d) –
- N (int) –
- U –
- C (gp_Circ2d) –
- N –
- U –
- E (gp_Elips2d) –
- N –
- U –
- H (gp_Hypr2d) –
- N –
- U –
- Prb (gp_Parab2d) –
- N –
- U –
- L –
- N –
- U –
- C –
- N –
- U –
- E –
- N –
- U –
- H –
- N –
- U –
- Prb –
- N –
Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type:
-
static
EllipseD1
()¶ Parameters: Return type: void
Return type: void
-
static
EllipseD2
()¶ Parameters: Return type: void
Return type: void
-
static
EllipseD3
()¶ Parameters: Return type: void
Return type: void
-
static
EllipseDN
()¶ Parameters: Return type: Return type:
-
static
EllipseParameter
()¶ Parameters: Return type: - Pos is the Axis of the Ellipse parametrization In the local coordinate system of the Ellipse X (U) = MajorRadius * Cos (U) Y (U) = MinorRadius * Sin (U)
Parameters: Return type:
-
static
EllipseValue
()¶ Parameters: Return type: Return type:
-
static
HyperbolaD1
()¶ Parameters: Return type: void
Return type: void
-
static
HyperbolaD2
()¶ Parameters: Return type: void
Return type: void
-
static
HyperbolaD3
()¶ Parameters: Return type: void
- In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: void
-
static
HyperbolaDN
()¶ Parameters: Return type: Return type:
-
static
HyperbolaParameter
()¶ Parameters: Return type: - Pos is the Axis of the Hyperbola parametrization In the local coordinate system of the Hyperbola X (U) = MajorRadius * Ch (U) Y (U) = MinorRadius * Sh (U)
Parameters: Return type:
-
static
HyperbolaValue
()¶ Parameters: Return type: Return type:
-
static
InPeriod
()¶ - Return a value in the range <UFirst, ULast> by adding or removing the period <ULast - UFirst> to <U>.
Parameters: Return type:
-
static
LineD1
()¶ Parameters: Return type: void
Return type: void
-
static
LineDN
()¶ - In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: Return type:
-
static
LineParameter
()¶ Parameters: Return type: - parametrization P (U) = L.Location() + U * L.Direction()
Parameters: Return type:
-
static
LineValue
()¶ - Curve evaluation The following basis functions compute the derivatives on elementary curves defined by their geometric characteristics. These functions can be called without constructing a conic from package gp. They are called by the previous functions. Example : A circle is defined by its position and its radius.
Parameters: Return type: Return type:
-
static
ParabolaD1
()¶ Parameters: Return type: void
Return type: void
-
static
ParabolaD2
()¶ Parameters: Return type: void
Return type: void
-
static
ParabolaDN
()¶ Parameters: Return type: - The following functions compute the parametric value corresponding to a given point on a elementary curve. The point should be on the curve.
Parameters: Return type:
-
static
ParabolaParameter
()¶ Parameters: Return type: - Pos is the mirror axis of the parabola parametrization In the local coordinate system of the parabola Y**2 = (2*P) * X where P is the distance between the focus and the directrix. The following functions build a 3d curve from a 2d curve at a given position defined with an Ax2.
Parameters: Return type:
-
static
ParabolaValue
()¶ Parameters: Return type: Return type:
-
static
Parameter
()¶ - Computes the parameter value of the point P on the given curve. Note: In its local coordinate system, the parametric equation of the curve is given by the following: - for the line L: P(U) = Po + U*Vo where Po is the origin and Vo the unit vector of its positioning axis. - for the circle C: X(U) = Radius*Cos(U), Y(U) = Radius*Sin(U) - for the ellipse E: X(U) = MajorRadius*Cos(U). Y(U) = MinorRadius*Sin(U) - for the hyperbola H: X(U) = MajorRadius*Ch(U), Y(U) = MinorRadius*Sh(U) - for the parabola Prb: X(U) = U**2 / (2*p) Y(U) = U where p is the distance between the focus and the directrix. Warning The point P must be on the curve. These functions are not protected, however, and if point P is not on the curve, an exception may be raised.
Parameters: Return type: - parametrization P (U) = L.Location() + U * L.Direction()
Parameters: Return type: Return type: - parametrization In the local coordinate system of the circle X (U) = Radius * Cos (U) Y (U) = Radius * Sin (U)
Parameters: Return type: Return type: - parametrization In the local coordinate system of the Ellipse X (U) = MajorRadius * Cos (U) Y (U) = MinorRadius * Sin (U)
Parameters: - E (gp_Elips2d) –
- P (gp_Pnt) –
- H (gp_Hypr) –
- P –
Return type: Return type: - parametrization In the local coordinate system of the Hyperbola X (U) = MajorRadius * Ch (U) Y (U) = MinorRadius * Sh (U)
Parameters: Return type: Return type: - parametrization In the local coordinate system of the parabola Y**2 = (2*P) * X where P is the distance between the focus and the directrix.
Parameters: - Prb (gp_Parab2d) –
- P (gp_Pnt2d) –
Return type:
-
static
To3d
()¶ Parameters: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: - These functions build a 3D geometric entity from a 2D geometric entity. The ‘X Axis’ and the ‘Y Axis’ of the global coordinate system (i.e. 2D space) are lined up respectively with the ‘X Axis’ and ‘Y Axis’ of the 3D coordinate system, Pos.
Parameters: - Pos (gp_Ax2) –
- Prb (gp_Parab2d) –
Return type:
-
static
Value
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes the point of parameter U. The result is either: - a gp_Pnt point for a curve in 3D space, or - a gp_Pnt2d point for a curve in 2D space.
Parameters: - U (float) –
- L (gp_Lin2d) –
- U –
- C (gp_Circ2d) –
- U –
- E (gp_Elips2d) –
- U –
- H (gp_Hypr2d) –
- U –
- Prb (gp_Parab2d) –
- U –
- L –
- U –
- C –
- U –
- E –
- U –
- H –
- U –
- Prb –
Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type:
-
thisown
¶ The membership flag
-
static
-
elclib_AdjustPeriodic
()¶ - Adjust U1 and U2 in the parametric range UFirst Ulast of a periodic curve, where ULast - UFirst is its period. To do this, this function: - sets U1 in the range [ UFirst, ULast ] by adding/removing the period to/from the value U1, then - sets U2 in the range [ U1, U1 + period ] by adding/removing the period to/from the value U2. Precision is used to test the equalities.
Parameters: Return type: void
-
elclib_CircleD1
()¶ Parameters: Return type: void
Return type: void
-
elclib_CircleD2
()¶ Parameters: Return type: void
Return type: void
-
elclib_CircleD3
()¶ Parameters: Return type: void
Return type: void
-
elclib_CircleDN
()¶ Parameters: Return type: Return type:
-
elclib_CircleParameter
()¶ Parameters: Return type: - Pos is the Axis of the Circle parametrization In the local coordinate system of the circle X (U) = Radius * Cos (U) Y (U) = Radius * Sin (U)
Parameters: Return type:
-
elclib_CircleValue
()¶ Parameters: Return type: Return type:
-
elclib_D1
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes: - the point P of parameter U, and - the first derivative vector V1 at this point. The results P and V1 are either: - a gp_Pnt point and a gp_Vec vector, for a curve in 3D space, or - a gp_Pnt2d point and a gp_Vec2d vector, for a curve in 2D space.
Parameters: - U (float) –
- L (gp_Lin2d) –
- P (gp_Pnt2d) –
- V1 (gp_Vec2d) –
- U –
- C (gp_Circ2d) –
- P –
- V1 –
- U –
- E (gp_Elips2d) –
- P –
- V1 –
- U –
- H (gp_Hypr2d) –
- P –
- V1 –
- U –
- Prb (gp_Parab2d) –
- P –
- V1 –
- U –
- L –
- P –
- V1 –
- U –
- C –
- P –
- V1 –
- U –
- E –
- P –
- V1 –
- U –
- H –
- P –
- V1 –
- U –
- Prb –
- P –
- V1 –
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
-
elclib_D2
()¶ - For elementary curves (circles and conics) from the gp package, computes: - the point P of parameter U, and - the first and second derivative vectors V1 and V2 at this point. The results, P, V1 and V2, are either: - a gp_Pnt point and two gp_Vec vectors, for a curve in 3D space, or - a gp_Pnt2d point and two gp_Vec2d vectors, for a curve in 2D space.
Parameters: - U (float) –
- C (gp_Circ2d) –
- P (gp_Pnt2d) –
- V1 (gp_Vec2d) –
- V2 (gp_Vec2d) –
- U –
- E (gp_Elips2d) –
- P –
- V1 –
- V2 –
- U –
- H (gp_Hypr2d) –
- P –
- V1 –
- V2 –
- U –
- Prb (gp_Parab2d) –
- P –
- V1 –
- V2 –
- U –
- C –
- P –
- V1 –
- V2 –
- U –
- E –
- P –
- V1 –
- V2 –
- U –
- H –
- P –
- V1 –
- V2 –
- U –
- Prb –
- P –
- V1 –
- V2 –
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
-
elclib_D3
()¶ - For elementary curves (circles, ellipses and hyperbolae) from the gp package, computes: - the point P of parameter U, and - the first, second and third derivative vectors V1, V2 and V3 at this point. The results, P, V1, V2 and V3, are either: - a gp_Pnt point and three gp_Vec vectors, for a curve in 3D space, or - a gp_Pnt2d point and three gp_Vec2d vectors, for a curve in 2D space.
Parameters: Return type: void
Return type: void
Return type: void
Return type: void
Return type: void
- In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: void
-
elclib_DN
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes the vector corresponding to the Nth derivative at the point of parameter U. The result is either: - a gp_Vec vector for a curve in 3D space, or - a gp_Vec2d vector for a curve in 2D space. In the following functions N is the order of derivation and should be greater than 0
Parameters: - U (float) –
- L (gp_Lin2d) –
- N (int) –
- U –
- C (gp_Circ2d) –
- N –
- U –
- E (gp_Elips2d) –
- N –
- U –
- H (gp_Hypr2d) –
- N –
- U –
- Prb (gp_Parab2d) –
- N –
- U –
- L –
- N –
- U –
- C –
- N –
- U –
- E –
- N –
- U –
- H –
- N –
- U –
- Prb –
- N –
Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type:
-
elclib_EllipseD1
()¶ Parameters: Return type: void
Return type: void
-
elclib_EllipseD2
()¶ Parameters: Return type: void
Return type: void
-
elclib_EllipseD3
()¶ Parameters: Return type: void
Return type: void
-
elclib_EllipseDN
()¶ Parameters: Return type: Return type:
-
elclib_EllipseParameter
()¶ Parameters: Return type: - Pos is the Axis of the Ellipse parametrization In the local coordinate system of the Ellipse X (U) = MajorRadius * Cos (U) Y (U) = MinorRadius * Sin (U)
Parameters: Return type:
-
elclib_EllipseValue
()¶ Parameters: Return type: Return type:
-
elclib_HyperbolaD1
()¶ Parameters: Return type: void
Return type: void
-
elclib_HyperbolaD2
()¶ Parameters: Return type: void
Return type: void
-
elclib_HyperbolaD3
()¶ Parameters: Return type: void
- In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: void
-
elclib_HyperbolaDN
()¶ Parameters: Return type: Return type:
-
elclib_HyperbolaParameter
()¶ Parameters: Return type: - Pos is the Axis of the Hyperbola parametrization In the local coordinate system of the Hyperbola X (U) = MajorRadius * Ch (U) Y (U) = MinorRadius * Sh (U)
Parameters: Return type:
-
elclib_HyperbolaValue
()¶ Parameters: Return type: Return type:
-
elclib_InPeriod
()¶ - Return a value in the range <UFirst, ULast> by adding or removing the period <ULast - UFirst> to <U>.
Parameters: Return type:
-
elclib_LineD1
()¶ Parameters: Return type: void
Return type: void
-
elclib_LineDN
()¶ - In the following functions N is the order of derivation and should be greater than 0
Parameters: Return type: Return type:
-
elclib_LineParameter
()¶ Parameters: Return type: - parametrization P (U) = L.Location() + U * L.Direction()
Parameters: Return type:
-
elclib_LineValue
()¶ - Curve evaluation The following basis functions compute the derivatives on elementary curves defined by their geometric characteristics. These functions can be called without constructing a conic from package gp. They are called by the previous functions. Example : A circle is defined by its position and its radius.
Parameters: Return type: Return type:
-
elclib_ParabolaD1
()¶ Parameters: Return type: void
Return type: void
-
elclib_ParabolaD2
()¶ Parameters: Return type: void
Return type: void
-
elclib_ParabolaDN
()¶ Parameters: Return type: - The following functions compute the parametric value corresponding to a given point on a elementary curve. The point should be on the curve.
Parameters: Return type:
-
elclib_ParabolaParameter
()¶ Parameters: Return type: - Pos is the mirror axis of the parabola parametrization In the local coordinate system of the parabola Y**2 = (2*P) * X where P is the distance between the focus and the directrix. The following functions build a 3d curve from a 2d curve at a given position defined with an Ax2.
Parameters: Return type:
-
elclib_ParabolaValue
()¶ Parameters: Return type: Return type:
-
elclib_Parameter
()¶ - Computes the parameter value of the point P on the given curve. Note: In its local coordinate system, the parametric equation of the curve is given by the following: - for the line L: P(U) = Po + U*Vo where Po is the origin and Vo the unit vector of its positioning axis. - for the circle C: X(U) = Radius*Cos(U), Y(U) = Radius*Sin(U) - for the ellipse E: X(U) = MajorRadius*Cos(U). Y(U) = MinorRadius*Sin(U) - for the hyperbola H: X(U) = MajorRadius*Ch(U), Y(U) = MinorRadius*Sh(U) - for the parabola Prb: X(U) = U**2 / (2*p) Y(U) = U where p is the distance between the focus and the directrix. Warning The point P must be on the curve. These functions are not protected, however, and if point P is not on the curve, an exception may be raised.
Parameters: Return type: - parametrization P (U) = L.Location() + U * L.Direction()
Parameters: Return type: Return type: - parametrization In the local coordinate system of the circle X (U) = Radius * Cos (U) Y (U) = Radius * Sin (U)
Parameters: Return type: Return type: - parametrization In the local coordinate system of the Ellipse X (U) = MajorRadius * Cos (U) Y (U) = MinorRadius * Sin (U)
Parameters: - E (gp_Elips2d) –
- P (gp_Pnt) –
- H (gp_Hypr) –
- P –
Return type: Return type: - parametrization In the local coordinate system of the Hyperbola X (U) = MajorRadius * Ch (U) Y (U) = MinorRadius * Sh (U)
Parameters: Return type: Return type: - parametrization In the local coordinate system of the parabola Y**2 = (2*P) * X where P is the distance between the focus and the directrix.
Parameters: - Prb (gp_Parab2d) –
- P (gp_Pnt2d) –
Return type:
-
elclib_To3d
()¶ Parameters: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: - These functions build a 3D geometric entity from a 2D geometric entity. The ‘X Axis’ and the ‘Y Axis’ of the global coordinate system (i.e. 2D space) are lined up respectively with the ‘X Axis’ and ‘Y Axis’ of the 3D coordinate system, Pos.
Parameters: - Pos (gp_Ax2) –
- Prb (gp_Parab2d) –
Return type:
-
elclib_Value
()¶ - For elementary curves (lines, circles and conics) from the gp package, computes the point of parameter U. The result is either: - a gp_Pnt point for a curve in 3D space, or - a gp_Pnt2d point for a curve in 2D space.
Parameters: - U (float) –
- L (gp_Lin2d) –
- U –
- C (gp_Circ2d) –
- U –
- E (gp_Elips2d) –
- U –
- H (gp_Hypr2d) –
- U –
- Prb (gp_Parab2d) –
- U –
- L –
- U –
- C –
- U –
- E –
- U –
- H –
- U –
- Prb –
Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type: Return type:
-
new_instancemethod
(func, inst, cls)¶
-
register_handle
(handle, base_object)¶ Inserts the handle into the base object to prevent memory corruption in certain cases