From 7a2c403992ac42b5122beab28df32aafb22f4a57 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 29 May 2008 11:45:31 +0000 Subject: [PATCH] Added code to catch erroneous Dof axis settings --- src/osgPlugins/OpenFlight/PrimaryRecords.cpp | 23 +++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp index 45b7c3ea5..470d9efc0 100644 --- a/src/osgPlugins/OpenFlight/PrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/PrimaryRecords.cpp @@ -31,6 +31,10 @@ #include #include #include + +#include +#include + #include "Registry.h" #include "Document.h" #include "RecordInputStream.h" @@ -385,9 +389,21 @@ protected: osg::Vec3 yAxis = zAxis ^ xAxis; // normalize - xAxis.normalize(); - yAxis.normalize(); - zAxis.normalize(); + float length_x = xAxis.normalize(); + float length_y = yAxis.normalize(); + float length_z = zAxis.normalize(); + + if ((length_x*length_y*length_z)==0.0f) + { + osg::notify(osg::NOTICE)<<"Warning: OpenFlight DegreeOfFreedom::readRecord() found erroneous axis definition:"<