mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:57:58 +02:00
replace tabs with spaces
This commit is contained in:
parent
efbb9b0238
commit
708203089c
2 changed files with 39 additions and 39 deletions
|
@ -86,18 +86,18 @@ void computeTetrahedronInertia(btScalar mass, btVector3* points, btMatrix3x3& in
|
||||||
|
|
||||||
// helper function
|
// helper function
|
||||||
void computePointInertia(const btVector3& point, btScalar mass, btMatrix3x3& inertia) {
|
void computePointInertia(const btVector3& point, btScalar mass, btMatrix3x3& inertia) {
|
||||||
btScalar distanceSquared = point.length2();
|
btScalar distanceSquared = point.length2();
|
||||||
if (distanceSquared > 0.0f) {
|
if (distanceSquared > 0.0f) {
|
||||||
for (uint32_t i = 0; i < 3; ++i) {
|
for (uint32_t i = 0; i < 3; ++i) {
|
||||||
btScalar pointi = point[i];
|
btScalar pointi = point[i];
|
||||||
inertia[i][i] = mass * (distanceSquared - (pointi * pointi));
|
inertia[i][i] = mass * (distanceSquared - (pointi * pointi));
|
||||||
for (uint32_t j = i + 1; j < 3; ++j) {
|
for (uint32_t j = i + 1; j < 3; ++j) {
|
||||||
btScalar offDiagonal = - mass * pointi * point[j];
|
btScalar offDiagonal = - mass * pointi * point[j];
|
||||||
inertia[i][j] = offDiagonal;
|
inertia[i][j] = offDiagonal;
|
||||||
inertia[j][i] = offDiagonal;
|
inertia[j][i] = offDiagonal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this method is included for unit test verification
|
// this method is included for unit test verification
|
||||||
|
@ -204,48 +204,48 @@ btScalar computeTetrahedronVolume(btVector3* points) {
|
||||||
void applyParallelAxisTheorem(btMatrix3x3& inertia, const btVector3& shift, btScalar mass) {
|
void applyParallelAxisTheorem(btMatrix3x3& inertia, const btVector3& shift, btScalar mass) {
|
||||||
// Parallel Axis Theorem says:
|
// Parallel Axis Theorem says:
|
||||||
//
|
//
|
||||||
// Ishifted = Icm + M * [ (R*R)E - R(x)R ]
|
// Ishifted = Icm + M * [ (R*R)E - R(x)R ]
|
||||||
//
|
//
|
||||||
// where R*R = inside product
|
// where R*R = inside product
|
||||||
// R(x)R = outside product
|
// R(x)R = outside product
|
||||||
// E = identity matrix
|
// E = identity matrix
|
||||||
|
|
||||||
btScalar distanceSquared = shift.length2();
|
btScalar distanceSquared = shift.length2();
|
||||||
if (distanceSquared > btScalar(0.0f)) {
|
if (distanceSquared > btScalar(0.0f)) {
|
||||||
for (uint32_t i = 0; i < 3; ++i) {
|
for (uint32_t i = 0; i < 3; ++i) {
|
||||||
btScalar shifti = shift[i];
|
btScalar shifti = shift[i];
|
||||||
inertia[i][i] += mass * (distanceSquared - (shifti * shifti));
|
inertia[i][i] += mass * (distanceSquared - (shifti * shifti));
|
||||||
for (uint32_t j = i + 1; j < 3; ++j) {
|
for (uint32_t j = i + 1; j < 3; ++j) {
|
||||||
btScalar offDiagonal = mass * shifti * shift[j];
|
btScalar offDiagonal = mass * shifti * shift[j];
|
||||||
inertia[i][j] -= offDiagonal;
|
inertia[i][j] -= offDiagonal;
|
||||||
inertia[j][i] -= offDiagonal;
|
inertia[j][i] -= offDiagonal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper function
|
// helper function
|
||||||
void applyInverseParallelAxisTheorem(btMatrix3x3& inertia, const btVector3& shift, btScalar mass) {
|
void applyInverseParallelAxisTheorem(btMatrix3x3& inertia, const btVector3& shift, btScalar mass) {
|
||||||
// Parallel Axis Theorem says:
|
// Parallel Axis Theorem says:
|
||||||
//
|
//
|
||||||
// Ishifted = Icm + M * [ (R*R)E - R(x)R ]
|
// Ishifted = Icm + M * [ (R*R)E - R(x)R ]
|
||||||
//
|
//
|
||||||
// So the inverse would be:
|
// So the inverse would be:
|
||||||
//
|
//
|
||||||
// Icm = Ishifted - M * [ (R*R)E - R(x)R ]
|
// Icm = Ishifted - M * [ (R*R)E - R(x)R ]
|
||||||
|
|
||||||
btScalar distanceSquared = shift.length2();
|
btScalar distanceSquared = shift.length2();
|
||||||
if (distanceSquared > btScalar(0.0f)) {
|
if (distanceSquared > btScalar(0.0f)) {
|
||||||
for (uint32_t i = 0; i < 3; ++i) {
|
for (uint32_t i = 0; i < 3; ++i) {
|
||||||
btScalar shifti = shift[i];
|
btScalar shifti = shift[i];
|
||||||
inertia[i][i] -= mass * (distanceSquared - (shifti * shifti));
|
inertia[i][i] -= mass * (distanceSquared - (shifti * shifti));
|
||||||
for (uint32_t j = i + 1; j < 3; ++j) {
|
for (uint32_t j = i + 1; j < 3; ++j) {
|
||||||
btScalar offDiagonal = mass * shifti * shift[j];
|
btScalar offDiagonal = mass * shifti * shift[j];
|
||||||
inertia[i][j] += offDiagonal;
|
inertia[i][j] += offDiagonal;
|
||||||
inertia[j][i] += offDiagonal;
|
inertia[j][i] += offDiagonal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshMassProperties::MeshMassProperties(const VectorOfPoints& points, const VectorOfIndices& triangleIndices) {
|
MeshMassProperties::MeshMassProperties(const VectorOfPoints& points, const VectorOfIndices& triangleIndices) {
|
||||||
|
|
|
@ -446,7 +446,7 @@ void MeshMassPropertiesTests::runAllTests() {
|
||||||
testParallelAxisTheorem();
|
testParallelAxisTheorem();
|
||||||
testTetrahedron();
|
testTetrahedron();
|
||||||
testOpenTetrahedonMesh();
|
testOpenTetrahedonMesh();
|
||||||
testClosedTetrahedronMesh();
|
testClosedTetrahedronMesh();
|
||||||
testBoxAsMesh();
|
testBoxAsMesh();
|
||||||
//testWithCube();
|
//testWithCube();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue