06-07-2019 01:24 PM
Hello!
I need to find rotation matrix (or vector) from one point to another.
I have some couples of points, but here is simple version.
Start point - the one corner of the red flat. End point - the corner of the yellow flat.
I can to calculate coordinates of points, but I have a problem with rotation.
Also I need constant z-rotation for each detail (i.e. one corner of the detal must see to the "nord")
And here the part of code.
06-07-2019 02:50 PM
Maybe it's me but I do not understand your question. Try to break down your question(s) into cases as simple as possible, and ask only one question at a time. Give us the code of what you tried and specifically tell us what is the issue with that code.
06-07-2019 03:25 PM
Hi, Marc!
I'll try
I have an object in scene. Now it a green axis.
And I have a 2 points.
I need rotate and place this object, so it's Z- axis go from one point to another (as the pink line).
My simplified code is attached in first message
And the problem is that Z-axis finished not in green ball
06-07-2019 03:54 PM
I've done a lot of work with rotation matrices, rotation vectors, rotation axes, etc. and I have no idea what you want to do, nor do I understand the figure you are showing, and how it relates to your question. Here's what I think I am seeing:
Bob Schor
06-08-2019 07:46 AM
Usually for alignments like this, I will translate so 0,0,0 is one of the points, then the other point (in a spherical coordinate system) in some distance and two angles.
By rotation of the second object around 2 axes by these angles (in opposite direction) your axis is now aligned, you can then translate everything back to the original 0,0,0.
06-08-2019 03:43 PM
Your question is still not clear and the code you provided is not simple. You should provide just the code related to your problem. We cannot help you if you do not make an effort to make your question simple and understandable.
I will assume that you want to rotate a coordinate system that has its Z-axis going through point P1 and you want to rotate the coordinate system so that the Z-axis passes through point P2.
Since the Z-axis passes through P1, the value of P1 is irrelevant, the initial vector P1 is the Z-axis (0,0,1).
LabVIEW provides a function to rotate 3D object. You have to provide a rotation axis and an angle.
You get the rotation axis by calculating the cross product between the P1 vector and the vector from origin to P2.
You calculate the angle by calculating the dot product between vector P1 and vector P2 (both vectors must be normalized) and then calculating the arccosine. If you have to rotate within another coordinate system, you just need to calculate the two corresponding vectors (P minus origin).
The code would look like this:
06-08-2019 08:50 PM - edited 06-08-2019 08:51 PM
Hello all and thanks for your attention.
I'll try explain again
In general I need a direction from a one point to another.
The red box is a "base". It's fixed. And the white axis is a "world" coordinates. The point (-10,-5,0) is a start point (constant).
Also I have a yellow box. And the point (10,5,0) (relative) is the end point (second point). And this box moves. And the second point moves also.
Next, I have the complex object (it figure from stl, but now it just a green box). This opbject has it's own axis (also rgeen) for anderstanding
I have a six objects and a more complex bases.
First step. The Y-axis of the object must see to direction of 45 degree (for example here, each object has it's own direction).
And second step, the z-axis of the object must see to the second point.
Like here.
In some positions my algorithm work well, but in another the vector or matrix is wrong
06-08-2019 08:52 PM
@deceased wrote:
Usually for alignments like this, I will translate so 0,0,0 is one of the points, then the other point (in a spherical coordinate system) in some distance and two angles.
By rotation of the second object around 2 axes by these angles (in opposite direction) your axis is now aligned, you can then translate everything back to the original 0,0,0.
Yes, I try to do this, but I have a mistake in my code and can't fix it
06-08-2019 08:56 PM
@MarcDub wrote:
You calculate the angle by calculating the dot product between vector P1 and vector P2 (both vectors must be normalized) and then calculating the arccosine. If you have to rotate within another coordinate system, you just need to calculate the two corresponding vectors (P minus origin).
The code would look like this:
I've tried your method, but it doesn't work (or I made a mistake)
Also you need set rotation vi, not a rotate object
06-10-2019 04:17 AM
Could this be the problem that quaternions solve?