@@ -155,7 +155,8 @@ class InsertionAlgorithm : public BaseAlgorithm
155155 const auto & lambda =
156156 m_constraintSolver->getLambda ()[mstate.get ()].read ()->getValue ();
157157 SReal norm{0_sreal};
158- for (const auto & l : lambda) {
158+ for (const auto & l : lambda)
159+ {
159160 norm += l.norm ();
160161 }
161162 if (norm > punctureForceThreshold)
@@ -179,9 +180,9 @@ class InsertionAlgorithm : public BaseAlgorithm
179180 // 1.3 Collision with the shaft geometry
180181 if (collisionOutput.size ())
181182 {
182- auto createShaftProximity =
183- Operations::CreateCenterProximity::Operation::get (l_shaftGeom->getTypeInfo ());
184- auto projectOnShaft = Operations::Project::Operation::get (l_shaftGeom);
183+ auto createShaftProximity =
184+ Operations::CreateCenterProximity::Operation::get (l_shaftGeom->getTypeInfo ());
185+ auto projectOnShaft = Operations::Project::Operation::get (l_shaftGeom);
185186 for (const auto & itShaft : *l_shaftGeom)
186187 {
187188 BaseProximity::SPtr shaftProx = createShaftProximity (itShaft.element ());
@@ -191,11 +192,12 @@ class InsertionAlgorithm : public BaseAlgorithm
191192 if (surfProx)
192193 {
193194 surfProx->normalize ();
194-
195+
195196 // 1.2 If not, create a proximity pair for the tip-surface collision
196197 if (d_projective.getValue ())
197198 {
198- shaftProx = projectOnShaft (surfProx->getPosition (), itShaft.element ()).prox ;
199+ shaftProx =
200+ projectOnShaft (surfProx->getPosition (), itShaft.element ()).prox ;
199201 if (!shaftProx) continue ;
200202 shaftProx->normalize ();
201203 }
@@ -225,21 +227,24 @@ class InsertionAlgorithm : public BaseAlgorithm
225227 {
226228 TetrahedronProximity::SPtr tetProx =
227229 dynamic_pointer_cast<TetrahedronProximity>(volProx);
228- double f0 (tetProx->f0 ()), f1 (tetProx->f1 ()), f2 (tetProx->f2 ()),
229- f3 (tetProx->f3 ());
230- bool isInTetra = toolbox::TetrahedronToolBox::isInTetra (
231- tipProx->getPosition (), tetProx->element ()->getTetrahedronInfo (), f0, f1,
232- f2, f3);
233- if (isInTetra)
230+ if (tetProx)
234231 {
235- volProx->normalize ();
236- m_couplingPts.push_back (volProx);
232+ double f0 (tetProx->f0 ()), f1 (tetProx->f1 ()), f2 (tetProx->f2 ()),
233+ f3 (tetProx->f3 ());
234+ bool isInTetra = toolbox::TetrahedronToolBox::isInTetra (
235+ tipProx->getPosition (), tetProx->element ()->getTetrahedronInfo (), f0,
236+ f1, f2, f3);
237+ if (isInTetra)
238+ {
239+ volProx->normalize ();
240+ m_couplingPts.push_back (volProx);
241+ }
237242 }
238243 }
239244 }
240- else // Don't bother with removing the point that was just added
245+ else // Don't bother with removing the point that was just added
241246 {
242- // 2.2. Check whether coupling point should be removed
247+ // 2.2. Check whether coupling point should be removed
243248 ElementIterator::SPtr itShaft = l_shaftGeom->begin (l_shaftGeom->getSize () - 2 );
244249 auto createShaftProximity =
245250 Operations::CreateCenterProximity::Operation::get (itShaft->getTypeInfo ());
@@ -248,7 +253,8 @@ class InsertionAlgorithm : public BaseAlgorithm
248253 const type::Vec3 normal = (edgeProx->element ()->getP1 ()->getPosition () -
249254 edgeProx->element ()->getP0 ()->getPosition ())
250255 .normalized ();
251- if (dot (tip2Pt, normal) > 0_sreal) {
256+ if (dot (tip2Pt, normal) > 0_sreal)
257+ {
252258 m_couplingPts.pop_back ();
253259 }
254260 }
0 commit comments