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.

Rotation on 2 axis doesn't give expected result

Started by altair, March 05, 2014, 01:43:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lar

#75
Quote from: samdavo on March 09, 2014, 03:30:04 AM
Let's assume pitch roll (and yaw) are always measured about the model axes rather than the world axes.
Do you get the same result/alignment  if you first apply the roll, then the pitch;  as you do if you reverse the sequence? ( I believe not).
Like I said in an earlier post (my first in this thread?...) Cinema 4D uses the HPB system and no matter the order of the rotations the object always ends up the same. I have tested this myself.

I am totally confuddled as to how this system works. When you enter values in one of the rotation field or drag a 'rotation band', sometimes the other fields retain their values and sometimes their values change.

I read through this section of the C4D manual carefully to see if I can grasp the system but they don't actually explain it, just discuss the benefits of it versus the XYZ axis system. They call it a Euler system and say there are many Euler systems. They say while working the user is actually using the XYZ axis system but internally C4D is using the HPB system. You can actually switch to the HPB system if you want to but they don't suggest it unless your brain can think in abstracts. You mainly rotate in C4D by dragging circular bands so it's mostly visual (for accuracy you can use constraints like dcad's 'increment' in its rotation dialog) but you can also use math to add/subtract/etc values in the rotation fields. So, while a c4d user is thinking like how we think in dcad when rotating, internally c4d is converting XYZ to HPB. This is so when c4d is calculating an animation multiple times (test and finals), no matter what the order of priorities is when calculating actions, the results are always the same.

Lar


prl

Quote from: Lar on March 09, 2014, 08:45:58 PM
Like I said in an earlier post (my first in this thread?...)

Lar, thankfully we have handles for 3d positioning.   I never enter a final object position using three rotation angles. I would not know how.  When I do 3d modeling, I create my parts and pieces at the most logical and convenient place in 3d space and then set three handles and pick them up and bring them to their final 3d location.  Like laying out a rafter on a sawhorse, making the various birds-mouth and ridge and eave plumb cuts and then when the piece is finished picking it up and setting it on the wall.

At this point merely wondering why Sam and I get different results if we are doing the same rotate, elevate, and roll exercise.  For me as long as I observe the global and model axis rules; rotate, elevate, roll  gives me the same as rotate, roll, elevate.  Sam's ship at a dock example.

prl

#77
Quote from: Lar on March 09, 2014, 08:45:58 PM
Like I said in an earlier post (my first in this thread?...) Cinema 4D uses he HPB system

Well Lar, seems we are all talking about the same thing.


QuoteHPB, for Heading, Pitch and Bank, refers to the rotational coordinate system used within Cinema 4D. These coordinates tell Cinema 4D how you wish the object to rotate about its axis (or axis offset).  Heading is the direction axis.  This axis tells you where your object is pointing, or following its nose.  Pitch is the up/down axis of rotation, like nodding your head yes.  Bank is the rotate along the center (heading) axis. The bank axis is relative to your object.  The heading and pitch axes are not, and instead are relative to either the coordinates of the parent (if there is one) or the world coordinates.

Reference: http://www.cineversity.com/wiki/HPB/

In your terminology,   if done sequentially H P B  should give you the same results as H B P provided you honor the global and local axes requirements.

prl

So many ways to refer these terms.  The Dish TV people use Azimuth, Elevation, Skew.

samdavo

#79
Quote from: prl on March 09, 2014, 04:03:06 PM
Sam, you only use the set work plane with the rotate about x by 12 degrees step and you use the small oxy axis in the model.  All other steps use the default XYZ system.
... you will get

; Data for  2  objects.

;Entity 1 is type 1 (Line) on layer 1
; Name string;
; RGB color is: 255, 0, 0
; Line Type: 0 ; Line Width: 0.000000 ; ; Line Type Scale: 1.000000 .
; Group # 0 ; Solid # 0 ; Points: 3
; Selection Status: 1
; String data: 
     9.345448862876 0.982246255947 3.420201433257
     0.000000000000 0.000000000000 0.000000000000
     -0.157619136032 4.901111117109 -0.976865408183

;Entity 2 is type 1 (Line) on layer 1
; Name string;
; RGB color is: 0, 0, 255
; Line Type: 0 ; Line Width: 0.000000 ; ; Line Type Scale: 1.000000 .
; Group # 0 ; Solid # 0 ; Points: 3
; Selection Status: 3
; String data: 
     9.345448862876 0.982246255947 3.420201433257
     0.000000000000 0.000000000000 0.000000000000
     -0.157619136032 4.901111117109 -0.976865408183
In SUMMARY
we seem to be arguing at crossed purposes,  ( I only use local axes and for PITCH then ROLL,  vs ROLL then PITCH)

DETAIL
But to go through my comments one at a time
1. sure if I run your macro I get the 3 points in each line to agree with the above coords (and they are the same , as you say).
2. How did you get it to print out that list of "entities and their properties"?  (I feel I've seen it before,  but I've forgotten lol
3. Just for interest, How did you write the macro? (some sort of recorder?)   I haven;t checked the allocation of xh, xo etc - but thanks, it will be a handy script and principles for future macros :)
4. As a probably minor point,  <pointxyz [xo, yo, zo)]   has an unnecessary closed brackets (but I doubt that affects anything)

More importantly :-
5. ok, I am not sure why you are choosing global XYZ sometimes, and local xyz at other times; nor why you introduce YAW.   I have only been checking local axes , and for PITCH and ROLL only (end of story).   Maybe that explains the difference ?
6. I don't know why you have introduced YAW, but having done so, I don't see why you use Global z for step 1B (rather than local :-
7. Step 2D should be local IMO ( especially if preceded by the YAW rotation)
Quote
1A. YAW "Press any key to do a global rotate about y by 20 degrees"
1B. PITCH "Press any key to do a global rotate about z by 6 degrees"  (surely "global" should be "local" ?)
1C. "Press any key set a local axis work plane"
1D. ROLL "Press any key to do a local rotate about x by 12 degrees"
/////////////////////////////////////////////////////////////////////
draw the 2nd framing square in RED
2A. YAW "press any key to do a global rotate about y by 20 degrees"
2B. "Press any key set a local axis work plane"
2C. ROLL "Press any key to do a local rotate about x by 12 degrees"
2D. PITCH "The temporary work plane has been reset, Press any key to do a global rotate about z by 6 degrees"  (Wow, - this is ok provided you didn't apply the YAW rotation IMO)   

message "Done.  The two framing squares should be identically positioned in 3d space but offset by 1 unit in the z direction"

I disagree with the basics.  - i.e. I would say that the steps should be:-
Quote
1A. ignore YAW /slew for this exercise
1B. PITCH = "Press any key to do a global rotate about z by 6 degrees"  (or local = same thing)
1C. "Press any key set a local axis work plane"
1D. ROLL = "Press any key to do a local rotate about x by 12 degrees"
/////////////////////////////////////////////////////////////////////
draw the 2nd framing square in RED
2A. ignore YAW /slew for this exercise
2B. "Press any key set a local axis work plane" 
2C. ROLL = "Press any key to do a local rotate about x by 12 degrees"
2D. PITCH = " global local rotate about z by 6 degrees"  (only emphasised because YAW would have played havoc with global at this stage)

message "Done.  The two framing squares should be SLIGHTLY DIFFERENT IMO"

prl

Quote from: samdavo on March 10, 2014, 04:25:34 AM
we seem to be arguing at crossed purposes,  ( I only use local axes and for PITCH then ROLL,  vs ROLL then PITCH)

The data is from a modified version of Dt's NewMakeXYZ.d3m.

Why would you purposely only use local axes for both pitch and roll when it doesn't work?  I was merely demonstrating that pitch and roll or roll and pitch can be reversed if you take note of the axes systems for each.  And then I put together the graphics to show those steps .


samdavo

#81
Quote from: prl on March 10, 2014, 06:04:47 AM
Why would you purposely only use local axes for both pitch and roll when it doesn't work? 
yep I forgot to say thanks for all that work.  And thanks for the tips on entity details (NewMakeXYZ) and macro text.

As for the above comment "when it doesn't work"; I'm guessing you are saying that we have proved that in the early part of this thread (?)   

But (FWIW), I believe we showed at the beginning that rotations about global axes give different results depending on sequence ( i.e. altair's original observation);   whereas I was then checking what happened with local axes (and that also doesn't work, or rather, that also depends on sequence).

And also, in the real world, I would just vector sum the rotations and apply that.

ok, Here's a real life example (I'll use XY for horizontal plane).  You are asked to design a bearing to support the low end of a linkspan (walkway) down to a floating pontoon.  The pontoon is rectangular (eg 30 m x 10 m), long X axis perpendicular to the shore, so that waves approaching the shore cause it to pitch 6 degrees  (rotation ry1), and those parallel to the shore cause it to roll 12 degrees (rotation rx1).  Just to complicate things, the walkway is at 45 degrees to both shore and pontoon, and the tide causes the linkspan to vary between level and 10 degrees slope down. (rotation with components ry2 and rx2, both equal to 7 deg nom).

Now (in real life) the easiest option that most engineers would adopt (I believe) would be just add the vectors about x axis  (rx1 + rx2 = 12+7 = 19 deg)  and about y axis ( ry1 + ry2 = 6+7 = 13 deg);  and vector sum them to get rxy = 23 deg about an axis at 56 deg to the shore (or at 34 deg to the x axis).

Now lol it gets better, because you then have to set your bearing ( a single central bearing attached to the low end of the linkspan - there are also 2 at the high shore end, but they are a snack by comparison) between the pontoon which is rocking and rolling, and the linkspan walkway which is going up and down with the tide and at 45 degrees - and it is sliding back and forwards a metre, and has to be guided, anda bolts mustn't clash etc etc :))

In summary, lol, you have enough headaches with all that geometry not to want to worry about whether pitch precedes roll or vice versa. 

BUT CONVERSELY,  I am also a sailor of sorts, and I just started to wonder (as one does lol) what Pitch and Roll really mean !?  i.e are they about local or global?  Looking at the photo of the clipper, suppose it pitched 6 degrees THEN rolled 12 degrees - about what axis would the roll occur? :)  Please don't lose any sleep over this lol.

And it it rolled 12 THEN pitched 6 would it be in a different alignment? (answer yes, no matter whether these effects are defined about global - or about local)

PS I realise you have already given your opinion that roll is about local,  and others might be about global,  but I would have thought they should all be consistent / the same, global or local - 2 cents)

samdavo

PS the jpeg above is a poster of a clipper which I gave to my brother - he has done a lot of sailing - I was also on a yacht between Philippines and Micronesia once, and we went through the eye of a typhoon.  Now that's where you get some pitching and rolling - especially when the waves are
a) big, and
b) coming from a direction 90 degrees to the wind , i.e. where the wind was a few hours beforehand :)   

prl

Quote from: samdavo on March 10, 2014, 03:04:00 PM
But (FWIW), I believe we showed at the beginning that rotations about global axes give different results depending on sequence ( i.e. altair's original observation);   whereas I was then checking what happened with local axes (and that also doesn't work, or rather, that also depends on sequence).

Sam, yes,  you posted a query and answered your own questions. You concluded a global pitch and global roll doesn't work, a local pitch and a local roll doesn't work.

So then I said a global pitch and a local roll will. 

Not sure I follow where this topic has gone.

Dr PR

Sam,

I have stayed out of this pitching and rolling discussion because I suffer from motion sickness. I was in the US Navy for 3 1/2 years so I know all about seasickness!

On one cruise we were in five typhoons and a tropical storm in just three weeks! If you are interested the story is here (2/3 down the page):

http://www.okieboat.com/Free%20steaming.html

Phil
DesignCAD user since 1987

samdavo

#85
Thanks prl and phil
Quote from: prl on March 10, 2014, 03:32:53 PM
1. So then I said a global pitch and a local roll will. 
2. Not sure I follow where this topic has gone.
1. Fair enough.
And that is worth investigating / understanding, and is enlightening in itself.
(In Aus we say it's a Eureka moment).

Yaw about global is equiv to heading or bearing (= perp to strike).
Pitch about global is equiv to elevation ( or dip)

You are right - the one that sets the cat amongst the pidgeons is roll.
Provided that is about the local X axis ( compare "barrel roll"), then great, no problems or ambiguity.
Good point.

2. Having said that, the example I give above of a pontoon bearing is real, and we as engineers are simply told to apply pitch and roll (sometimes more than 12 deg by the way).  And we usually just add global vectors (at least I do).    BTW, these pontoons can weigh in at 300T, and can offload 80T trucks etc, all good.

Thanks for getting to the Holy Grail.

PS I enclose generic sketches of a pontoon brg, (done with SW on that occasion - not that SW is any more accurate than DCAD, in fact, lol, what I like about DCAD is that you can really investigate and doublecheck/test theories like this  :)  )

prl

Quote from: samdavo on March 10, 2014, 03:56:58 PM
Thanks for getting to the Holy Grail.

I always like your adventures.  Even if I don't know where you are:

heading, pitch, bank
azimuth, elevation, skew
azimuth, altitude, skew
rotation, elevation, roll
rotation, tilt, roll
bearing, pitch, roll
.
.
.
Maybe we stick a fork in this one.  :)

samdavo

#87
oK , I set up a set of arcs that circle the earth, much like plane loci that zero in on the point (Lat 0, Long 0), - near Ghana or whatever.

You want to get them to look like airways that zero in on NY.
(Lat 43N,  Long 74W)
You select the set of flightpaths that you have drawn, handle at centre.

Do you rotate them first about longitude, then about latitude?  Or the reverse sequence?
It shouldn't matter (is all I can say lol).
Anyway I've fudged it to something approximating the theoretical. (i.e. all roads lead to NY)
(It's all a bit approximate)

prl

Quote from: samdavo on March 12, 2014, 03:49:45 AM
Do you rotate them first about longitude, then about latitude?  Or the reverse sequence?
It shouldn't matter (is all I can say lol).

Sam, no clue at the moment.  But since I have the highly accurate weather forecast today of 6 to 24 inches of snow, I'll give this some thought.

samdavo

#89
prl, I don't want to waste your time - but here's what I really wanted to do ( and to ask you to help with).

Suppose that crazy birdcage (that lands on New York) was called "birdcage",  (edit - how do I name it that ?)

then how do I write a macro that selects "birdcage", and then rotates it about global Z (to get the 43degN latitude of NY), and then about global Y (to get the 74degW) ?  refer jpeg.

And btw, I don't think it works the other way - but no biggie - in that respect it resembles dip-then-strike,   or elevation-then-bearing etc etc .

This is more about just defining the selection as "birdcage"  (sorry my abilities to define a solid are particularly limited).

(PS I once started a thread to import a "bolt" and then manipulate it as a macro, with rotations etc.  But that particular seed fell upon stone :) )
Appreciate any assistance.
cheers
sam

PS back to birdcage for a moment, it should be possible to write a macro that asks you for your
a) latitude, and
b) longitude
and then presents you with the birdcage landing at your location.  - As if the world was flying to your door to say g'day :)

PS You may have to manually rotate the view to see your location (and the converging flightpaths);  although that is another thing - how do you change the view in a macro? (seriously optional).

Sorry, just that I'm interested in macros, but limited in my abilities / knowledge thereof.