LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

position of obj in 3D scene

Solved!
Go to solution

Hello!

 

I need to get position of one object in scene.
I have child and parent. And I move-rotate parent into new position.
Now I want to get position of child in "world", not in parent coordinate system.
Is it possible?
I try to "get translation", but it returns position in parent's system

 

3dmodel.png

0 Kudos
Message 1 of 5
(3,750 Views)

You create a double-sphere Object and place it in a Model.  You move it in the Model, but ask about its transformation relative to itself, and it says (correctly) "You didn't transform me".  Try wiring the Translated Object Out into the Get Translation -- you'll see the effect.  

 

This is a strange coordinate system!  +X is to the right (OK, normal), +Y is towards the viewer (I would have expected away from the viewer), which forces a Right-Hand-Rule +Z to point down (which it does, also the opposite of what I would expect).  Oh, well, at least it's not a Left-Hand Coordinate System (which I've also encountered ...).

 

Bob "I love Geometry" Schor

0 Kudos
Message 2 of 5
(3,710 Views)

Hi Bob.
May be I don't understand you, but what I mean.
I've placed green ball as the child.
And then I've moved and rotated the parent (y + alpha)
And now I want to know, where is the GREEN, not the red ball.

You recommend me to wire the Translated Object Out, but in this case I'll get position of the red ball.

shift.png

0 Kudos
Message 3 of 5
(3,706 Views)
Solution
Accepted by topic author Artem.SPb

So, I've found the solution

- take transformation matrixes

- rotate child coordinates and then shift as the parent.

 

But why I can't get id directly from a child's property/invoke?

 

3d_coords.png

0 Kudos
Message 4 of 5
(3,701 Views)

Welcome to the weird and wonderful world of 3D manipulations in LabVIEW.

 

One I particularly enjoy is that convert coordinate system (cylindrical) is X,Y,Z -> [rho, theta, z]. Its documented so I can't complain about this one. However it calls a DLL to do basic trig so you cant see whats happening. Not sure why.

 

Want to plot this? For a cylindrical plot on a 3d scatter graph it expects your data as [theta, Z, rho] Except this isn't documented :).

At least when you find the code, its done using LV primitives for the trig. However theta is now referred to as phi in the comments (thats ok for me, but maybe confusing for someone less less maths background).

 

In one other place in the code base, the same trig for coordinate conversion is done in a 3rd way using formula nodes to remove the dependency on the DLL from method 1 . I can't remember but I bet the parameter order changed again too 🙂 

 

Don't get me wrong, its powerful and very useful, but there loads of little oddities to trip you up at first.

 

0xDEAD

0 Kudos
Message 5 of 5
(3,688 Views)