On Thu, Jan 8, 2009 at 2:21 PM, Maik Justus <mjus...@gmx.de> wrote:
>
> What is not a problem. It is only a div by zero, if the length of the
> fuselage is zero. (ax==bx, ay==by, az==bz)
Yes. And YASim should check this during loading and report it, so the
model can be fixed. Rather than generating NaNs that end up
who-knows-where.
--
Csaba/Jester
Index: src/FDM/YASim/Airplane.cpp
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Airplane.cpp,v
retrieving revision 1.27
diff -u -r1.27 Airplane.cpp
--- src/FDM/YASim/Airplane.cpp 13 Apr 2008 21:12:36 -0000 1.27
+++ src/FDM/YASim/Airplane.cpp 8 Jan 2009 14:19:07 -0000
@@ -507,6 +507,10 @@
float fwd[3];
Math::sub3(f->front, f->back, fwd);
float len = Math::mag3(fwd);
+ if (len == 0) {
+ _failureMsg = "Zero length fuselage";
+ return 0;
+ }
float wid = f->width;
int segs = (int)Math::ceil(len/wid);
float segWgt = len*wid/segs;
@@ -688,6 +692,10 @@
_model.setGroundEffect(gepos, gespan, 0.15f);
}
+ // solve function below resets failure message
+ // so check if we have any problems and abort here
+ if (_failureMsg) return;
+
solveGear();
if(_wing && _tail) solve();
else
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel