Linux ToAxes Compile Error (svn 264)

4 views
Skip to first unread message

dermont

unread,
Apr 17, 2007, 9:36:26 AM4/17/07
to Python Ogre Developers

This is a follow on the bug posted on the python-ogre forum and recent
svn update for ToAxes, ToRotationMatrix and ToAngleAxes:

Ubuntu, gcc4.0.3, svn (264). Fresh build (cleared out cache and and
obj files) . This is the compile error:

g++ `pkg-config --cflags OGRE` -I -O3 -I./ -
D"BOOST_PYTHON_MAX_ARITY=19" -fPIC -I/media/hda5/boost -I/media/hda9/
OGRE/src/ogre_v1.4.0/ogrenew/OgreMain/include -I/usr/include/python2.4
-I/media/hda5/boost -c -o build_dir_2.4/ogre_1.4/Quaternion.pypp.os
generated/ogre_1.4/Quaternion.pypp.cpp
generated/ogre_1.4/Quaternion.pypp.cpp: In function
'boost::python::api::object
ToAxes_5d6d3e6ef2fdddf32a1882f45cfa62e7(const Ogre::Quaternion&)':
generated/ogre_1.4/Quaternion.pypp.cpp:38: error: no matching function
for call to 'Ogre::Quaternion::ToAxes(Ogre::Vector3&) const'
/usr/local/include/OGRE/OgreQuaternion.h:153: note: candidates are:
void Ogre::Quaternion::ToAxes(Ogre::Vector3*) const
/usr/local/include/OGRE/OgreQuaternion.h:154: note:
void Ogre::Quaternion::ToAxes(Ogre::Vector3&, Ogre::Vector3&,
Ogre::Vector3&) const

Andy Miller

unread,
Apr 17, 2007, 10:09:12 AM4/17/07
to python-ogre...@googlegroups.com
I've effectively done a rollback (265 = 263) as I tried to fix a problem that I'm not sure is a problem at all....
 
Could you send me some test code for Quaternion's (as I really don't know how they should work) to show where the problem is --- as I suspect it's really a use issue...
 
For example:
>>> import ogre.renderer.OGRE as o
>>> q=o.Quaternion(1,2,3,4)
>>> m=o.Matrix3()
>>> v=o.Vector3()
>>> q.ToAxes(v)
>>> print v
Vector3(-49, 20, 10)
>>> q.ToRotationMatrix(m)
>>> print m[0], m[1], m[2]
(-49.0, 4.0, 22.0) (20.0, -39.0, 20.0) (10.0, 28.0, -25.0)
>>>
 
Cheers
Andy

 

dermont

unread,
Apr 17, 2007, 12:20:45 PM4/17/07
to Python Ogre Developers
I think you are right it looks like I've misunderstood the way
ToAxes(Vector3* akAxis) works in Ogre and also how Python-Ogre
implements it. I belive your current implemention is correct (passing
the vector around as pointer).

Initially when I checked the Ogre source:
//-----------------------------------------------------------------------
void Quaternion::ToAxes (Vector3* akAxis) const
{
Matrix3 kRot;

ToRotationMatrix(kRot);

for (size_t iCol = 0; iCol < 3; iCol++)
{
akAxis[iCol].x = kRot[0][iCol];
akAxis[iCol].y = kRot[1][iCol];
akAxis[iCol].z = kRot[2][iCol];
}
}

I tested with:

//-----------------------------------------------------------------------


>>> import ogre.renderer.OGRE as o
>>> q=o.Quaternion(1,2,3,4)

>>> v=ogre.Vector3()
>>> q.ToAxes(v)
>>> print v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8]
-49.0 20.0 10.0 4.0 -39.0 28.0 22.0 20.0 -25.0
>>> v1=ogre.Vector3()
>>> v2=ogre.Vector3()
>>> v3=ogre.Vector3()
>>> q.ToAxes(v1,v2,v3)
>>> print v1,v2,v3
Vector3(-49, 20, 10) Vector3(4, -39, 28) Vector3(22, 20, -25)


Using the above code on linux crashed. I put two and two together and
came up with five. As you've already stated I shouldn't be using print
v[>2] which caused my initial confusion.

The above was based on some old C++ code (which should probably never
see the light of day):
>>>
//-----------------------------------------------------------------------
Ogre::Quaternion q = Ogre::Quaternion(1,2,3,4);
Vector3 *fptr;

q.ToAxes(fptr);
std::cout << "Vector3(" << fptr->x << "," <<
fptr->y << "," << fptr->z << ")" << std::endl;
std::cout << "Vector3(" << (fptr+1)->x <<","<<
(fptr+1)->y <<"," << (fptr+1)->z << ")" <<
std::endl;
std::cout << "Vector3(" << (fptr+2)->x <<","<<
(fptr+2)->y <<"," << (fptr+2)->z << ")" << std::endl;


Ogre::Vector3 v1= Ogre::Vector3(0.0f,0.0f,0.0f);
Ogre::Vector3 v2= Ogre::Vector3(0.0f,0.0f,0.0f);
Ogre::Vector3 v3= Ogre::Vector3(0.0f,0.0f,0.0f);
q.ToAxes(v1,v2,v3);
std::cout << "Vector3(" << v1.x <<","<< v1.y <<","
<< v1.z << ")" << std::endl;
std::cout << "Vector3(" << v2.x <<","<< v2.y <<","
<< v2.z << ")" << std::endl;
std::cout << "Vector3(" << v3.x <<","<< v3.y <<","
<< v3.z << ")" << std::endl;

Apologies for wasting your time.

Dermont

On Apr 17, 10:09 pm, "Andy Miller" <nzmill...@gmail.com> wrote:
> I've effectively done a rollback (265 = 263) as I tried to fix a problem
> that I'm not sure is a problem at all....
>
> Could you send me some test code for Quaternion's (as I really don't know
> how they should work) to show where the problem is --- as I suspect it's
> really a use issue...
>
> For example:

> *>>> import ogre.renderer.OGRE as o>>> q=o.Quaternion(1,2,3,4)


> >>> m=o.Matrix3()
> >>> v=o.Vector3()
> >>> q.ToAxes(v)
> >>> print v
>
> Vector3(-49, 20, 10)>>> q.ToRotationMatrix(m)
> >>> print m[0], m[1], m[2]
>
> (-49.0, 4.0, 22.0) (20.0, -39.0, 20.0) (10.0, 28.0, -25.0)
>

> >>>*
>
> Cheers
> Andy

Roman Yakovenko

unread,
Apr 17, 2007, 1:31:41 PM4/17/07
to python-ogre...@googlegroups.com

I am not an Ogre or performance guru, but don't you think that Ogre
could\should catch such errors and provide useful error message? May
be they are just waiting for your patch :-)?

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/

Andy Miller

unread,
Apr 17, 2007, 1:53:00 PM4/17/07
to python-ogre...@googlegroups.com
No worries - I also didn't really know how this worked :)

Cheers
Andy

Reply all
Reply to author
Forward
0 new messages