Skip to content
Snippets Groups Projects
Commit 0488eec5 authored by Tazpn's avatar Tazpn
Browse files

niflib: Add InertiaMatrix as first class niflib type. Add qhull to niflib....

niflib:  Add InertiaMatrix as first class niflib type. Add qhull to niflib. Add UpdateMassCenterInertia to bhkRigidBody and supporing bhkShape objects.
parent b34877b4
No related branches found
No related tags found
No related merge requests found
Showing
with 422 additions and 59 deletions
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for license. */
#ifndef _NIF_INERTIA_H
#define _NIF_INERTIA_H
#pragma once
//--Includes--//
#include "nif_math.h"
#include <vector>
namespace Niflib {
class Inertia {
public:
/*! Return mass and inertia matrix for a sphere of given radius and
* density.
*/
static void GetMassInertiaSphere(float radius, float density,
bool solid, float& mass, InertiaMatrix &inertia);
/*! Return mass and inertia matrix for a box of given size and
* density.
*/
static void GetMassInertiaBox(Vector3 size, float density,
bool solid, float& mass, InertiaMatrix &inertia);
/*! Return mass and inertia matrix for a cylinder of given radius,
* height and density.
*/
static void GetMassInertiaCylinder(float radius, float height,
float density, bool solid,
float& mass, InertiaMatrix &inertia);
/*! Return mass and inertia matrix for a capsule of given radius,
* height and density.
*/
static void GetMassInertiaCapsule(float radius, float height,
float density, bool solid,
float& mass, InertiaMatrix &inertia);
/*! Return mass and inertia matrix for a capsule of given radius,
* height and density.
*/
static void GetMassCenterInertiaPolyhedron(
const std::vector<Niflib::Vector3>& vertices,
const std::vector<Niflib::Triangle>& triangles,
float density, bool solid,
float& mass, Niflib::Vector3& center, InertiaMatrix &inertia);
private:
explicit Inertia();
};
}
#endif
\ No newline at end of file
......@@ -209,6 +209,9 @@ void NifStream( Char8String & val, istream& in, const NifInfo & info );
void NifStream( Char8String const & val, ostream& out, const NifInfo & info );
ostream & operator<<( ostream & out, Char8String const & val );
//InertiaMatrix
void NifStream( InertiaMatrix & val, istream& in, const NifInfo & info);
void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info);
//--Templates--//
......
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for license. */
//---THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT---//
//To change this file, alter the niftools/docsys/gen_niflib.py Python script.
#ifndef _INERTIAMATRIX_H_
#define _INERTIAMATRIX_H_
#include "../NIF_IO.h"
namespace Niflib {
/*! An inertia matrix. */
struct InertiaMatrix {
/*! Default Constructor */
NIFLIB_API InertiaMatrix();
/*! Default Destructor */
NIFLIB_API ~InertiaMatrix();
/*! Copy Constructor */
NIFLIB_API InertiaMatrix( const InertiaMatrix & src );
/*! Copy Operator */
NIFLIB_API InertiaMatrix & operator=( const InertiaMatrix & src );
/*! Unknown. */
float m11;
/*! Unknown. */
float m12;
/*! Unknown. */
float m13;
/*! Zero */
float m14;
/*! Unknown. */
float m21;
/*! Unknown. */
float m22;
/*! Unknown. */
float m23;
/*! Zero */
float m24;
/*! Unknown. */
float m31;
/*! Unknown. */
float m32;
/*! Unknown. */
float m33;
/*! Zero */
float m34;
};
}
#endif
......@@ -30,6 +30,7 @@ struct Float3;
struct Matrix33;
struct Float4;
struct Matrix44;
struct InertiaMatrix;
/*! Stores 2D texture coordinates as two floating point variables, u and v. */
struct TexCoord {
......@@ -231,6 +232,13 @@ struct Vector3 {
*/
NIFLIB_API bool operator!=( const Vector3 & rh ) const;
/*! The bracket operator makes it possible to use this structure like a C++ array.
* \param[in] n The index into the data array. Should be 0, 1, or 2.
* \return The value at the given array index by reference so it can be read or set via the bracket operator.
*/
NIFLIB_API float & operator[](int n);
NIFLIB_API float operator[](int n) const;
/* Computes the dot product of two vectors; the angle between two vectors.
* \param[in] rh The vector to perform the dot product with
* \return The angle in radians between this vector and the one given
......@@ -823,6 +831,18 @@ struct Matrix44 {
*/
NIFLIB_API Matrix44 & operator+=( const Matrix44 & rh );
/* Adds this matrix to another.
* \param[in] rh The matrix to be added to this one.
* \return The result of the addition.
*/
NIFLIB_API Matrix44 operator-( const Matrix44 & rh ) const;
/* Adds this matrix to another and sets the result to itself.
* \param[in] rh The matrix to be added to this one.
* \return This matrix is returned.
*/
NIFLIB_API Matrix44 & operator-=( const Matrix44 & rh );
/* Sets the values of this matrix to those of the given matrix.
* \param[in] rh The matrix to copy values from.
* \return This matrix is returned.
......@@ -1020,6 +1040,190 @@ struct Quaternion {
NIFLIB_API Float3 AsEulerYawPitchRoll();
};
/*! Stores a 4 by 3 matrix used for tensors. */
struct InertiaMatrix {
/*! The 4x3 identity matrix constant */
NIFLIB_API static const InertiaMatrix IDENTITY;
Float4 rows[3]; /*!< The three rows of Float3 structures which hold three floating point numbers each. */
/*! The bracket operator makes it possible to use this structure like a 4x4 C++ array.
* \param[in] n The index into the row array. Should be 0, 1, 2, or 3.
* \return The Float4 structure for the given row index by reference so it can be read or set via the bracket operator.
*/
NIFLIB_API Float4 & operator[](int n) {
return rows[n];
}
NIFLIB_API Float4 const & operator[](int n) const {
return rows[n];
}
/*! Default constructor. Initializes Matrix to Identity. */
NIFLIB_API InertiaMatrix();
/*! Copy constructor. Initializes Matrix to another InertiaMatrix.
* \param[in] m The matrix to initialize this one to.
*/
NIFLIB_API InertiaMatrix( const InertiaMatrix & m ) { memcpy(rows, m.rows, sizeof(Float4) * 4); }
/*! This constructor can be used to set all values in this matrix during initialization
* \param[in] m11 The value to set at row 1, column 1.
* \param[in] m12 The value to set at row 1, column 2.
* \param[in] m13 The value to set at row 1, column 3.
* \param[in] m14 The value to set at row 1, column 4.
* \param[in] m21 The value to set at row 2, column 1.
* \param[in] m22 The value to set at row 2, column 2.
* \param[in] m23 The value to set at row 2, column 3.
* \param[in] m24 The value to set at row 2, column 4.
* \param[in] m31 The value to set at row 3, column 1.
* \param[in] m32 The value to set at row 3, column 2.
* \param[in] m33 The value to set at row 3, column 3.
* \param[in] m34 The value to set at row 3, column 4.
* \param[in] m41 The value to set at row 4, column 1.
* \param[in] m42 The value to set at row 4, column 2.
* \param[in] m43 The value to set at row 4, column 3.
* \param[in] m44 The value to set at row 4, column 4.
*/
NIFLIB_API InertiaMatrix(
float m11, float m12, float m13, float m14,
float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m34
) {
rows[0][0] = m11; rows[0][1] = m12; rows[0][2] = m13; rows[0][3] = m14;
rows[1][0] = m21; rows[1][1] = m22; rows[1][2] = m23; rows[1][3] = m24;
rows[2][0] = m31; rows[2][1] = m32; rows[2][2] = m33; rows[2][3] = m34;
}
/*! This constructor allows a 4x4 transform matrix to be initalized from a
* a 3x3 rotation matrix.
* \param[in] rotation The 3x3 rotation matrix.
*/
NIFLIB_API InertiaMatrix( const Matrix33 & rotation );
/*! This function can be used to set all values in this matrix at the same time.
* \param[in] m11 The value to set at row 1, column 1.
* \param[in] m12 The value to set at row 1, column 2.
* \param[in] m13 The value to set at row 1, column 3.
* \param[in] m14 The value to set at row 1, column 4.
* \param[in] m21 The value to set at row 2, column 1.
* \param[in] m22 The value to set at row 2, column 2.
* \param[in] m23 The value to set at row 2, column 3.
* \param[in] m24 The value to set at row 2, column 4.
* \param[in] m31 The value to set at row 3, column 1.
* \param[in] m32 The value to set at row 3, column 2.
* \param[in] m33 The value to set at row 3, column 3.
* \param[in] m34 The value to set at row 3, column 4.
*/
NIFLIB_API void Set(
float m11, float m12, float m13, float m14,
float m21, float m22, float m23, float m24,
float m31, float m32, float m33, float m34
) {
rows[0][0] = m11; rows[0][1] = m12; rows[0][2] = m13; rows[0][3] = m14;
rows[1][0] = m21; rows[1][1] = m22; rows[1][2] = m23; rows[1][3] = m24;
rows[2][0] = m31; rows[2][1] = m32; rows[2][2] = m33; rows[2][3] = m34;
}
/* Multiplies this matrix by another.
* \param[in] rh The matrix to multiply this one with.
* \return The result of the multiplication.
*/
NIFLIB_API InertiaMatrix operator*( const InertiaMatrix & rh ) const;
/* Multiplies this matrix by another and sets the result to itself.
* \param[in] rh The matrix to multiply this one with.
* \return This matrix is returned.
*/
NIFLIB_API InertiaMatrix & operator*=( const InertiaMatrix & rh );
/* Multiplies this matrix by a scalar value.
* \param[in] rh The scalar value to multiply each component of this matrix by.
* \return The result of the multiplication.
*/
NIFLIB_API InertiaMatrix operator*( float rh ) const;
/* Multiplies this matrix by a scalar value and sets the resutl to itself.
* \param[in] rh The scalar value to multiply each component of this matrix by.
* \return This matrix is returned.
*/
NIFLIB_API InertiaMatrix & operator*=( float rh );
/* Multiplies this matrix by a vector with x, y, and z components.
* \param[in] rh The vector to multiply this matrix with.
* \return The result of the multiplication.
*/
NIFLIB_API Vector3 operator*( const Vector3 & rh ) const;
/* Adds this matrix to another.
* \param[in] rh The matrix to be added to this one.
* \return The result of the addition.
*/
NIFLIB_API InertiaMatrix operator+( const InertiaMatrix & rh ) const;
/* Adds this matrix to another and sets the result to itself.
* \param[in] rh The matrix to be added to this one.
* \return This matrix is returned.
*/
NIFLIB_API InertiaMatrix & operator+=( const InertiaMatrix & rh );
/* Sets the values of this matrix to those of the given matrix.
* \param[in] rh The matrix to copy values from.
* \return This matrix is returned.
*/
NIFLIB_API InertiaMatrix & operator=( const InertiaMatrix & rh );
/* Allows the contents of the matrix to be printed to an ostream.
* \param[in] lh The ostream to insert the text into.
* \param[in] rh The matrix to insert into the stream.
* \return The given ostream is returned.
*/
NIFLIB_API friend ostream & operator<<( ostream & lh, const InertiaMatrix & rh );
/* Compares two 4x4 matricies. They are considered equal if all components are equal.
* \param[in] rh The matrix to compare this one with.
* \return true if the matricies are equal, false otherwise.
*/
NIFLIB_API bool operator==( const InertiaMatrix & rh ) const;
/* Compares two 4x4 matricies. They are considered inequal if any corresponding
* components are inequal.
* \param[in] rh The matrix to compare this one with.
* \return true if the matricies are inequal, false otherwise.
*/
NIFLIB_API bool operator!=( const InertiaMatrix & rh ) const;
/*! Calculates the transpose of this matrix.
* \return The transpose of this matrix.
*/
NIFLIB_API InertiaMatrix Transpose() const;
/*! Calculates the determinant of this matrix.
* \return The determinant of this matrix.
*/
NIFLIB_API float Determinant() const;
/*! Calculates the inverse of this matrix.
* \return The inverse of this matrix.
*/
NIFLIB_API InertiaMatrix Inverse() const;
/*! Returns a 3x3 submatrix of this matrix created by skipping the indicated row and column.
* \param[in] skip_r The row to skip. Must be a value between 0 and 3.
* \param[in] skip_c The colum to skip. Must be a value between 0 and 3.
* \return The 3x3 submatrix obtained by skipping the indicated row and column.
*/
NIFLIB_API Matrix33 Submatrix( int skip_r, int skip_c ) const;
/*! Calculates the adjunct of this matrix created by skipping the indicated row and column.
* \param[in] skip_r The row to skip. Must be a value between 0 and 3.
* \param[in] skip_c The colum to skip. Must be a value between 0 and 3.
* \return The adjunct obtained by skipping the indicated row and column.
*/
NIFLIB_API float Adjoint( int skip_r, int skip_c ) const;
};
//--ostream functions for printing with cout--//
NIFLIB_API ostream & operator<<( ostream & out, TexCoord const & val );
......@@ -1033,6 +1237,8 @@ NIFLIB_API ostream & operator<<( ostream & out, Float4 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Color3 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Color4 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Quaternion const & val );
NIFLIB_API ostream & operator<<( ostream & out, Matrix44 const & val );
NIFLIB_API ostream & operator<<( ostream & out, InertiaMatrix const & val );
}
#endif
......@@ -164,7 +164,7 @@ protected:
/*! Number of vertices. */
unsigned int numVertices;
/*! This byte is always 1 in all official files. */
bool relativeTargets;
byte relativeTargets;
/*! The geometry morphing objects. */
vector<Morph > morphs;
public:
......
......@@ -66,6 +66,16 @@ public:
*/
NIFLIB_API void SetDimensions( const Vector3 & value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! Unknown. */
......
......@@ -52,6 +52,17 @@ public:
*/
NIFLIB_API virtual const Type & GetType() const;
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--BEGIN MISC CUSTOM CODE--//
//--END CUSTOM CODE--//
public:
......
......@@ -114,6 +114,16 @@ public:
*/
NIFLIB_API void SetRadius2( float value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! Unknown. */
......
......@@ -53,6 +53,17 @@ public:
NIFLIB_API virtual const Type & GetType() const;
//--BEGIN MISC CUSTOM CODE--//
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
......
......@@ -53,6 +53,16 @@ public:
NIFLIB_API virtual const Type & GetType() const;
//--BEGIN MISC CUSTOM CODE--//
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
......
......@@ -111,6 +111,16 @@ public:
*/
NIFLIB_API void SetNormalsAndDist(const vector<Vector4>& value);
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*!
......
......@@ -91,6 +91,16 @@ public:
*/
NIFLIB_API void SetMaterial( HavokMaterial value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! The number of sub shapes referenced. */
......
......@@ -130,6 +130,16 @@ public:
*/
NIFLIB_API void SetMoppScale( float value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! The shape. */
......
......@@ -70,6 +70,16 @@ public:
NIFLIB_API void SetSpheres( const vector<SphereBV> & value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! Unknown. */
......
......@@ -131,6 +131,16 @@ public:
NIFLIB_API unsigned char GetOblivionFilter( unsigned int index ) const;
NIFLIB_API void SetOblivionFilter( unsigned int index, unsigned char filter );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! The shape's material. */
......
......@@ -83,6 +83,16 @@ public:
*/
NIFLIB_API void SetSubShapes( vector<OblivionSubShape>& value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! Number of subparts. */
......
......@@ -17,7 +17,6 @@ All rights reserved. Please see niflib.h for license. */
// Include structures
#include "../gen/QuaternionXYZW.h"
#include "../gen/InertiaMatrix.h"
#include "../Ref.h"
namespace Niflib {
......@@ -133,13 +132,13 @@ public:
* Gets the current inertia of this rigid body.
* \return The inertia of this rigid body.
*/
NIFLIB_API array<12,float> GetInertia() const;
NIFLIB_API InertiaMatrix GetInertia() const;
/*!
* Sets a new inertia for this rigid body.
* \param[in] value The new inertia for this rigid body.
*/
NIFLIB_API void SetInertia( const array<12,float> & value );
NIFLIB_API void SetInertia( const InertiaMatrix & value );
/*!
* Gets the current center point of this rigid body.
......@@ -284,13 +283,21 @@ public:
// Usually set to 1 for fixed objects, or set to 2 for moving ones. Seems to
// always be same as Unknown Byte 1.
// \return The current value.
SolverDeactivation GetSolverDeactivation() const;
NIFLIB_API SolverDeactivation GetSolverDeactivation() const;
// Usually set to 1 for fixed objects, or set to 2 for moving ones. Seems to
// always be same as Unknown Byte 1.
// \param[in] value The new value.
void SetSolverDeactivation( const SolverDeactivation & value );
NIFLIB_API void SetSolverDeactivation( const SolverDeactivation & value );
// Apply scale factor <scale> on data.
// \param[in] scale Factor to scale by
NIFLIB_API void ApplyScale(float scale);
// Look at all the objects under this rigid body and update the mass
// center of gravity, and inertia tensor accordingly. If the mass parameter
// is given then the density argument is ignored.
NIFLIB_API void UpdateMassCenterInertia(float density = 1.0f, bool solid = true, float mass = 0.0f);
//--END CUSTOM CODE--//
protected:
......
......@@ -11,6 +11,7 @@ All rights reserved. Please see niflib.h for license. */
#define _BHKSHAPE_H_
//--BEGIN FILE HEAD CUSTOM CODE--//
#include "../NIF_IO.h"
//--END CUSTOM CODE--//
#include "bhkSerializable.h"
......@@ -53,6 +54,17 @@ public:
NIFLIB_API virtual const Type & GetType() const;
//--BEGIN MISC CUSTOM CODE--//
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
......
......@@ -81,6 +81,16 @@ public:
*/
NIFLIB_API void SetRadius( float value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
protected:
/*! The shape's material. */
......
......@@ -66,6 +66,16 @@ public:
*/
NIFLIB_API void SetRadius( float value );
/*! Helper routine for calculating mass properties.
* \param[in] density Uniform density of object
* \param[in] solid Determines whether the object is assumed to be solid or not
* \param[out] mass Calculated mass of the object
* \param[out] center Center of mass
* \param[out] inertia Mass Inertia Tensor
* \return Return mass, center, and inertia tensor.
*/
NIFLIB_API virtual void CalcMassCenterInertia(float density, bool solid, float &mass, Vector3 &center, InertiaMatrix& inertia);
//--END CUSTOM CODE--//
public:
/*! NIFLIB_HIDDEN function. For internal use only. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment