Rhino C++ API  7.19
Public Member Functions | Public Attributes | List of all members
ON_MassProperties Class Reference

#include <opennurbs_plus_massprop.h>

Public Member Functions

 ON_MassProperties ()
 
 ~ON_MassProperties ()
 
double Area () const
 
ON_3dPoint Centroid () const
 FUNCTIONAL INTERFACE for those who wish to ignore error terms. More...
 
ON_DEPRECATED ON_MatrixCentroidCoordIntertiaMatrix (ON_Matrix *matrix=nullptr) const
 
ON_3dVector CentroidCoordMomentsOfInertia () const
 
bool CentroidCoordPrincipalMoments (double *pxx, ON_3dVector &Ax, double *pyy, ON_3dVector &Ay, double *pzz, ON_3dVector &Az) const
 
bool CentroidCoordPrincipalMomentsOfInertia (double *pxx, ON_3dVector &Ax, double *pyy, ON_3dVector &Ay, double *pzz, ON_3dVector &Az) const
 
ON_3dVector CentroidCoordRadiiOfGyration () const
 
ON_3dVector CentroidCoordSecondMoments () const
 
double Count () const
 
void Create ()
 Set values to constructor defaults. More...
 
void Dump (ON_TextLog &dump) const
 
double Length () const
 
bool Sum (int count, const ON_MassProperties *summands, bool bAddTo=false)
 
bool Transform (const ON_Xform &X)
 
double Volume () const
 
ON_3dVector WorldCoordFirstMoments () const
 
ON_DEPRECATED ON_MatrixWorldCoordIntertiaMatrix (ON_Matrix *matrix=nullptr) const
 
ON_3dVector WorldCoordMomentsOfInertia () const
 
bool WorldCoordPrincipalMoments (double *pxx, ON_3dVector &Ax, double *pyy, ON_3dVector &Ay, double *pzz, ON_3dVector &Az) const
 
bool WorldCoordPrincipalMomentsOfInertia (double *pxx, ON_3dVector &Ax, double *pyy, ON_3dVector &Ay, double *pzz, ON_3dVector &Az) const
 
ON_3dVector WorldCoordRadiiOfGyration () const
 
ON_3dVector WorldCoordSecondMoments () const
 

Public Attributes

bool m__bReserved1
 
bool m__bReserved2
 
bool m__bReserved3
 
int m__reserved
 
double m__reserved1
 
double m__reserved2
 
double m__reserved3
 
double m__reserved4
 
double m__reserved5
 
double m__reserved6
 
double m__reserved7
 
double m__reserved8
 
bool m_bValidCentroid
 
bool m_bValidFirstMoments
 
bool m_bValidMass
 
bool m_bValidProductMoments
 
bool m_bValidSecondMoments
 
double m_ccs_xx
 
double m_ccs_xx_err
 
double m_ccs_xy
 
double m_ccs_xy_err
 
double m_ccs_yy
 integral of "yy dm" over the length/area/volume More...
 
double m_ccs_yy_err
 
double m_ccs_yz
 integral of "yz dm" over the length/area/volume More...
 
double m_ccs_yz_err
 
double m_ccs_zx
 integral of "zx dm" over the length/area/volume More...
 
double m_ccs_zx_err
 uncertainty in calculation More...
 
double m_ccs_zz
 integral of "zz dm" over the length/area/volume More...
 
double m_ccs_zz_err
 uncertainty in calculation More...
 
double m_mass
 
double m_mass_err
 uncertainty in calculation More...
 
int m_mass_type
 
double m_world_x
 
double m_world_x_err
 uncertainty in calculation More...
 
double m_world_xx
 
double m_world_xx_err
 
double m_world_xy
 
double m_world_xy_err
 
double m_world_y
 integral of "y dm" over the length/area/volume More...
 
double m_world_y_err
 uncertainty in calculation More...
 
double m_world_yy
 integral of "yy dm" over the length/area/volume More...
 
double m_world_yy_err
 
double m_world_yz
 integral of "yz dm" over the length/area/volume More...
 
double m_world_yz_err
 
double m_world_z
 integral of "z dm" over the length/area/volume More...
 
double m_world_z_err
 uncertainty in calculation More...
 
double m_world_zx
 integral of "zx dm" over the length/area/volume More...
 
double m_world_zx_err
 uncertainty in calculation More...
 
double m_world_zz
 integral of "zz dm" over the length/area/volume More...
 
double m_world_zz_err
 uncertainty in calculation More...
 
double m_x0
 CENTROID - in world coordinate system. More...
 
double m_x0_err
 
double m_y0
 = m_world_y / m_mass More...
 
double m_y0_err
 
double m_z0
 = m_world_z / m_mass More...
 
double m_z0_err
 

Detailed Description

NoKeywords

/ / Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. / OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert / McNeel & Associates. / / THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. / ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF / MERCHANTABILITY ARE HEREBY DISCLAIMED. /
/ For complete openNURBS copyright information see http://www.opennurbs.org. / ////////////////////////////////////////////////////////////// Description: This class is used to returned results of mass properties calculations.

Note: The constructor for this class is meaningful and initializes m_mass_type to ON_UNSET_INT_INDEX. Users of arrays of this class should use ON_ClassArray. If you insist on using ON_SimpleArray<ON_MassProperties>, be sure to properly initialize all elements using the explicit constructor or Create(). Elements created with AppendNew() need a call to Create()! See RH-68376 for details.

Constructor & Destructor Documentation

◆ ON_MassProperties()

ON_MassProperties::ON_MassProperties ( )

◆ ~ON_MassProperties()

ON_MassProperties::~ON_MassProperties ( )

Member Function Documentation

◆ Area()

double ON_MassProperties::Area ( ) const

Description: Returns area of the surface or mesh if the mass properties calculation was an area calculation. Returns: Area of the surface or mesh if m_mass_type = 2 and zero otherwise.

◆ Centroid()

ON_3dPoint ON_MassProperties::Centroid ( ) const

FUNCTIONAL INTERFACE for those who wish to ignore error terms.

Returns: Centroid of object.

◆ CentroidCoordIntertiaMatrix()

ON_DEPRECATED ON_Matrix* ON_MassProperties::CentroidCoordIntertiaMatrix ( ON_Matrix matrix = nullptr) const

WARNING The function returned by this function is not an inertial matrix. So its been deprecated. Description: If moments are valid, then the 3x3 moment matrix with respect to centroid coordinates is returned.
Parameters: martix - [in] If you want to fill in an existing matrix, pass a pointer to that matrix. Otherwise a matrix will be created and returned. returned. Returns: The moment matrix or nullptr if the moments are not valid.

  m_ccs_xx  m_ccs_xy  m_ccs_xz
  m_ccs_xy  m_ccs_yy  m_ccs_yz
  m_ccs_xz  m_ccs_yz  m_ccs_zz

See Also: WorldCoordIntertiaMatrix

◆ CentroidCoordMomentsOfInertia()

ON_3dVector ON_MassProperties::CentroidCoordMomentsOfInertia ( ) const

Description: Calculates the moments of inertia about centroid coordinate axes.
Returns: Moments of inertia with respect to centroid coordinate system. WorldCoordMomentsOfInertia().x = integral of ((y-y0)^2 + (z-z0)^2) dm WorldCoordMomentsOfInertia().y = integral of ((z-z0)^2 + (x-x0)^2) dm WorldCoordMomentsOfInertia().z = integral of ((x-x0)^2 + (y-y0)^2) dm where (x0,y0,z0) = centroid. Remarks: What is meant by "moments of intertia" varies widely in textbooks and papers. The values returned here are the integrals listed in the Returns section. Some applications may want the values from WorldCoordSecondMoments() instead of the values returned here.

◆ CentroidCoordPrincipalMoments()

bool ON_MassProperties::CentroidCoordPrincipalMoments ( double *  pxx,
ON_3dVector Ax,
double *  pyy,
ON_3dVector Ay,
double *  pzz,
ON_3dVector Az 
) const

WARNING NOT PRINCIPAL MOMENTS of INERTIA!!! consider using CentroidCoordPrincipalMomentsOfInertia. Description: Calculates the eigenvalues and eigenvectors of the moments matrix with repect to centroid coordinates. m_ccs_xx m_ccs_xy m_ccs_xz m_ccs_xy m_ccs_yy m_ccs_yz m_ccs_xz m_ccs_yz m_ccs_zz Parameters: pxx - [out] principal moment Ax - [out] principal axis for pxx pyy - [out] principal moment Ay - [out] principal axis for pyy pzz - [out] principal moment Az - [out] principal axis for pzz Returns: True if successful. See Also: WorldCoordPrincipalMoments

◆ CentroidCoordPrincipalMomentsOfInertia()

bool ON_MassProperties::CentroidCoordPrincipalMomentsOfInertia ( double *  pxx,
ON_3dVector Ax,
double *  pyy,
ON_3dVector Ay,
double *  pzz,
ON_3dVector Az 
) const

Description: Calculates the principal moments of inertia and principal axes with repect to centroid coordinates.
Parameters: pxx - [out] principal moment Ax - [out] principal axis for pxx pyy - [out] principal moment Ay - [out] principal axis for pyy pzz - [out] principal moment Az - [out] principal axis for pzz Returns: True if successful. See Also: WorldCoordPrincipalMoments

◆ CentroidCoordRadiiOfGyration()

ON_3dVector ON_MassProperties::CentroidCoordRadiiOfGyration ( ) const

Description: Calculates the radii of gyration about centroid coordinate axes. Returns: Radii of gyration with respect to centroid coordinate system. CentroidCoordRadiiOfGyration().x = sqrt(integral of ((y-y0)^2 + (z-z0)^2) dm/M) CentroidCoordRadiiOfGyration().y = sqrt(integral of ((z-z0)^2 + (x-x0)^2) dm/M) CentroidCoordRadiiOfGyration().z = sqrt(integral of ((z-z0)^2 + (y-y0)^2) dm/M) where (x0,y0,z0) = centroid. Remarks: What is meant by "radii of gyration" varies widely in textbooks and papers. The values returned here are the integrals listed in the Returns section.

◆ CentroidCoordSecondMoments()

ON_3dVector ON_MassProperties::CentroidCoordSecondMoments ( ) const

Description: If m_bValidSecondMoments is true, then the centroid coordinate second moments are returned in a vector (m_ccs_xx,m_ccs_yy,m_ccs_zz) If m_bValidSecondMoments is false, then (0,0,0) is returned. Returns: Second moments with respect to centroid coordinate system. CentroidCoordSecondMoments().x = integral of (x-x0)^2 dm CentroidCoordSecondMoments().y = integral of (y-y0)^2 dm CentroidCoordSecondMoments().z = integral of (z-z0)^2 dm where (x0,y0,z0) = centroid. See Also: WorldCoordSecondMoments

◆ Count()

double ON_MassProperties::Count ( ) const

Description: Returns count of points if the mass properties calculation was a pointmass calculation. Returns: Count of points if m_mass_type = 0 and zero otherwise.

◆ Create()

void ON_MassProperties::Create ( )

Set values to constructor defaults.

◆ Dump()

void ON_MassProperties::Dump ( ON_TextLog dump) const

Description: Prints a text description of the mass properties information. Parameters: dump - [in] target for text dump information.

◆ Length()

double ON_MassProperties::Length ( ) const

Description: Returns length of the curve if the mass properties calculation was a length calculation. Returns: Length of the curve if m_mass_type = 1 and zero otherwise.

◆ Sum()

bool ON_MassProperties::Sum ( int  count,
const ON_MassProperties summands,
bool  bAddTo = false 
)

Description: Sum a list of mass properties together to get an aggregate mass. Parameters: count - [in] number of elements in the summands array. summands - [in] array of mass properties to add bAddTo - [in] if true, then the summands are added to the existing mass. Returns: True if successful.

◆ Transform()

bool ON_MassProperties::Transform ( const ON_Xform X)

Description: On input *this contains the mass properties for some geometry G, On exit *this contains the mass properties for the transformed geometry X(G).
Parameters: X - [in] When m_mass_type==3 ( for a solid) X must be an Affine transformation.
When m_mass_type==2 ( for a surface) X must be a similarity transformation
(see ON_Xform.IsAffine(), and ON_Xform::IsSimilarity()) For example perspective transformations are not allowed. Returns: True if successful. Details: The Area of a transformed object can not be calculated from the area of the original object if the transform is not a similarity, like a non-uniform scaling.

◆ Volume()

double ON_MassProperties::Volume ( ) const

Description: Returns volume of the solid if the mass properties calculation was a volume calculation. Returns: Volume of the solid if m_mass_type = 3 and zero otherwise.

◆ WorldCoordFirstMoments()

ON_3dVector ON_MassProperties::WorldCoordFirstMoments ( ) const

Description: If m_bValidFirstMoments is true, then the world coordinate first moments are returned in a vector (m_world_x,m_world_y,m_world_z) If m_bValidFirstMoments is false, then (0,0,0) is returned. Returns: First moments with respect to world coordinate system. WorldCoordFirstMoments().x = integral of x dm WorldCoordFirstMoments().y = integral of y dm WorldCoordFirstMoments().z = integral of z dm

◆ WorldCoordIntertiaMatrix()

ON_DEPRECATED ON_Matrix* ON_MassProperties::WorldCoordIntertiaMatrix ( ON_Matrix matrix = nullptr) const

WARNING The matrix returned by this function is not an Inertia Matrix. So this function is being made obsolete Description: If moments are valid, then the 3x3 inertia matrix with respect to world coordinates is returned. This matrix is sometimes called the "intertia tensor". Parameters: martix - [in] If you want to fill in an existing matrix, pass a pointer to that matrix. Otherwise a matrix will be created and returned. returned. Returns: The inertia matrix or nullptr if the moments are not valid.

See Also: CentroidCoordIntertiaMatrix

◆ WorldCoordMomentsOfInertia()

ON_3dVector ON_MassProperties::WorldCoordMomentsOfInertia ( ) const

Description: Calculates the moments of inertia about world coordinate axes.
Returns: Moments of inertia with respect to world coordinate system. WorldCoordMomentsOfInertia().x = integral of (y^2 + z^2) dm WorldCoordMomentsOfInertia().y = integral of (z^2 + x^2) dm WorldCoordMomentsOfInertia().z = integral of (x^2 + y^2) dm Remarks: What is meant by "moments of intertia" varies widely in textbooks and papers. The values returned here are the integrals listed in the Returns section. Some applications may want the values from WorldCoordSecondMoments() instead of the values returned here.

◆ WorldCoordPrincipalMoments()

bool ON_MassProperties::WorldCoordPrincipalMoments ( double *  pxx,
ON_3dVector Ax,
double *  pyy,
ON_3dVector Ay,
double *  pzz,
ON_3dVector Az 
) const

WARNING NOT PRINCIPAL MOMENTS of INERTIA!!! consider using WorldCoordPrincipalMomentsOfInertia. Description: Calculates the eigenvalues and eigenvectors of moments matrix in world coordinates. m_world_xx m_world_xy m_world_xz m_world_xy m_world_yy m_world_yz m_world_xz m_world_yz m_world_zz

Parameters: pxx - [out] principal moment Ax - [out] principal axis for pxx pyy - [out] principal moment Ay - [out] principal axis for pyy pzz - [out] principal moment Az - [out] principal axis for pzz Returns: True if successful. See Also: CentroidCoordPrincipalMoments

◆ WorldCoordPrincipalMomentsOfInertia()

bool ON_MassProperties::WorldCoordPrincipalMomentsOfInertia ( double *  pxx,
ON_3dVector Ax,
double *  pyy,
ON_3dVector Ay,
double *  pzz,
ON_3dVector Az 
) const

Description: Calculates the principal moments of inertia and principal axes with repect to world coordinates. Parameters: pxx - [out] principal moment Ax - [out] principal axis for pxx pyy - [out] principal moment Ay - [out] principal axis for pyy pzz - [out] principal moment Az - [out] principal axis for pzz Returns: True if successful. See Also: WorldCoordPrincipalMoments

◆ WorldCoordRadiiOfGyration()

ON_3dVector ON_MassProperties::WorldCoordRadiiOfGyration ( ) const

Description: Calculates the radii of gyration about world coordinate axes. Returns: Radii of gyration with respect to world coordinate system. WorldCoordRadiiOfGyration().x = sqrt(integral of (y^2 + z^2) dm/M) WorldCoordRadiiOfGyration().y = sqrt(integral of (z^2 + x^2) dm/M) WorldCoordRadiiOfGyration().z = sqrt(integral of (z^2 + y^2) dm/M) Remarks: What is meant by "radii of gyration" varies widely in textbooks and papers. The values returned here are the integrals listed in the Returns section.

◆ WorldCoordSecondMoments()

ON_3dVector ON_MassProperties::WorldCoordSecondMoments ( ) const

Description: If m_bValidSecondMoments is true, then the world coordinate second moments are returned in a vector (m_world_xx,m_world_yy,m_world_zz) If m_bValidSecondMoments is false, then (0,0,0) is returned. Returns: Second moments with respect to world coordinate system. WorldCoordSecondMoments().x = integral of x^2 dm WorldCoordSecondMoments().y = integral of y^2 dm WorldCoordSecondMoments().z = integral of z^2 dm See Also: CentroidCoordSecondMoments

Member Data Documentation

◆ m__bReserved1

bool ON_MassProperties::m__bReserved1

◆ m__bReserved2

bool ON_MassProperties::m__bReserved2

◆ m__bReserved3

bool ON_MassProperties::m__bReserved3

◆ m__reserved

int ON_MassProperties::m__reserved

◆ m__reserved1

double ON_MassProperties::m__reserved1

◆ m__reserved2

double ON_MassProperties::m__reserved2

◆ m__reserved3

double ON_MassProperties::m__reserved3

◆ m__reserved4

double ON_MassProperties::m__reserved4

◆ m__reserved5

double ON_MassProperties::m__reserved5

◆ m__reserved6

double ON_MassProperties::m__reserved6

◆ m__reserved7

double ON_MassProperties::m__reserved7

◆ m__reserved8

double ON_MassProperties::m__reserved8

◆ m_bValidCentroid

bool ON_MassProperties::m_bValidCentroid

◆ m_bValidFirstMoments

bool ON_MassProperties::m_bValidFirstMoments

◆ m_bValidMass

bool ON_MassProperties::m_bValidMass

These flags are set to true if the calcluation was successful. If a flag is false, the corresponding values should not be used.

◆ m_bValidProductMoments

bool ON_MassProperties::m_bValidProductMoments

◆ m_bValidSecondMoments

bool ON_MassProperties::m_bValidSecondMoments

◆ m_ccs_xx

double ON_MassProperties::m_ccs_xx

The "centroid coordinate system" (ccs) is the coordinate system with origin at the centroid and axes parallel to the world coordinate axes. SECOND MOMENTS - with respect to centroid coordinate system integral of "xx dm" over the length/area/volume

◆ m_ccs_xx_err

double ON_MassProperties::m_ccs_xx_err

uncertainty in calculation

◆ m_ccs_xy

double ON_MassProperties::m_ccs_xy

PRODUCT MOMENTS - with respect to centroid coordinate system integral of "xy dm" over the length/area/volume

◆ m_ccs_xy_err

double ON_MassProperties::m_ccs_xy_err

uncertainty in calculation

◆ m_ccs_yy

double ON_MassProperties::m_ccs_yy

integral of "yy dm" over the length/area/volume

◆ m_ccs_yy_err

double ON_MassProperties::m_ccs_yy_err

uncertainty in calculation

◆ m_ccs_yz

double ON_MassProperties::m_ccs_yz

integral of "yz dm" over the length/area/volume

◆ m_ccs_yz_err

double ON_MassProperties::m_ccs_yz_err

uncertainty in calculation

◆ m_ccs_zx

double ON_MassProperties::m_ccs_zx

integral of "zx dm" over the length/area/volume

◆ m_ccs_zx_err

double ON_MassProperties::m_ccs_zx_err

uncertainty in calculation

◆ m_ccs_zz

double ON_MassProperties::m_ccs_zz

integral of "zz dm" over the length/area/volume

◆ m_ccs_zz_err

double ON_MassProperties::m_ccs_zz_err

uncertainty in calculation

◆ m_mass

double ON_MassProperties::m_mass

MASS - count, length, area, or volume of object = integral of "dm" over the object

◆ m_mass_err

double ON_MassProperties::m_mass_err

uncertainty in calculation

◆ m_mass_type

int ON_MassProperties::m_mass_type

Determines what type of "mass" is returned. ON_UNSET_INT_INDEX = unset, 0 = point masses, 1 = length, 2 = area, 3 = volume

◆ m_world_x

double ON_MassProperties::m_world_x

FIRST MOMENTS - with respect to world coordinate system integral of "x dm" over the length/area/volume

◆ m_world_x_err

double ON_MassProperties::m_world_x_err

uncertainty in calculation

◆ m_world_xx

double ON_MassProperties::m_world_xx

SECOND MOMENTS - with respect to world coordinate system integral of "xx dm" over the length/area/volume

◆ m_world_xx_err

double ON_MassProperties::m_world_xx_err

uncertainty in calculation

◆ m_world_xy

double ON_MassProperties::m_world_xy

PRODUCT MOMENTS - with respect to world coordinate system integral of "xy dm" over the length/area/volume

◆ m_world_xy_err

double ON_MassProperties::m_world_xy_err

uncertainty in calculation

◆ m_world_y

double ON_MassProperties::m_world_y

integral of "y dm" over the length/area/volume

◆ m_world_y_err

double ON_MassProperties::m_world_y_err

uncertainty in calculation

◆ m_world_yy

double ON_MassProperties::m_world_yy

integral of "yy dm" over the length/area/volume

◆ m_world_yy_err

double ON_MassProperties::m_world_yy_err

uncertainty in calculation

◆ m_world_yz

double ON_MassProperties::m_world_yz

integral of "yz dm" over the length/area/volume

◆ m_world_yz_err

double ON_MassProperties::m_world_yz_err

uncertainty in calculation

◆ m_world_z

double ON_MassProperties::m_world_z

integral of "z dm" over the length/area/volume

◆ m_world_z_err

double ON_MassProperties::m_world_z_err

uncertainty in calculation

◆ m_world_zx

double ON_MassProperties::m_world_zx

integral of "zx dm" over the length/area/volume

◆ m_world_zx_err

double ON_MassProperties::m_world_zx_err

uncertainty in calculation

◆ m_world_zz

double ON_MassProperties::m_world_zz

integral of "zz dm" over the length/area/volume

◆ m_world_zz_err

double ON_MassProperties::m_world_zz_err

uncertainty in calculation

◆ m_x0

double ON_MassProperties::m_x0

CENTROID - in world coordinate system.

= m_world_x / m_mass

◆ m_x0_err

double ON_MassProperties::m_x0_err

◆ m_y0

double ON_MassProperties::m_y0

= m_world_y / m_mass

◆ m_y0_err

double ON_MassProperties::m_y0_err

◆ m_z0

double ON_MassProperties::m_z0

= m_world_z / m_mass

◆ m_z0_err

double ON_MassProperties::m_z0_err