use highfideltiy style for class data member names

This commit is contained in:
Andrew Meadows 2015-05-26 22:59:29 -07:00
parent 708203089c
commit 39d8244255
3 changed files with 33 additions and 33 deletions

View file

@ -262,11 +262,11 @@ void MeshMassProperties::computeMassProperties(const VectorOfPoints& points, con
//
// initialize the totals
m_volume = btScalar(0.0f);
_volume = btScalar(0.0f);
btVector3 weightedCenter;
weightedCenter.setZero();
for (uint32_t i = 0; i < 3; ++i) {
m_inertia[i].setZero();
_inertia[i].setZero();
}
// create some variables to hold temporary results
@ -310,12 +310,12 @@ void MeshMassProperties::computeMassProperties(const VectorOfPoints& points, con
// tally results
weightedCenter += volume * center;
m_volume += volume;
m_inertia += tetraInertia;
_volume += volume;
_inertia += tetraInertia;
}
m_centerOfMass = weightedCenter / m_volume;
_centerOfMass = weightedCenter / _volume;
applyInverseParallelAxisTheorem(m_inertia, m_centerOfMass, m_volume);
applyInverseParallelAxisTheorem(_inertia, _centerOfMass, _volume);
}

View file

@ -52,9 +52,9 @@ public:
void computeMassProperties(const VectorOfPoints& points, const VectorOfIndices& triangleIndices);
// harveste the mass properties from these public data members
btScalar m_volume = 1.0f;
btVector3 m_centerOfMass = btVector3(0.0f, 0.0f, 0.0f);
btMatrix3x3 m_inertia = btMatrix3x3(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
btScalar _volume = 1.0f;
btVector3 _centerOfMass = btVector3(0.0f, 0.0f, 0.0f);
btMatrix3x3 _inertia = btMatrix3x3(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
};
#endif // _hifi_MeshMassProperties_h

View file

@ -191,13 +191,13 @@ void MeshMassPropertiesTests::testOpenTetrahedonMesh() {
MeshMassProperties mesh(shiftedPoints, triangles);
// verify
btScalar error = (mesh.m_volume - expectedVolume) / expectedVolume;
btScalar error = (mesh._volume - expectedVolume) / expectedVolume;
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : volume of tetrahedron off by = "
<< error << std::endl;
}
error = (mesh.m_centerOfMass - expectedCenterOfMass).length();
error = (mesh._centerOfMass - expectedCenterOfMass).length();
if (fabsf(error) > acceptableAbsoluteError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : centerOfMass of tetrahedron off by = "
<< error << std::endl;
@ -205,7 +205,7 @@ void MeshMassPropertiesTests::testOpenTetrahedonMesh() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
error = (mesh.m_inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
error = (mesh._inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : inertia[" << i << "][" << j << "] off by "
<< error << std::endl;
@ -215,9 +215,9 @@ void MeshMassPropertiesTests::testOpenTetrahedonMesh() {
#ifdef VERBOSE_UNIT_TESTS
std::cout << "expected volume = " << expectedVolume << std::endl;
std::cout << "measured volume = " << mesh.m_volume << std::endl;
std::cout << "measured volume = " << mesh._volume << std::endl;
printMatrix("expected inertia", expectedInertia);
printMatrix("computed inertia", mesh.m_inertia);
printMatrix("computed inertia", mesh._inertia);
#endif // VERBOSE_UNIT_TESTS
}
@ -261,13 +261,13 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
// verify
btScalar error;
error = (mesh.m_volume - expectedVolume) / expectedVolume;
error = (mesh._volume - expectedVolume) / expectedVolume;
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : volume of tetrahedron off by = "
<< error << std::endl;
}
error = (mesh.m_centerOfMass - expectedCenterOfMass).length();
error = (mesh._centerOfMass - expectedCenterOfMass).length();
if (fabsf(error) > acceptableAbsoluteError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : centerOfMass of tetrahedron off by = "
<< error << std::endl;
@ -275,7 +275,7 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
error = (mesh.m_inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
error = (mesh._inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : inertia[" << i << "][" << j << "] off by "
<< error << std::endl;
@ -286,9 +286,9 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
#ifdef VERBOSE_UNIT_TESTS
std::cout << "(a) tetrahedron as mesh" << std::endl;
std::cout << "expected volume = " << expectedVolume << std::endl;
std::cout << "measured volume = " << mesh.m_volume << std::endl;
std::cout << "measured volume = " << mesh._volume << std::endl;
printMatrix("expected inertia", expectedInertia);
printMatrix("computed inertia", mesh.m_inertia);
printMatrix("computed inertia", mesh._inertia);
#endif // VERBOSE_UNIT_TESTS
// test again, but this time shift the points so that the origin is definitely OUTSIDE the mesh
@ -302,13 +302,13 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
mesh.computeMassProperties(points, triangles);
// verify
error = (mesh.m_volume - expectedVolume) / expectedVolume;
error = (mesh._volume - expectedVolume) / expectedVolume;
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : volume of tetrahedron off by = "
<< error << std::endl;
}
error = (mesh.m_centerOfMass - expectedCenterOfMass).length();
error = (mesh._centerOfMass - expectedCenterOfMass).length();
if (fabsf(error) > acceptableAbsoluteError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : centerOfMass of tetrahedron off by = "
<< error << std::endl;
@ -316,7 +316,7 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
error = (mesh.m_inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
error = (mesh._inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : inertia[" << i << "][" << j << "] off by "
<< error << std::endl;
@ -327,9 +327,9 @@ void MeshMassPropertiesTests::testClosedTetrahedronMesh() {
#ifdef VERBOSE_UNIT_TESTS
std::cout << "(b) shifted tetrahedron as mesh" << std::endl;
std::cout << "expected volume = " << expectedVolume << std::endl;
std::cout << "measured volume = " << mesh.m_volume << std::endl;
std::cout << "measured volume = " << mesh._volume << std::endl;
printMatrix("expected inertia", expectedInertia);
printMatrix("computed inertia", mesh.m_inertia);
printMatrix("computed inertia", mesh._inertia);
#endif // VERBOSE_UNIT_TESTS
}
@ -396,13 +396,13 @@ void MeshMassPropertiesTests::testBoxAsMesh() {
// verify
btScalar error;
error = (mesh.m_volume - expectedVolume) / expectedVolume;
error = (mesh._volume - expectedVolume) / expectedVolume;
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : volume of tetrahedron off by = "
<< error << std::endl;
}
error = (mesh.m_centerOfMass - expectedCenterOfMass).length();
error = (mesh._centerOfMass - expectedCenterOfMass).length();
if (fabsf(error) > acceptableAbsoluteError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : centerOfMass of tetrahedron off by = "
<< error << std::endl;
@ -411,13 +411,13 @@ void MeshMassPropertiesTests::testBoxAsMesh() {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
if (expectedInertia [i][j] == btScalar(0.0f)) {
error = mesh.m_inertia[i][j] - expectedInertia[i][j];
error = mesh._inertia[i][j] - expectedInertia[i][j];
if (fabsf(error) > acceptableAbsoluteError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : inertia[" << i << "][" << j << "] off by "
<< error << " absolute"<< std::endl;
}
} else {
error = (mesh.m_inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
error = (mesh._inertia[i][j] - expectedInertia[i][j]) / expectedInertia[i][j];
if (fabsf(error) > acceptableRelativeError) {
std::cout << __FILE__ << ":" << __LINE__ << " ERROR : inertia[" << i << "][" << j << "] off by "
<< error << std::endl;
@ -428,17 +428,17 @@ void MeshMassPropertiesTests::testBoxAsMesh() {
#ifdef VERBOSE_UNIT_TESTS
std::cout << "expected volume = " << expectedVolume << std::endl;
std::cout << "measured volume = " << mesh.m_volume << std::endl;
std::cout << "measured volume = " << mesh._volume << std::endl;
std::cout << "expected center of mass = < "
<< expectedCenterOfMass[0] << ", "
<< expectedCenterOfMass[1] << ", "
<< expectedCenterOfMass[2] << "> " << std::endl;
std::cout << "computed center of mass = < "
<< mesh.m_centerOfMass[0] << ", "
<< mesh.m_centerOfMass[1] << ", "
<< mesh.m_centerOfMass[2] << "> " << std::endl;
<< mesh._centerOfMass[0] << ", "
<< mesh._centerOfMass[1] << ", "
<< mesh._centerOfMass[2] << "> " << std::endl;
printMatrix("expected inertia", expectedInertia);
printMatrix("computed inertia", mesh.m_inertia);
printMatrix("computed inertia", mesh._inertia);
#endif // VERBOSE_UNIT_TESTS
}