SmApiPolyBrepComputeMassProperties#

Defined in SM_API/inc/SmApiPolygons.h

SmApiStatus SmApiPolyBrepComputeMassProperties(
const SmPolyBrep *pPolyBrep,
double dDensity,
const SmPoint3d &crOrigin,
double &rdArea,
double &rdVolume,
double &rdMass,
SmPoint3d &rCentroid,
SmVector3d &rMomentsOfInertia,
SmVector3d &rProductsOfInertia,
)#

Mesh counterpart of SmApiBrepComputeMassProperties: same outputs and conventions, computed exactly from the mesh’s triangles (one pass, no accuracy parameter — accuracy is that of the tessellation). Independent of winding direction: a closed mesh wound inside-out (e.g. as imported) gives the same result as its correctly wound counterpart. Returns SM_ERR_INVALID_INPUT for a non-finite / sub-SM_EFF_ZERO density, a non-finite origin, a mesh that is not a closed manifold solid, or a zero-volume result.

Parameters:
  • pPolyBrep – [in ]: Mesh to query (closed manifold solid; read-only)

  • dDensity –

    [in ]: Uniform mass density (mass = density * volume); must be a

    valid double >= SM_EFF_ZERO (1e-12)

  • crOrigin –

    [in ]: Origin the moments/products are taken about (axes parallel

    to world axes); pass the centroid for centroidal inertia.

    Must be finite

  • rdArea – [out]: Total surface area

  • rdVolume – [out]: Enclosed volume

  • rdMass – [out]: Mass = dDensity * volume

  • rCentroid – [out]: Mass centroid in world coordinates; independent of crOrigin

  • rMomentsOfInertia –

    [out]: Mass moments of inertia (Ixx, Iyy, Izz) about axes through

    crOrigin parallel to the world axes

  • rProductsOfInertia –

    [out]: Mass products of inertia about crOrigin as raw positive

    integrals (Iyz, Izx, Ixy); tensor off-diagonals are negatives