report("xrot", convert(x, pivot, world, orient, 0,0,0)) problem

03-20-2013 02:24 PM
New Contributor III
Hey I need a hand here,
I have only been concerned about orientations around the y-axis for most situations till now.
However now I am working with assets I have placed along roads.
The roads are conformed to a heightmap.
The result in our engine are orientations that are incorrect.

Is there a way to get quaternions back for orientation?


Could you tell me the handedness of the rotations being applied so i know if to correct orientation.
The Euler Angle System being used.

many thanks
0 Kudos
6 Replies
Frequent Contributor
Hey Robert.

Which version of CE are you using ?

I know there was a bug in the convert() function in the 2011 version, which was resolved for the 2012 version.

I have tested exactly this workflow in December and it worked perfectly. See attached image and other stuff.


Let me know this first, then we can dig deeper.

0 Kudos
New Contributor III
Esri CityEngine 2011.2 build 120125 (release, win32-64bit)?
0 Kudos
Frequent Contributor
Hi !

Then it's most probable that this is the bug which got resolved for 2012.

Can you download the 2012 Trial version and test it ?

Let me know if this is an option...

0 Kudos
New Contributor III
Can you Detail the bug here so we know the exact issue?

I believe I am see two different handed returns from the the convert function when pulling back coordinates from roads when compared to other shape geometry, would this be accurate?
0 Kudos
New Contributor II
Hi Robert,
CGA uses a right-handed coordinate system, and rotations are performed in a right-handed manner.

maybe this helps:

How to calculate a 3x3 rotation matrix R from CGA euler angles

alpha, beta, gamma = angles in radians

R = Rx(alpha) * Ry(beta) * Rz(gamma)

// sine, cosine
sa = sin(alpha);
ca = cos(alpha);
sb = sin(beta);
cb = cos(beta);
sg = sin(gamma);
cg = cos(gamma);

R[0][0] = cb*cg;
R[0][1] = sa*sb*cg - ca*sg;
R[0][2] = sa*sg + ca*sb*cg;

R[1][0] = cb*sg;
R[1][1] = ca*cg + sa*sb*sg;
R[1][2] = ca*sb*sg - sa*cg;

R[2][0] = -sb;
R[2][1] = sa*cb;
R[2][2] = ca*cb;

0 Kudos
Frequent Contributor
Hi Robert,

I just found that I the above statement about the bug having been fixed for 2012 was wrong. It's been fixed actually for 2011 already. Time friggin flies! (btw. it also seems to have nothing to do with your specific issue.)

Check the CGA change log at the very bottom of the CGA reference (there's a link)
0 Kudos