Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17885/src/libopenvrml/openvrml
Modified Files:
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.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** script.cpp 31 Aug 2006 06:45:31 -0000 1.78
--- script.cpp 1 Jan 2007 21:25:45 -0000 1.79
***************
*** 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 = openvrml::make_vec3f(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 = openvrml::make_vec3f(rot[0], rot[1], rot[2]);
! if (!normalized(axis)) {
JS_ReportError(cx, "axis component of rotation is not normalized");
}
***************
*** 5710,5714 ****
}
! if (axis != axis.normalize()) {
JS_ReportError(cx, "axis component of rotation is not normalized");
return JS_FALSE;
--- 5715,5719 ----
}
! if (!normalized(axis)) {
JS_ReportError(cx, "axis component of rotation is not normalized");
return JS_FALSE;
***************
*** 5913,5917 ****
&arg_sfdata.field_value());
! if (argVec.value() != argVec.value().normalize()) {
JS_ReportError(cx, "axis component of rotation is not normalized");
return JS_FALSE;
--- 5918,5922 ----
&arg_sfdata.field_value());
! if (!normalized(argVec.value())) {
JS_ReportError(cx, "axis component of rotation is not normalized");
return JS_FALSE;
|