GProp
OCCT package GProp: GProp, GProp_CelGProps, GProp_GProps, GProp_PEquation, and 6 more bound classes.
GProp
This package defines algorithms to compute the global properties of a set of points, a curve, a surface, a solid (non infinite region of space delimited with geometric entities), a compound geometric system (heterogeneous composition of the previous entities).
Global properties are: . length, area, volume, . centre of mass, . axis of inertia, . moments of inertia, . radius of gyration.
It provides also a class to compile the average point or line of a set of points.
Constructors(1)
- constructor(): GProp
Static methods(1)
methods of package Computes the matrix Operator, referred to as the "Huyghens Operator" of a geometric system at the point Q of the space, using the following data:
- Mass, i.e. the mass of the system,
- G, the center of mass of the system. The "Huyghens Operator" is used to compute Inertia/Q, the matrix of inertia of the system at the point Q using Huyghens' theorem: Inertia/Q = Inertia/G + HOperator (Q, G, Mass) where Inertia/G is the matrix of inertia of the system relative to its center of mass as returned by the function MatrixOfInertia on any
GProp_GPropsobject.
Parameters (4)GQMassOperator—Mutated in place; read the updated value from this argument after the call.
GProp_CelGProps
Computes the global properties of bounded curves in 3D space. Supports elementary curves from the gp package: Lin, Circ, Elips, Parab.
Constructors(4)
- constructor(C: gp_Circ, CLocation: gp_Pnt): GProp_CelGPropsParameters (2)
CCLocation
- constructor(C: gp_Circ, U1: number, U2: number, CLocation: gp_Pnt): GProp_CelGPropsParameters (4)
CU1U2CLocation
- constructor(C: gp_Lin, U1: number, U2: number, CLocation: gp_Pnt): GProp_CelGPropsParameters (4)
CU1U2CLocation
Instance methods(3)
- SetLocation(CLocation: gp_Pnt): voidParameters (1)
CLocation
- Parameters (3)
CU1U2
- Parameters (3)
CU1U2
GProp_GProps
Implements a general mechanism to compute the global properties of a "compound geometric system" in 3D space by composition of the global properties of elementary geometric entities such as a curve, surface, solid, or set of points. It is also possible to compose the properties of several "compound geometric systems".
To compute the global properties of a compound geometric system:
- declare a
GProp_GPropsusing a constructor which initializes the instance and defines the location point used to compute the inertia, - compose the global properties of the geometric components into the system using the method
Add().
To compute the global properties of the geometric components of the system, use the services of the following frameworks: GProp_PGPropsfor a set of points,- CGProps for a curve,
- SGProps for a surface,
- VGProps for a "solid". The CGProps, SGProps and VGProps frameworks are generic and must be instantiated for the application (see
BRepGProp/ GeomGProp).
The global properties computed are: - the dimension (length, area or volume),
- the mass,
- the centre of mass,
- the moments of inertia (static moments and quadratic moments),
- the moment about an axis,
- the radius of gyration about an axis,
- the principal properties of inertia (see
GProp_PrincipalProps):the principal moments,the principal axes of inertia,the principal radii of gyration.
Example:
Constructors(2)
The origin (0, 0, 0) of the absolute Cartesian coordinate system is used to compute the global properties.
- constructor(SystemLocation: gp_Pnt): GProp_GProps
The point SystemLocation is used to compute the global properties of the system. For greater accuracy, define this point close to the location of the system; for example a point near the centre of mass of the system.
At initialization the framework is empty: it retains no dimensional information such as mass or inertia. It is, however, ready to bring together global properties of various other systems whose global properties have already been computed using another framework. To do this, useAdd()to define the components of the system, once per component, and then use the interrogation functions to access the computed values.Parameters (1)SystemLocation—reference point of the system used for inertia accumulation
Instance methods(8)
- Add(Item: GProp_GProps, Density?: number): void
Either:
- initializes the global properties retained by this framework from those retained by the framework Item, or
- brings together the global properties retained by this framework with those retained by the framework Item.
The value Density (1.0 by default) is used as the density of the system analysed by Item.
Sometimes the density has already been accounted for at construction time of Item - for example when Item is aGProp_PGPropsframework built to compute the global properties of a set of weighted points, or anotherGProp_GPropsobject that already retains composite global properties. In these cases the real density was already taken into account at construction of Item.
Note that this is not checked: if the density of parts of the system is taken into account two or more times, the result of the computation will be wrong.
Notes: - The reference point of Item may differ from the reference point of this framework. Huygens' theorem is applied automatically to transfer inertia values to the reference point of this framework.
Add()is used once per component of the system. After all components are composed, the interrogation functions return values for the system as a whole.- The system whose global properties have been brought together by this framework is referred to as the "current system". The current system itself is not retained: only its global properties are.
Parameters (2)Item—framework holding the global properties of the component to composeDensity—density of the component (default 1.0)
- Mass(): number
Returns the mass of the current system.
If no density has been attached to the components of the current system, the returned value corresponds to:- the total length of the edges of the current system if this framework retains only linear properties (for example, when using only LinearProperties() to combine properties of lines from shapes), or
- the total area of the faces of the current system if this framework retains only surface properties (for example, when using only SurfaceProperties() to combine properties of surfaces from shapes), or
- the total volume of the solids of the current system if this framework retains only volume properties (for example, when using only VolumeProperties() to combine properties of volumes from solids).
RemarksWarning: A length, an area or a volume is computed in the current unit system. The mass of a single object is its length, area or volume multiplied by its density. Be consistent with respect to the units used.
Returns the centre of mass of the current system. With a uniform gravitational field this is also the centre of gravity. The coordinates returned for the centre of mass are expressed in the absolute Cartesian coordinate system.
Returns the matrix of inertia. It is a symmetric matrix whose coefficients are the quadratic moments of inertia:
Ixx, Iyy, Izz are the moments of inertia; Ixy, Ixz, Iyz are the products of inertia.
The matrix of inertia is returned in the central coordinate system (G, Gx, Gy, Gz), where G is the centre of mass of the system and Gx, Gy, Gz are parallel to the X(1, 0, 0), Y(0, 1, 0) and Z(0, 0, 1) directions of the absolute Cartesian coordinate system. To compute the matrix of inertia at another location useGProp::HOperator()(Huygens' theorem).- StaticMoments(Ix: number, Iy: number, Iz: number): { Ix: number; Iy: number; Iz: number }
Returns the static moments of inertia of the current system - i.e. the moments of inertia about the three axes of the absolute Cartesian coordinate system.
Parameters (3)Ix—static moment of inertia about XIy—static moment of inertia about YIz—static moment of inertia about Z
ReturnsA result object with fields:
Ix: static moment of inertia about XIy: static moment of inertia about YIz: static moment of inertia about Z
- MomentOfInertia(A: gp_Ax1): number
Computes the moment of inertia of the system about the axis A.
Parameters (1)A—axis about which the moment of inertia is computed
Computes the principal properties of inertia of the current system. There is always a set of axes for which the products of inertia of a geometric system are equal to 0 - i.e. the matrix of inertia of the system is diagonal. These axes are the principal axes of inertia; their origin coincides with the centre of mass of the system. The associated moments are called the principal moments of inertia.
This function computes the eigen values and eigen vectors of the matrix of inertia of the system. Results are stored in aGProp_PrincipalPropsframework which can be queried to access the value sought.- RadiusOfGyration(A: gp_Ax1): number
Returns the radius of gyration of the current system about the axis A.
Parameters (1)A—axis about which the radius of gyration is computed
GProp_PEquation
Analyzes a collection of 3D points to decide whether they are coincident, collinear, coplanar, or span 3D space, within a given tolerance.
Uses principal-axis analysis (eigendecomposition of the inertia matrix) to determine the dimensionality of the cloud. Depending on the result type, the corresponding accessor (Point(), Line(), Plane() or Box()) returns the fitted geometric entity.
The raw PCA results (Barycentre(), PrincipalAxis(), Extent()) are always available regardless of the fitted type.
Constructors(1)
- constructor(thePnts: NCollection_Array1_gp_Pnt, theTol: number): GProp_PEquation
Constructs the analysis from a set of points and a tolerance.
Parameters (2)thePnts—array of points to analyzetheTol—tolerance for dimensional collapse detection
Instance methods(12)
- GetType(): GProp_PEquation_Type
Returns the type of the fitted entity.
- IsPlanar(): boolean
Returns true if points are coplanar within tolerance.
- IsLinear(): boolean
Returns true if points are collinear within tolerance.
- IsPoint(): boolean
Returns true if points are coincident within tolerance.
- IsSpace(): boolean
Returns true if points span 3D space.
Returns the mean plane.
Returns the mean line.
Returns the mean point.
Returns a bounding box aligned with the principal axes.
Parameters (4)theP—corner of the box (minimum projection on principal axes) Mutated in place; read the updated value from this argument after the call.theV1—first box edge vector (along first principal axis) Mutated in place; read the updated value from this argument after the call.theV2—second box edge vector (along second principal axis) Mutated in place; read the updated value from this argument after the call.theV3—third box edge vector (along third principal axis) Mutated in place; read the updated value from this argument after the call.
- Barycentre(): gp_Pnt
Returns the centre of mass of the cloud (always valid after construction).
- PrincipalAxis(theIndex: number): gp_Vec
Returns the unit principal axis at
theIndex(1, 2 or 3), ordered by eigenvalue.Parameters (1)theIndex
- Extent(theIndex: number): number
Returns the extent (max - min projection) along principal axis
theIndex(1, 2 or 3).Parameters (1)theIndex
GProp_PGProps
Computes global properties (mass, barycentre, inertia matrix) of a weighted set of 3D points.
Each point carries a mass; by default the mass is unit. Contributions are accumulated incrementally via AddPoint() or from arrays passed to a constructor. As a GProp_GProps subclass, an instance can be composed into a larger system via GProp_GProps::Add().
Inertia is accumulated at the absolute origin and stored in the inherited GProp_GProps::inertia member, matching the legacy contract of this class.
Constructors(5)
Creates an empty point set, located at the origin, with zero mass.
- constructor(thePnts: NCollection_Array1_gp_Pnt): GProp_PGProps
Creates a point set from an array of points (unit mass each).
Parameters (1)thePnts
- constructor(thePnts: NCollection_Array2_gp_Pnt): GProp_PGProps
Creates a point set from a 2D array of points (unit mass each).
Parameters (1)thePnts
- constructor(thePnts: NCollection_Array1_gp_Pnt, theDensity: NCollection_Array1_double): GProp_PGProps
Creates a point set from points and corresponding densities.
Parameters (2)thePnts—point arraytheDensity—per-point mass array (same length as thePnts)
- constructor(thePnts: NCollection_Array2_gp_Pnt, theDensity: NCollection_Array2_double): GProp_PGProps
Creates a point set from 2D arrays of points and corresponding densities.
Parameters (2)thePnts—point arraytheDensity—per-point mass array (same dimensions as thePnts)
Static methods(4)
- Barycentre(thePnts: NCollection_Array1_gp_Pnt): gp_Pnt
Computes the barycentre of a set of points (unit mass).
Parameters (1)thePnts
- Barycentre(thePnts: NCollection_Array2_gp_Pnt): gp_Pnt
Computes the barycentre of a 2D array of points (unit mass).
Parameters (1)thePnts
- Barycentre(thePnts: NCollection_Array1_gp_Pnt, theDensity: NCollection_Array1_double, theMass: number, theG: gp_Pnt): { theMass: number }
Computes the weighted barycentre and total mass of a set of points.
Parameters (4)thePnts—point arraytheDensity—per-point mass arraytheMass—total mass (sum of densities)theG—weighted barycentre Mutated in place; read the updated value from this argument after the call.
ReturnsA result object with fields:
theMass: total mass (sum of densities)
- Barycentre(thePnts: NCollection_Array2_gp_Pnt, theDensity: NCollection_Array2_double, theMass: number, theG: gp_Pnt): { theMass: number }
Computes the weighted barycentre and total mass of a set of points.
Parameters (4)thePnts—point arraytheDensity—per-point mass arraytheMass—total mass (sum of densities)theG—weighted barycentre Mutated in place; read the updated value from this argument after the call.
ReturnsA result object with fields:
theMass: total mass (sum of densities)
Instance methods(2)
Adds a point with unit mass.
Parameters (1)thePnt
Adds a point with a given mass.
Parameters (2)thePnttheDensity
GProp_PrincipalProps
A framework to present the principal properties of inertia of a system of which global properties are computed by a GProp_GProps object.
There is always a set of axes for which the products of inertia of a geometric system are equal to 0; i.e. the matrix of inertia of the system is diagonal. These axes are the principal axes of inertia. Their origin is coincident with the center of mass of the system. The associated moments are called the principal moments of inertia.
This sort of presentation object is created, filled and returned by the function PrincipalProperties for any GProp_GProps object, and can be queried to access the result.
Note: The system whose principal properties of inertia are returned by this framework is referred to as the current system.
The current system, however, is retained neither by this presentation framework nor by the GProp_GProps object which activates it.
Constructors(1)
creates an undefined PrincipalProps.
Instance methods(9)
- HasSymmetryAxis(): boolean
returns true if the geometric system has an axis of symmetry. For comparing moments relative tolerance 1.e-10 is used. Usually it is enough for objects, restricted by faces with analytical geometry.
- HasSymmetryAxis(aTol: number): boolean
returns true if the geometric system has an axis of symmetry. aTol is relative tolerance for checking equality of moments If aTol == 0, relative tolerance is ~ 1.e-16 (Epsilon(I))
Parameters (1)aTol
- HasSymmetryPoint(): boolean
returns true if the geometric system has a point of symmetry. For comparing moments relative tolerance 1.e-10 is used. Usually it is enough for objects, restricted by faces with analytical geometry.
- HasSymmetryPoint(aTol: number): boolean
returns true if the geometric system has a point of symmetry. aTol is relative tolerance for checking equality of moments If aTol == 0, relative tolerance is ~ 1.e-16 (Epsilon(I))
Parameters (1)aTol
- Moments(Ixx: number, Iyy: number, Izz: number): { Ixx: number; Iyy: number; Izz: number }
Ixx, Iyy and Izz return the principal moments of inertia in the current system. Notes :
- If the current system has an axis of symmetry, two of the three values Ixx, Iyy and Izz are equal. They indicate which eigen vectors define an infinity of axes of principal inertia.
- If the current system has a center of symmetry, Ixx, Iyy and Izz are equal.
Parameters (3)IxxIyyIzz
ReturnsA result object with fields:
Ixx: updated value from the call.Iyy: updated value from the call.Izz: updated value from the call.
returns the first axis of inertia.
if the system has a point of symmetry there is an infinity of solutions. It is not possible to defines the three axis of inertia.returns the second axis of inertia.
if the system has a point of symmetry or an axis of symmetry the second and the third axis of symmetry are undefined.returns the third axis of inertia. This and the above functions return the first, second or third eigen vector of the matrix of inertia of the current system. The first, second and third principal axis of inertia pass through the center of mass of the current system. They are respectively parallel to these three eigen vectors. Note that:
- If the current system has an axis of symmetry, any axis is an axis of principal inertia if it passes through the center of mass of the system, and runs parallel to a linear combination of the two eigen vectors of the matrix of inertia, corresponding to the two eigen values which are equal.
If the current system has a center of symmetry, any axis passing through the center of mass of the system is an axis of principal inertia.
Use the functions HasSymmetryAxis and HasSymmetryPoint to check these particular cases, where the returned eigen vectors define an infinity of principal axis of inertia. - The Moments function can be used to know which of the three eigen vectors corresponds to the two eigen values which are equal.
if the system has a point of symmetry or an axis of symmetry the second and the third axis of symmetry are undefined.
- If the current system has an axis of symmetry, any axis is an axis of principal inertia if it passes through the center of mass of the system, and runs parallel to a linear combination of the two eigen vectors of the matrix of inertia, corresponding to the two eigen values which are equal.
- RadiusOfGyration(Rxx: number, Ryy: number, Rzz: number): { Rxx: number; Ryy: number; Rzz: number }
Returns the principal radii of gyration Rxx, Ryy and Rzz are the radii of gyration of the current system about its three principal axes of inertia. Note that:
- If the current system has an axis of symmetry, two of the three values Rxx, Ryy and Rzz are equal.
- If the current system has a center of symmetry, Rxx, Ryy and Rzz are equal.
Parameters (3)RxxRyyRzz
ReturnsA result object with fields:
Rxx: updated value from the call.Ryy: updated value from the call.Rzz: updated value from the call.
GProp_SelGProps
Computes the global properties of a bounded elementary surface in 3D (surfaces from the gp package: Cylinder, Cone, Sphere, Torus).
Constructors(5)
- constructor(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number, SLocation: gp_Pnt): GProp_SelGPropsParameters (6)
SAlpha1Alpha2Z1Z2SLocation
- constructor(S: gp_Cone, Alpha1: number, Alpha2: number, Z1: number, Z2: number, SLocation: gp_Pnt): GProp_SelGPropsParameters (6)
SAlpha1Alpha2Z1Z2SLocation
- constructor(S: gp_Sphere, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number, SLocation: gp_Pnt): GProp_SelGPropsParameters (6)
STeta1Teta2Alpha1Alpha2SLocation
- constructor(S: gp_Torus, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number, SLocation: gp_Pnt): GProp_SelGPropsParameters (6)
STeta1Teta2Alpha1Alpha2SLocation
Instance methods(5)
- SetLocation(SLocation: gp_Pnt): voidParameters (1)
SLocation
- Perform(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number): voidParameters (5)
SAlpha1Alpha2Z1Z2
- Parameters (5)
SAlpha1Alpha2Z1Z2
- Parameters (5)
STeta1Teta2Alpha1Alpha2
- Parameters (5)
STeta1Teta2Alpha1Alpha2
GProp_UndefinedAxis
Constructors(2)
- constructor(theMessage: string): GProp_UndefinedAxisParameters (1)
theMessage
- constructor(theMessage: string, theStackTrace: string): GProp_UndefinedAxisParameters (2)
theMessagetheStackTrace
Instance methods(1)
- ExceptionType(): string
GProp_ValueType
Properties(11)
GProp_VelGProps
Computes the global properties and the volume of a geometric solid (3D closed region of space). Supports elementary solids from the gp package: Cylinder, Cone, Sphere, Torus.
Constructors(5)
- constructor(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number, VLocation: gp_Pnt): GProp_VelGPropsParameters (6)
SAlpha1Alpha2Z1Z2VLocation
- constructor(S: gp_Cone, Alpha1: number, Alpha2: number, Z1: number, Z2: number, VLocation: gp_Pnt): GProp_VelGPropsParameters (6)
SAlpha1Alpha2Z1Z2VLocation
- constructor(S: gp_Sphere, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number, VLocation: gp_Pnt): GProp_VelGPropsParameters (6)
STeta1Teta2Alpha1Alpha2VLocation
- constructor(S: gp_Torus, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number, VLocation: gp_Pnt): GProp_VelGPropsParameters (6)
STeta1Teta2Alpha1Alpha2VLocation
Instance methods(5)
- SetLocation(VLocation: gp_Pnt): voidParameters (1)
VLocation
- Perform(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number): voidParameters (5)
SAlpha1Alpha2Z1Z2
- Parameters (5)
SAlpha1Alpha2Z1Z2
- Parameters (5)
STeta1Teta2Alpha1Alpha2
- Parameters (5)
STeta1Teta2Alpha1Alpha2