Coordinate system confusion

Coordinate system confusion

Anonymous
Not applicable
1,719 Views
3 Replies
Message 1 of 4

Coordinate system confusion

Anonymous
Not applicable
Hi there!
I´m quite confused about the coordinate system Inventor uses.

I got a set of Edge objects from an EdgeCollection, which I get from the current selection, which works fine.
On each of these Edge objects I call CalculateStrokes(). Now I lock the resulting SAFEARRAY to get a pointer to the array data. This array is then converted into a set of "Keyframe" objects (my own class):

//get position from vertexData
kf.pos.x = vertexData[(indexData-1)*3];
kf.pos.y = vertexData[(indexData-1)*3+1];
kf.pos.z = vertexData[(indexData-1)*3+2];

everything fine so far, I just wanted to post this part of my code so you can see where I get my position data from.

Furthermore I get the normal at that point of the edge through the faces they belong to. I get the data of this normal in a similar fashion: x is retrieved from the first component, y from the second and z from the third component like this:

returnVec->x = p_FaceNormals[closestVertex*3];
returnVec->y = p_FaceNormals[closestVertex*3+1];
returnVec->z = p_FaceNormals[closestVertex*3+2];

Okay, now to the confusion:
I am used to the following coordinate system (probably from using at school back then):
+X is pointing to the right, +Y is pointing upwards and +Z is pointing towards you. According to the API documentation (topic Transient Geometry, at the paragraph on matrices as coordinate systems), Inventor is supposed to use that system, too.
However, if I output the unchanged coordinates I retrieved from that Edge, +X seems to be pointing right, +Y towards you (hard to tell) and +Z upwards.
Same for the normals I retrieved: I swap Y and Z coordinates in order to get into "my coordinate system"....

Okay, that´s my problem: It would be great to _definitely know_ which coordinate system Inventor uses in that data I retrieve from an Edge with CalculateStrokes and from a Face with CalculateFacets. So, is it a left-handed or right-handed system, which directions are the axes pointing to?

Thanks for reading and answering.
0 Likes
1,720 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Technically, the coordinate system Inventor uses is a right-handed
coordinate system. It's customary to show a right-handed coordinate system
as you said; X is pointing towards the right, Y is pointing up, and Z is
coming out towards you. However, in reality all that is being specified is
the X and Y are perpendicular to one another and Z is coming out of the
plane defined by X an Y where the Z direction is defined using the
right-hand rule. That is if you point your fingers in the the direction of
the X axis and then rotate them the 90 degress to the Y axis, your thumb is
pointing in the direction of the Z axis. A left-handed coordinate system
would have the Z axis in the opposite direction.

The coordinate system that you describe your coordinates coming back in are
in a right-hand coordinate system so they are valid coordinates. If you
change your view orientation so that X is the right, Y is up, and Z is
coming out then the results will probably make more sense to you. It's just
that "up", "left", and "right" are very subjective in a system where you can
manipulate the view to any orientaion. However, rotating the view does not
change the coordinate system the part is based on. It's just repositioning
the virtual camera within that coordinate system. Hopefully this makes some
sense.
--
Brian Ekins
Autodesk Inventor API

wrote in message news:5159985@discussion.autodesk.com...
Hi there!
I´m quite confused about the coordinate system Inventor uses.

I got a set of Edge objects from an EdgeCollection, which I get from the
current selection, which works fine.
On each of these Edge objects I call CalculateStrokes(). Now I lock the
resulting SAFEARRAY to get a pointer to the array data. This array is then
converted into a set of "Keyframe" objects (my own class):

//get position from vertexData
kf.pos.x = vertexData[(indexData-1)*3];
kf.pos.y = vertexData[(indexData-1)*3+1];
kf.pos.z = vertexData[(indexData-1)*3+2];

everything fine so far, I just wanted to post this part of my code so you
can see where I get my position data from.

Furthermore I get the normal at that point of the edge through the faces
they belong to. I get the data of this normal in a similar fashion: x is
retrieved from the first component, y from the second and z from the third
component like this:

returnVec->x = p_FaceNormals[closestVertex*3];
returnVec->y = p_FaceNormals[closestVertex*3+1];
returnVec->z = p_FaceNormals[closestVertex*3+2];

Okay, now to the confusion:
I am used to the following coordinate system (probably from using at school
back then):
+X is pointing to the right, +Y is pointing upwards and +Z is pointing
towards you. According to the API documentation (topic Transient Geometry,
at the paragraph on matrices as coordinate systems), Inventor is supposed to
use that system, too.
However, if I output the unchanged coordinates I retrieved from that Edge,
+X seems to be pointing right, +Y towards you (hard to tell) and +Z upwards.
Same for the normals I retrieved: I swap Y and Z coordinates in order to get
into "my coordinate system"....

Okay, that´s my problem: It would be great to _definitely know_ which
coordinate system Inventor uses in that data I retrieve from an Edge with
CalculateStrokes and from a Face with CalculateFacets. So, is it a
left-handed or right-handed system, which directions are the axes pointing
to?

Thanks for reading and answering.
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thx for your answer!
So Inventor is actually using a right-handed coordinate system. Good to know that. Am I correct that the only thing I have to do to convert right-handed to left-handed is to invert the 3rd component?
0 Likes
Message 4 of 4

Anonymous
Not applicable
Yes, the Z component is inverted. Another difference between left and
right-handed coordinate systems is that in a right-handed system positive
rotations are Couterclockwise about the axis of rotation. In a left-handed
system, positive rotation is Clockwise.
--
Brian Ekins
Autodesk Inventor API

wrote in message news:5160282@discussion.autodesk.com...
Thx for your answer!
So Inventor is actually using a right-handed coordinate system. Good to know
that. Am I correct that the only thing I have to do to convert right-handed
to left-handed is to invert the 3rd component?
0 Likes