From 91c024ebece37921988b111bfbf1e6f958d10dd4 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 10 Mar 2006 19:46:16 +0000 Subject: [PATCH] When we are asked to produce no force on a Surface (e.g. a weight that is "off"), make sure the force is actually zero. Kind of a hack -- a better idea would be flag to set at a higher level. --- src/FDM/YASim/Surface.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/FDM/YASim/Surface.cpp b/src/FDM/YASim/Surface.cpp index 24d318842..8e7bafaa6 100644 --- a/src/FDM/YASim/Surface.cpp +++ b/src/FDM/YASim/Surface.cpp @@ -158,6 +158,13 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque) return; } + // special case this so the logic below doesn't produce a non-zero + // force; should probably have a "no force" flag instead... + if(_cx == 0. && _cy == 0. && _cz == 0.) { + for(int i=0; i<3; i++) out[i] = torque[i] = 0.; + return; + } + Math::mul3(1/vel, v, out); // Convert to the surface's coordinates -- 2.39.5