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

```David Megginson wrote:

```

`On Wed, 03 Nov 2004 16:02:19 -0600, Jon S Berndt <[EMAIL PROTECTED]> wrote:`

```After having scribbled for a LITTLE WHILE on the back of an envelope
;-) I am thinking that what you want is this:```

`-atan2(-phi,theta)`

but I'll have to play a little bit more. I think this would give you
the angle about the local vertical from the aircraft X axis to the
most vertical ascent angle given the plane located by the aircraft X
and Y axes.

I put it in a Perl script and played with it for different values of
phi and theta, and all of the results looked reasonable. Now, how can
I calculate the most vertical ascent angle itself?

1. a "plane" in the geometrical sense can be defined with a point and a vector that is perpedicular to that plane. Define a plane by picking your current location as the point, and pick the local up vector (opposite of the gravity vector) as your perpendicular vector.

2. define a vector as the x,y,z distances to the highest point on your rotated/pitched/yawed disk (which appears to be calculated with the atan2() formula above.

3. simgear/math/vector.hxx defines a function that maps/projects the vector from (2) onto the plane from (1) sgmap_vec_onto_cur_surface_plane() returning the mapped/projected vector as the result.

Now you have a vector that lies on your horizontal plane, and a vector to your highest elevation point. All you need to do is find the angle between the two which off the top of my head is the arcsin of the dot product of the two vectors (probably normalized.) My linear algebra book is at home so this is all off the top of my head.

`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
```