mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 12:39:18 +02:00
refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)
This commit is contained in:
@@ -24,8 +24,7 @@ glm::dvec3 TSpring::ComputateForces(glm::dvec3 const &pPosition1, glm::dvec3 con
|
||||
// VectorDifference(&p1->pos,&p2->pos,&deltaP); // Vector distance
|
||||
auto deltaP = pPosition1 - pPosition2;
|
||||
// dist = VectorLength(&deltaP); // Magnitude of deltaP
|
||||
auto dist = glm::length(deltaP);
|
||||
if( dist > restLen ) {
|
||||
if( auto dist = glm::length(deltaP); dist > restLen ) {
|
||||
|
||||
// Hterm = (dist - spring->restLen) * spring->Ks; // Ks * (dist - rest)
|
||||
auto Hterm = ( dist - restLen ) * Ks; // Ks * (dist - rest)
|
||||
|
||||
Reference in New Issue
Block a user