# Re: [Flightgear-devel] Re: Plea for help: geometry/trigonometry problem

```David Megginson wrote:

```

```I've thought of a simpler way to approach this problem.  Let's say
that I have a plane and the three Euler angles of rotation, phi,
theta, and psi (roll, pitch, and yaw).  Given those three angles, I'd
like to determine which direction around the z axis is most directly
uphill and how steep the hill is.```

`Thanks, and all the best,`

David

`I'm sitting here wiggling a cd around and thinking ...`

If you roll the cd only, the highest point on the disk will be straight out the left/right side depending on the roll direction.

If you pitch the cd only, the highest point on the disk will be straight out the front/back depending on the pitch direction.

It *seems* like if you combine roll and pitch, the highest point on the cd/disk will be a combination of the roll and pitch amounts ... perhaps simple trig functions would apply here, but that's based on shakey intuition only. The vertical component of disk edge movement is relative to sin(angle), if you pitch and roll identical amounts, then your highest point is at a 45 degree offset which seems to fall in line.

Now playing fast and loose, what if you look straight down on a disk ... +X is "up", +Y is right, just a standard 2d cartesian system. Now map the amount of roll to "X" and the amount of pitch to "Y".

The highest point on the disk should be x = sin(roll)*cos(pitch), y = cos(roll)*sin(pitch) and there's probably a - sign that goes in there someplace.

I'm not sure if we can get away with directly mappy roll to X and pitch to Y ... might need some sort of trig function of roll/pitch to get X, Y?

Then it seems like you could take the answer you get when isolating roll/pitch and add in the heading as an offset ... of course that would be dependant on the order your euler angles are designed to be multipled ...

Once you have the most upward pointing vector on the surface of the disk, then it's easy to find the angle with horizontal. Project the most upward pointing vector onto a flat plane, and then figure out the angle between the projected vector and the original vector ...

I'm probably way off here, but maybe this will spark someone else's brain cells to figure out the right way to do this ...

`Curt.`

```--
Curtis Olson        http://www.flightgear.org/~curt
HumanFIRST Program  http://www.humanfirst.umn.edu/
FlightGear Project  http://www.flightgear.org
Unique text:        2f585eeea02e2c79d7b1d8c4963bae2d```

```_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d
```