News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

rotations in 3D

Started by j-wetzel, June 29, 2015, 08:57:24 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

j-wetzel

  I need to rotate points (given in terms of their coordinates) through a given angle about a given axis (given by two of its points) in 3-dimensions.  Has anyone written a macro to acomplish this?  The relevant mathematical formulas, which are not entirely trivial, can be found in many places, unfortunately described in many different terminologies.  The bare-bones formulas in the language of analytic geometry can be found, for example, in Murray, "Rotation about an arbitrary axis in 3 dimensions" (pdf attached), and in many other places. 
--Jack

Rob S

Maybe not much math required.  Designcad has a built-in command to rotate about an axis defined by any line.

So, all you need to do is draw the temporary line using the desired co-ordinates, then select your solid, set the selection handle on the line so it rotates about that point, and run the rotate command, using the "axis defined by a line" parameter.

Or you could write a very short macro to draw the line for you and then run the rotate command with these parameters, and erase the the line again.
User since forever

j-wetzel

Good grief gravy, I never knew that option was there!  Ignorance is somewhat less than bliss, after all.  Thanks, Rob.  You're a grand master!

There is an old theorem of Euler's that says that the product (composite) of two rotations in 3-space is always a rotation (it has something to do with the fact that no matter how a sphere is turned, there are always two antipodal points left unmoved).  Can DC somehow find that axis, given the two other axes and the rotation angles?  Or must I go to a hammer like Mathematica, which I know even less about than DC?

--Jack

Rob S

I'm not even going to try to think about that, it's way too hot out already, with risk of  overheating my head!!!
User since forever

j-wetzel

So, go soak your head!

Regards,
--Jack

samdavo

#5
Herewith some comments (feel free to ignore them :) )
One way to define a rotation (imo) is the artillery method - elevation of the barrel (above horizontal plane), and bearing (rotn about y axis, whether mathematical, or geographical sign convention).   These rotations are about the global reference axes.

Easy enough to do if you do it in two stages, and also can be done in either sequence.
Two rotations are all that you need for a vector (such as a barrel).

Of course mathematicians might like to define angles between a vector and the three global axes.  I believe you will need at least two of these angles plus the approx value of the third so as to identify the quadrant. Otherwise, for instance, there would be two alternative vectors to have an angle of  60 degrees to both x and y axes (2 cents).   

Note that, for a ship (or other object), you can call (bearing and elevation) as (yaw and pitch) - all about global frame of reference...
but you also need to define the third rotation of roll about the local longitudinal axis of the ship.
At least that's what we concluded the last time we discussed this (to the best of my memory).

PS The jpeg shows two options for a vector 110 deg to x axis, and 120deg to z - i.e. this information is not sufficient to define a unique vector (2 cents)

samdavo

#6
Re : Rotations of a ship or other object.
Note that yaw, pitch and roll have to be carefully considered and defined.
Assuming that you need to get to the same orientation irrespective of the sequence, then it is necessary to define yaw and pitch about global reference system,  and roll about the local reference system (with x along the longitudinal axis). 

To define them OTHERWISE you can get a different result with a different sequence.  The attached jpeg shows what WOULD happen if you defined everything about the local reference system.   There is a different result in each case.  i.e. It doesn't work.  ( 2cents).

samdavo

Another way to consider this problem is to use your head ...  as the object :)
Point your nose horizontally and normal to a wall (i.e. at a point, centre on horizon).
Tilt your head up 20 degrees (pitch).  Then to the left 90 degrees (yaw). 

Are you still looking up at 20 deg?  (global frame of reference);
or
Are you looking horizontally over your left shoulder?   (local frame of reference)   

PS I'm just thinking aloud.  :)

Rob S

Quote from: j-wetzel on June 29, 2015, 02:24:42 PM
So, go soak your head!

Regards,

I did that just now by pouring some wine into it.
User since forever

samdavo

Light exercise with repetitions also helps. :)

SManMTB

Totally ignoring the already existing command for this...... rotation can be done by setting the origin at the center of rotation and then convert all point coordinates to polar coordinates relative to the plane or interest (x, Y or Z) and then adding the rotation angle to the polar coordinates and convert back to normal x,y,z coordinates.

Repeat for each axis.... yes a major pain.
:)

samdavo

Sman - agreed.
But also , you do not get the same result if you rotate a vector 45 degrees about x, then y , then z (global axes)
compared to the result when you rotate it 45 degrees about z, then y , then x (also global axes)  (2 cents)

samdavo

Here's a question:-  How would you define the rotation of a person in this ride compared to global and/or local reference axes?

Or maybe it's easier to define the apparent rotation of the external (white) supports relative to the rider? lol. 
https://www.youtube.com/watch?v=zSP_ykyU3wY

prl

#13
Quote from: samdavo on July 03, 2015, 06:49:58 PM
Here's a question:-  How would you define the rotation of a person in this ride compared to global and/or local reference axes?

I can easily do the math to spatially locate the person, but determining where the puke goes requires acceleration information as a function of time :)

And to continue the joke in my mind, JW's initial post,  how to tell someone to "rotate about an arbitrary axis in 3d".   I would need to measure the time delay between uttering that expression and getting hit in the nose.  This would give me the appropriate "duck or run" time.

Happy 4th folks.