From: Braden M. <br...@us...> - 2007-01-01 21:25:23
|
Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17861/src/libopenvrml/openvrml Modified Files: Tag: OpenVRML-0_16-BRANCH script.cpp Log Message: Fixed SFRotation axis normalization checks in the Script node JavaScript binding. Index: script.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/script.cpp,v retrieving revision 1.77 retrieving revision 1.77.2.1 diff -C2 -d -r1.77 -r1.77.2.1 *** script.cpp 6 Aug 2006 06:45:24 -0000 1.77 --- script.cpp 1 Jan 2007 21:25:20 -0000 1.77.2.1 *************** *** 5621,5624 **** --- 5621,5629 ---- } + OPENVRML_LOCAL bool normalized(const openvrml::vec3f & v) + { + return openvrml_::fequal(v.length(), 1.0f); + } + JSBool SFRotation::initObject(JSContext * const cx, JSObject * const obj, *************** *** 5627,5631 **** { const openvrml::vec3f axis(rot[0], rot[1], rot[2]); ! if (axis != axis.normalize()) { JS_ReportError(cx, "axis component of rotation is not normalized"); } --- 5632,5636 ---- { const openvrml::vec3f axis(rot[0], rot[1], rot[2]); ! if (!normalized(axis)) { JS_ReportError(cx, "axis component of rotation is not normalized"); } *************** *** 5712,5716 **** } ! if (axis != axis.normalize()) { JS_ReportError(cx, "axis component of rotation is not normalized"); return JS_FALSE; --- 5717,5721 ---- } ! if (!normalized(axis)) { JS_ReportError(cx, "axis component of rotation is not normalized"); return JS_FALSE; *************** *** 5915,5919 **** &arg_sfdata.field_value()); ! if (argVec.value() != argVec.value().normalize()) { JS_ReportError(cx, "axis component of rotation is not normalized"); return JS_FALSE; --- 5920,5924 ---- &arg_sfdata.field_value()); ! if (!normalized(argVec.value())) { JS_ReportError(cx, "axis component of rotation is not normalized"); return JS_FALSE; |