# [Flightgear-devel] YASIM

```Is there someone who can tell me about local coordinates and global coordinates.
What is the difference?```
```
I have reported down a piece of code of Yasim\Model.cpp with some questions
attached (**....**)

// Returns a unit "down" vector for the ground in out, and the // distance
from the local origin to the ground as the return value.
// So for a given position V, "dist - (V dot out)" will be the height
// AGL.   **what is height AGL?**

float Model::localGround(State* s, float* out) {
// Get the ground's "down" vector, this can be in floats, because
// we don't need positioning accuracy.  The direction has plenty
// of accuracy after truncation.
out[0] = -(float)_ground[0]; **why is it inverted?**
out[1] = -(float)_ground[1];
out[2] = -(float)_ground[2];
Math::vmul33(s->orient, out, out);

// The distance from the ground to the Aircraft's origin:
** what is the meaning of this operation, what is _ground[3]?**
double dist = (s->pos[0]*_ground[0]
+ s->pos[1]*_ground[1]
+ s->pos[2]*_ground[2] - _ground[3]);

return (float)dist;
}

// Get a ground plane in local coordinates.  The first three
// elements are the normal vector (**where is the origin of this vector?**),
the final one is the distance
// from the local origin along that vector to the ground plane
// (negative for objects "above" the ground) **Why negative?**
float ground[4];
ground[3] = localGround(s, ground);
float alt = Math::abs(ground[3]);

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