OpenCascade.js
API ReferenceModelingDataTKGeomBase

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)

Static methods(1)

  • HOperator(G: gp_Pnt, Q: gp_Pnt, Mass: number, Operator: gp_Mat): void

    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_GProps object.
    Parameters (4)
    • G
    • Q
    • Mass
    • Operator
      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)

Instance methods(3)

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_GProps using 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_PGProps for 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:
//DeclarestheGProps;theabsoluteorigin(0,0,0)isusedasthe //defaultreferencepointtocomputethecentreofmass. GProp_GPropsaSystem; //Computestheinertiaofa3Dcurve. Your_CGPropsaComponent1(theCurve,...); //Computestheinertiaoftwosurfaces.Your_SGPropsaComponent2(theSurface1,...); Your_SGPropsaComponent3(theSurface2,...); //Composestheglobalpropertiesofcomponents1,2,3.Adensity //canbeassociatedwiththecomponents;itdefaultsto1.0. constdoubleaDensity1=2.0; constdoubleaDensity2=3.0; aSystem.Add(aComponent1,aDensity1); aSystem.Add(aComponent2,aDensity2); aSystem.Add(aComponent3); //Returnsthecentreofmassofthesystemintheabsolute //Cartesiancoordinatesystem. constgp_PntaG=aSystem.CentreOfMass(); //Computestheprincipalpropertiesofinertiaofthesystem. constGProp_PrincipalPropsaPp=aSystem.PrincipalProperties(); //Returnstheprincipalmomentsandradiiofgyration. doubleaIxx,aIyy,aIzz,aRxx,aRyy,aRzz; aPp.Moments(aIxx,aIyy,aIzz); aPp.RadiusOfGyration(aRxx,aRyy,aRzz);

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, use Add() 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 a GProp_PGProps framework built to compute the global properties of a set of weighted points, or another GProp_GProps object 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 compose
    • Density
      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).
    Remarks

    Warning: 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 Ixy Ixz | matrix = | Ixy Iyy Iyz | | Ixz Iyz Izz |

    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 use GProp::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 X
    • Iy
      static moment of inertia about Y
    • Iz
      static moment of inertia about Z
    Returns

    A result object with fields:

    • Ix: static moment of inertia about X
    • Iy: static moment of inertia about Y
    • Iz: static moment of inertia about Z
  • 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 a GProp_PrincipalProps framework which can be queried to access the value sought.

  • 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)

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.

  • Box(theP: gp_Pnt, theV1: gp_Vec, theV2: gp_Vec, theV3: gp_Vec): void

    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.
  • 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)

Static methods(4)

  • Computes the barycentre of a set of points (unit mass).

    Parameters (1)
    • thePnts
  • 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 array
    • theDensity
      per-point mass array
    • theMass
      total mass (sum of densities)
    • theG
      weighted barycentre Mutated in place; read the updated value from this argument after the call.
    Returns

    A 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 array
    • theDensity
      per-point mass array
    • theMass
      total mass (sum of densities)
    • theG
      weighted barycentre Mutated in place; read the updated value from this argument after the call.
    Returns

    A result object with fields:

    • theMass: total mass (sum of densities)

Instance methods(2)

  • AddPoint(thePnt: gp_Pnt): void

    Adds a point with unit mass.

    Parameters (1)
    • thePnt
  • AddPoint(thePnt: gp_Pnt, theDensity: number): void

    Adds a point with a given mass.

    Parameters (2)
    • thePnt
    • theDensity

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)

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)
    • Ixx
    • Iyy
    • Izz
    Returns

    A 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.
  • 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)
    • Rxx
    • Ryy
    • Rzz
    Returns

    A 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)

Instance methods(5)

  • SetLocation(SLocation: gp_Pnt): void
    Parameters (1)
    • SLocation
  • Perform(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number): void
    Parameters (5)
    • S
    • Alpha1
    • Alpha2
    • Z1
    • Z2
  • Perform(S: gp_Cone, Alpha1: number, Alpha2: number, Z1: number, Z2: number): void
    Parameters (5)
    • S
    • Alpha1
    • Alpha2
    • Z1
    • Z2
  • Perform(S: gp_Sphere, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number): void
    Parameters (5)
    • S
    • Teta1
    • Teta2
    • Alpha1
    • Alpha2
  • Perform(S: gp_Torus, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number): void
    Parameters (5)
    • S
    • Teta1
    • Teta2
    • Alpha1
    • Alpha2

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)

Instance methods(5)

  • SetLocation(VLocation: gp_Pnt): void
    Parameters (1)
    • VLocation
  • Perform(S: gp_Cylinder, Alpha1: number, Alpha2: number, Z1: number, Z2: number): void
    Parameters (5)
    • S
    • Alpha1
    • Alpha2
    • Z1
    • Z2
  • Perform(S: gp_Cone, Alpha1: number, Alpha2: number, Z1: number, Z2: number): void
    Parameters (5)
    • S
    • Alpha1
    • Alpha2
    • Z1
    • Z2
  • Perform(S: gp_Sphere, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number): void
    Parameters (5)
    • S
    • Teta1
    • Teta2
    • Alpha1
    • Alpha2
  • Perform(S: gp_Torus, Teta1: number, Teta2: number, Alpha1: number, Alpha2: number): void
    Parameters (5)
    • S
    • Teta1
    • Teta2
    • Alpha1
    • Alpha2