#### Sword7

##### Member

Local Horizon Coordinates

I now noticed that formula is very similar like local 2 horizon formula in Camera.cpp but uses right-handed rule instead.

In orbiter code:

| cos(theta)sin(phi) cos(theta)cos(phi) - sin(theta) |

R = | -cos(phi) sin(ph) 0 |

| sin(theta)sin(phi) sin(theta)cos(phi) cos(theta) |

I tried that formula from Orbiter but negated Z values (sinth = -sin(go.lng)) for right-handed rule in my OpenGL program. It worked at default zero heading but did not align for orientation control and points east to screen. At equator, it rotates vertically but I tried to rotate it habitationally. At mid-latitude, it rotates diagonally... At 90-degree latitude, it rotates horizontally. I think that formula is not compatible with right-handed rule - worked best for left-handed rule.

I will try right-handed version from that paper that I was looking for and found soon and see what happens... It use ENU coordinate to convert.

In that paper:

| cos(phi)cos(theta) cos(phi)sin(theta) sin(phi) |

R = | - sin(theta) cos(theta) 0 |

| -sin(phi)cos(theta) -sin(phi)sin(theta) cos(phi) |

What is any difference between two different formulas?

Tim