Commit c02f9d14 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

Merge branch 'ImproveUncrustifyFormat' into 'master'

Improve code formatting with uncrustify

See merge request !320
parents ba159257 acd4c87b
Pipeline #139542 running with stage
......@@ -61,7 +61,6 @@ int main()
LOG(WARNING) << "Phantom device option not enabled during build!";
#endif
// Load Mesh
auto mesh = MeshIO::read(iMSTK_DATA_ROOT "/asianDragon/asianDragon.obj");
auto meshObject = std::make_shared<VisualObject>("meshObject");
......
......@@ -19,7 +19,6 @@
=========================================================================*/
#include "imstkSimulationManager.h"
#include "imstkTetrahedralMesh.h"
......
......@@ -84,7 +84,7 @@ int main()
if (time - lastTime > 1000)
{
auto seconds = (int)((lastTime - startTime) / 1000);
windowText->setText("Elapsed Time: " + std::to_string(seconds)+ "s");
windowText->setText("Elapsed Time: " + std::to_string(seconds) + "s");
lastTime = time;
}
......
......@@ -68,7 +68,6 @@ int main()
}
auto colorsGVMesh = volMesh->getMeshGraph().doGreedyColoring(true);
auto surfMesh = std::make_shared<SurfaceMesh>();
volMesh->extractSurfaceMesh(surfMesh, true);
auto colorsGSMesh = surfMesh->getMeshGraph().doGreedyColoring(true);
......
......@@ -67,13 +67,13 @@ int main()
Color color = Color((float)x / resolution, (float)y / resolution, (float)z / resolution);
points[index + 0] = Vec3d(x, y, z);
points[index + 1] = Vec3d(x, y, z+1);
points[index + 2] = Vec3d(x, y+1, z);
points[index + 3] = Vec3d(x, y+1, z+1);
points[index + 4] = Vec3d(x+1, y, z);
points[index + 5] = Vec3d(x+1, y, z+1);
points[index + 6] = Vec3d(x+1, y+1, z);
points[index + 7] = Vec3d(x+1, y+1, z+1);
points[index + 1] = Vec3d(x, y, z + 1);
points[index + 2] = Vec3d(x, y + 1, z);
points[index + 3] = Vec3d(x, y + 1, z + 1);
points[index + 4] = Vec3d(x + 1, y, z);
points[index + 5] = Vec3d(x + 1, y, z + 1);
points[index + 6] = Vec3d(x + 1, y + 1, z);
points[index + 7] = Vec3d(x + 1, y + 1, z + 1);
colors[index + 0] = color;
colors[index + 1] = color;
......
......@@ -48,7 +48,7 @@ int main()
static const int nRows = 5;
static const int nCols = 5;
const double epsilon = 1e-5;
vertList.resize(nRows*nCols);
vertList.resize(nRows * nCols);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
std::cout << " initialPositions = {" << std::endl;
......@@ -56,10 +56,10 @@ int main()
{
for (int j = 0; j < nCols; j++)
{
vertList[i*nCols + j] = Vec3d((double)dx*i, 1.0, (double)dy*j);
std::cout << vertList[i*nCols + j][0] << ", "
<< vertList[i*nCols + j][1] << ", "
<< vertList[i*nCols + j][2] << ", ";
vertList[i * nCols + j] = Vec3d((double)dx * i, 1.0, (double)dy * j);
std::cout << vertList[i * nCols + j][0] << ", "
<< vertList[i * nCols + j][1] << ", "
<< vertList[i * nCols + j][2] << ", ";
}
std::cout << std::endl;
}
......@@ -74,8 +74,8 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, (i + 1)*nCols + j, i*nCols + j + 1 } };
tri[1] = { { (i + 1)*nCols + j + 1, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[0] = { { i*nCols + j, (i + 1) * nCols + j, i * nCols + j + 1 } };
tri[1] = { { (i + 1) * nCols + j + 1, i * nCols + j + 1, (i + 1) * nCols + j } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......@@ -120,9 +120,9 @@ int main()
// Method to call after the simulation is done running
static StdVectorOfVec3d lastPositions; // Vertex positions at the last iteration
lastPositions.resize(nRows*nCols);
lastPositions.resize(nRows * nCols);
static StdVectorOfVec3d beforeLastPositions; // Vertex positions at the (N-1) iteration
beforeLastPositions.resize(nRows*nCols);
beforeLastPositions.resize(nRows * nCols);
auto func =
[&surfMesh](Module* module)
......@@ -132,8 +132,8 @@ int main()
{
for (int j = 0; j < nCols; j++)
{
beforeLastPositions[i*nCols + j] = lastPositions[i*nCols + j];
lastPositions[i*nCols + j] = newPositions[i*nCols + j];
beforeLastPositions[i * nCols + j] = lastPositions[i * nCols + j];
lastPositions[i * nCols + j] = newPositions[i * nCols + j];
}
}
};
......@@ -183,7 +183,7 @@ int main()
{
for (int j = 0; j < nCols; j++)
{
std::cout << lastPositions[i*nCols + j][0] << ", " << lastPositions[i*nCols + j][1] << ", " << lastPositions[i*nCols + j][2] << ", " << std::endl;
std::cout << lastPositions[i * nCols + j][0] << ", " << lastPositions[i * nCols + j][1] << ", " << lastPositions[i * nCols + j][2] << ", " << std::endl;
}
}
......@@ -194,13 +194,13 @@ int main()
for (int k = 0; k < 3; ++k)
{
sameLastStateSuccess &= vtkMathUtilities::FuzzyCompare(
beforeLastPositions[i*nCols + j][k], lastPositions[i*nCols + j][k], epsilon);
beforeLastPositions[i * nCols + j][k], lastPositions[i * nCols + j][k], epsilon);
expectedLastStateSuccess &= vtkMathUtilities::FuzzyCompare(
lastPositions[i*nCols + j][k], expectedFinalPositions[i*nCols + j][k]);
lastPositions[i * nCols + j][k], expectedFinalPositions[i * nCols + j][k]);
if (!expectedLastStateSuccess)
{
std::cout << lastPositions[i*nCols + j][k] << " " << expectedFinalPositions[i*nCols + j][k]<< std::endl;
std::cout << lastPositions[i * nCols + j][k] << " " << expectedFinalPositions[i * nCols + j][k] << std::endl;
expectedLastStateSuccess = true;
}
}
......
......@@ -44,14 +44,14 @@ int main()
const double height = 10.0;
const int nRows = 11;
const int nCols = 11;
vertList.resize(nRows*nCols);
vertList.resize(nRows * nCols);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
for (int i = 0; i < nRows; ++i)
{
for (int j = 0; j < nCols; j++)
{
vertList[i*nCols + j] = Vec3d((double)dx*i, 1.0, (double)dy*j);
vertList[i * nCols + j] = Vec3d((double)dx * i, 1.0, (double)dy * j);
}
}
surfMesh->setInitialVertexPositions(vertList);
......@@ -64,8 +64,8 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, (i + 1)*nCols + j, i*nCols + j + 1 } };
tri[1] = { { (i + 1)*nCols + j + 1, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[0] = { { i*nCols + j, (i + 1) * nCols + j, i * nCols + j + 1 } };
tri[1] = { { (i + 1) * nCols + j + 1, i * nCols + j + 1, (i + 1) * nCols + j } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......
......@@ -51,7 +51,6 @@ int main()
//tetMesh->scale(5., Geometry::TransformType::ApplyToData);
//tetMesh->translate(Vec3d(0., -5., -5.) , Geometry::TransformType::ApplyToData);
auto surfMesh = std::make_shared<SurfaceMesh>();
auto surfMeshVisual = std::make_shared<SurfaceMesh>();
auto volTetMesh = std::dynamic_pointer_cast<TetrahedralMesh>(tetMesh);
......@@ -120,7 +119,7 @@ int main()
double height = 60.0;
int nRows = 10;
int nCols = 10;
int corner[4] = { 1, nRows, nRows*nCols - nCols + 1, nRows*nCols };
int corner[4] = { 1, nRows, nRows * nCols - nCols + 1, nRows * nCols };
char intStr[33];
std::string fixed_corner;
for (unsigned int i = 0; i < 4; ++i)
......@@ -128,16 +127,16 @@ int main()
std::sprintf(intStr, "%d", corner[i]);
fixed_corner += std::string(intStr) + ' ';
}
vertList.resize(nRows*nCols);
vertList.resize(nRows * nCols);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
for (int i = 0; i < nRows; ++i)
{
for (int j = 0; j < nCols; j++)
{
const double y = (double)dy*j;
const double x = (double)dx*i;
vertList[i*nCols + j] = Vec3d(x - 30, -10, y - 30);
const double y = (double)dy * j;
const double x = (double)dx * i;
vertList[i * nCols + j] = Vec3d(x - 30, -10, y - 30);
}
}
clothMesh->setInitialVertexPositions(vertList);
......@@ -150,8 +149,8 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[1] = { { (i + 1)*nCols + j + 1, (i + 1)*nCols + j, i*nCols + j + 1 } };
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1) * nCols + j } };
tri[1] = { { (i + 1) * nCols + j + 1, (i + 1) * nCols + j, i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......@@ -224,7 +223,6 @@ int main()
volTetMesh1->extractSurfaceMesh(surfMesh1);
volTetMesh1->extractSurfaceMesh(surfMeshVisual1);
auto deformMapP2V1 = std::make_shared<OneToOneMap>();
deformMapP2V1->setMaster(volTetMesh1);
deformMapP2V1->setSlave(surfMeshVisual1);
......@@ -274,16 +272,16 @@ int main()
const double height = 100.0;
const int nRows = 2;
const int nCols = 2;
vertList.resize(nRows*nCols);
vertList.resize(nRows * nCols);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
for (int i = 0; i < nRows; ++i)
{
for (int j = 0; j < nCols; j++)
{
const double y = (double)dy*j;
const double x = (double)dx*i;
vertList[i*nCols + j] = Vec3d(x - 50, -10.0, y - 50);
const double y = (double)dy * j;
const double x = (double)dx * i;
vertList[i * nCols + j] = Vec3d(x - 50, -10.0, y - 50);
}
}
......@@ -294,8 +292,8 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[1] = { { (i + 1)*nCols + j + 1, (i + 1)*nCols + j, i*nCols + j + 1 } };
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1) * nCols + j } };
tri[1] = { { (i + 1) * nCols + j + 1, (i + 1) * nCols + j, i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......
......@@ -90,16 +90,16 @@ int main()
double height = 40.0;
int nRows = 2;
int nCols = 2;
vertList.resize(nRows*nCols*nSides);
vertList.resize(nRows * nCols * nSides);
const double dy = width / (double)(nCols - 1);
const double dx = height / (double)(nRows - 1);
for (int i = 0; i < nRows; ++i)
{
for (int j = 0; j < nCols; j++)
{
const double y = (double)dy*j;
const double x = (double)dx*i;
vertList[i*nCols + j] = Vec3d(x - 20, -10.0, y - 20);
const double y = (double)dy * j;
const double x = (double)dx * i;
vertList[i * nCols + j] = Vec3d(x - 20, -10.0, y - 20);
}
}
......@@ -110,8 +110,8 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1)*nCols + j } };
tri[1] = { { (i + 1)*nCols + j + 1, (i + 1)*nCols + j, i*nCols + j + 1 } };
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1) * nCols + j } };
tri[1] = { { (i + 1) * nCols + j + 1, (i + 1) * nCols + j, i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......@@ -129,10 +129,10 @@ int main()
{
for (int j = 0; j < nCols; j++)
{
const double z = (double)dz*j;
const double x = (double)dx1*i;
vertList[(nPointPerSide)+i*nCols + j] = Vec3d(x - 20, z - 10.0, 20);
vertList[(nPointPerSide * 2) + i*nCols + j] = Vec3d(x - 20, z - 10.0, -20);
const double z = (double)dz * j;
const double x = (double)dx1 * i;
vertList[(nPointPerSide) + i * nCols + j] = Vec3d(x - 20, z - 10.0, 20);
vertList[(nPointPerSide * 2) + i * nCols + j] = Vec3d(x - 20, z - 10.0, -20);
}
}
......@@ -142,12 +142,12 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { (nPointPerSide)+i*nCols + j, (nPointPerSide)+i*nCols + j + 1, (nPointPerSide)+(i + 1)*nCols + j } };
tri[1] = { { (nPointPerSide)+(i + 1)*nCols + j + 1, (nPointPerSide)+(i + 1)*nCols + j, (nPointPerSide)+i*nCols + j + 1 } };
tri[0] = { { (nPointPerSide) + i * nCols + j, (nPointPerSide) + i * nCols + j + 1, (nPointPerSide) + (i + 1) * nCols + j } };
tri[1] = { { (nPointPerSide) + (i + 1) * nCols + j + 1, (nPointPerSide) + (i + 1) * nCols + j, (nPointPerSide) + i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
tri[0] = { { (nPointPerSide * 2) + i*nCols + j, (nPointPerSide * 2) + i*nCols + j + 1, (nPointPerSide * 2) + (i + 1)*nCols + j } };
tri[1] = { { (nPointPerSide * 2) + (i + 1)*nCols + j + 1, (nPointPerSide * 2) + (i + 1)*nCols + j, (nPointPerSide * 2) + i*nCols + j + 1 } };
tri[0] = { { (nPointPerSide * 2) + i * nCols + j, (nPointPerSide * 2) + i * nCols + j + 1, (nPointPerSide * 2) + (i + 1) * nCols + j } };
tri[1] = { { (nPointPerSide * 2) + (i + 1) * nCols + j + 1, (nPointPerSide * 2) + (i + 1) * nCols + j, (nPointPerSide * 2) + i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......@@ -164,10 +164,10 @@ int main()
{
for (int j = 0; j < nCols; j++)
{
const double z = (double)dz1*j;
const double y = (double)dy1*i;
vertList[(nPointPerSide * 3) + i*nCols + j] = Vec3d(20, z - 10.0, y - 20);
vertList[(nPointPerSide * 4) + i*nCols + j] = Vec3d(-20, z - 10.0, y - 20);
const double z = (double)dz1 * j;
const double y = (double)dy1 * i;
vertList[(nPointPerSide * 3) + i * nCols + j] = Vec3d(20, z - 10.0, y - 20);
vertList[(nPointPerSide * 4) + i * nCols + j] = Vec3d(-20, z - 10.0, y - 20);
}
}
......@@ -177,12 +177,12 @@ int main()
for (std::size_t j = 0; j < nCols - 1; j++)
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { (nPointPerSide * 3) + i*nCols + j, (nPointPerSide * 3) + i*nCols + j + 1, (nPointPerSide * 3) + (i + 1)*nCols + j } };
tri[1] = { { (nPointPerSide * 3) + (i + 1)*nCols + j + 1, (nPointPerSide * 3) + (i + 1)*nCols + j, (nPointPerSide * 3) + i*nCols + j + 1 } };
tri[0] = { { (nPointPerSide * 3) + i * nCols + j, (nPointPerSide * 3) + i * nCols + j + 1, (nPointPerSide * 3) + (i + 1) * nCols + j } };
tri[1] = { { (nPointPerSide * 3) + (i + 1) * nCols + j + 1, (nPointPerSide * 3) + (i + 1) * nCols + j, (nPointPerSide * 3) + i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
tri[0] = { { (nPointPerSide * 4) + i*nCols + j, (nPointPerSide * 4) + i*nCols + j + 1, (nPointPerSide * 4) + (i + 1)*nCols + j } };
tri[1] = { { (nPointPerSide * 4) + (i + 1)*nCols + j + 1, (nPointPerSide * 4) + (i + 1)*nCols + j, (nPointPerSide * 4) + i*nCols + j + 1 } };
tri[0] = { { (nPointPerSide * 4) + i * nCols + j, (nPointPerSide * 4) + i * nCols + j + 1, (nPointPerSide * 4) + (i + 1) * nCols + j } };
tri[1] = { { (nPointPerSide * 4) + (i + 1) * nCols + j + 1, (nPointPerSide * 4) + (i + 1) * nCols + j, (nPointPerSide * 4) + i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......@@ -195,13 +195,11 @@ int main()
auto floorMeshPhysics = std::make_shared<SurfaceMesh>();
floorMeshPhysics->initialize(vertList, triangles);
auto floorMapP2V = std::make_shared<OneToOneMap>();
floorMapP2V->setMaster(floorMeshPhysics);
floorMapP2V->setSlave(floorMeshVisual);
floorMapP2V->compute();
auto floorMapP2C = std::make_shared<OneToOneMap>();
floorMapP2C->setMaster(floorMeshPhysics);
floorMapP2C->setSlave(floorMeshColliding);
......
......@@ -41,15 +41,15 @@ StdVectorOfVec3d generateSphereShapeFluid(const double particleRadius)
StdVectorOfVec3d particles;
particles.reserve(N * N * N);
for(size_t i = 0; i < N; ++i)
for (size_t i = 0; i < N; ++i)
{
for(size_t j = 0; j < N; ++j)
for (size_t j = 0; j < N; ++j)
{
for(size_t k = 0; k < N; ++k)
for (size_t k = 0; k < N; ++k)
{
Vec3d ppos = lcorner + Vec3d(spacing * double(i), spacing * double(j), spacing * double(k));
Vec3d cx = ppos - sphereCenter;
if(cx.squaredNorm() < sphereRadiusSqr)
if (cx.squaredNorm() < sphereRadiusSqr)
{
particles.push_back(ppos);
}
......@@ -74,11 +74,11 @@ StdVectorOfVec3d generateBoxShapeFluid(const double particleRadius)
StdVectorOfVec3d particles;
particles.reserve(N * N * N);
for(size_t i = 0; i < N; ++i)
for (size_t i = 0; i < N; ++i)
{
for(size_t j = 0; j < N; ++j)
for (size_t j = 0; j < N; ++j)
{
for(size_t k = 0; k < N; ++k)
for (size_t k = 0; k < N; ++k)
{
Vec3d ppos = boxLowerCorner + Vec3d(spacing * double(i), spacing * double(j), spacing * double(k));
particles.push_back(ppos);
......@@ -100,11 +100,10 @@ StdVectorOfVec3d generateBunnyShapeFluid(const double particleRadius)
return particles;
}
std::shared_ptr<SPHObject> generateFluid(const std::shared_ptr<Scene>&scene, int sceneIdx, const double particleRadius)
{
StdVectorOfVec3d particles;
switch(sceneIdx)
switch (sceneIdx)
{
case 1:
particles = generateSphereShapeFluid(particleRadius);
......@@ -142,7 +141,7 @@ std::shared_ptr<SPHObject> generateFluid(const std::shared_ptr<Scene>&scene, int
// configure model
auto sphParams = std::make_shared<SPHModelConfig>(particleRadius);
sphParams->m_bNormalizeDensity = true;
if(sceneIdx == 2) // highly viscous fluid
if (sceneIdx == 2) // highly viscous fluid
{
sphParams->m_RatioKernelOverParticleRadius = 6.0;
sphParams->m_ViscosityFluid = 0.5;
......
......@@ -23,7 +23,6 @@
#include "imstkSPHObject.h"
#include "imstkAPIUtilities.h"
using namespace imstk;
std::shared_ptr<SPHObject> generateFluid(const std::shared_ptr<Scene>&scene, int sceneIdx, const double particleRadius);
......@@ -43,30 +42,30 @@ int main(int argc, char* argv[])
double particleRadius = 0.1;
// Parse command line arguments
for(int i = 1; i < argc; ++i)
for (int i = 1; i < argc; ++i)
{
auto param = std::string(argv[i]);
if(param.find("threads") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
if (param.find("threads") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
{
threads = std::stoi(param.substr(param.find_first_of("=") + 1));
}
else if(param.find("scene") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
else if (param.find("scene") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
{
sceneIdx = std::stoi(param.substr(param.find_first_of("=") + 1));
if(sceneIdx < 1 )
if (sceneIdx < 1)
{
sceneIdx = 1;
}
else if(sceneIdx > 3)
else if (sceneIdx > 3)
{
sceneIdx = 3;
}
LOG(INFO) << "Scene ID: " << sceneIdx;
}
else if(param.find("radius") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
else if (param.find("radius") != std::string::npos &&
param.find_first_of("=") != std::string::npos)
{
particleRadius = std::stod(param.substr(param.find_first_of("=") + 1));
LOG(INFO) << "Particle radius: " << particleRadius;
......@@ -74,7 +73,7 @@ int main(int argc, char* argv[])
}
// Particle in this scene is pre-generated using particle radius 0.08
if(sceneIdx == 3)
if (sceneIdx == 3)
{
particleRadius = 0.08;
}
......@@ -88,16 +87,16 @@ int main(int argc, char* argv[])
// Collision between fluid and solid objects
auto colGraph = scene->getCollisionGraph();
for(auto& solid: solids)
for (auto& solid: solids)
{
if(std::dynamic_pointer_cast<Plane>(solid->getCollidingGeometry()))
if (std::dynamic_pointer_cast<Plane>(solid->getCollidingGeometry()))
{
colGraph->addInteractionPair(fluidObj, solid,
CollisionDetection::Type::PointSetToPlane,
CollisionHandling::Type::SPH,
CollisionHandling::Type::None);
}
else if(std::dynamic_pointer_cast<Sphere>(solid->getCollidingGeometry()))
else if (std::dynamic_pointer_cast<Sphere>(solid->getCollidingGeometry()))
{
colGraph->addInteractionPair(fluidObj, solid,
CollisionDetection::Type::PointSetToSphere,
......
......@@ -229,7 +229,7 @@ std::vector<std::shared_ptr<CollidingObject>> generateSolidsScene3(const std::sh
std::vector<std::shared_ptr<CollidingObject>> generateSolids(const std::shared_ptr<Scene>& scene, int sceneIdx)
{
switch(sceneIdx)
switch (sceneIdx)
{
case 1:
return generateSolidsScene1(scene);
......
......@@ -22,7 +22,6 @@
#ifndef imstkRenderParticleEmitter_h
#define imstkRenderParticleEmitter_h
#include <memory>
#include <vector>
......
......@@ -28,7 +28,8 @@
#include <g3log/g3log.hpp>
namespace imstk {
namespace imstk
{
void
BidirectionalPlaneToSphere::computeCollisionData()
{
......@@ -42,26 +43,26 @@ BidirectionalPlaneToSphere::computeCollisionData()
Vec3d n = m_planeA->getNormal();
// Compute shortest distance
double d = (sphereBPos-planeAPos).dot(n);
double d = (sphereBPos - planeAPos).dot(n);
// Define sphere to plane direction
Vec3d dirAToB = n;
if( d < 0 )
if (d < 0)
{
d = -d;
dirAToB = -n;
}
// Return if no penetration
double penetrationDepth = r-d;
if ( penetrationDepth <= 0)
double penetrationDepth = r - d;
if (penetrationDepth <= 0)
{
return;
}
// Compute collision points
Vec3d planeAColPt = sphereBPos - dirAToB*d;
Vec3d sphereBColPt = sphereBPos - dirAToB*r;