# Drone and sensor line of sight

34 views

### Δημήτριος Φκιαράς

Aug 31, 2022, 6:46:34 AM8/31/22
to openglobus
Hello,

Is there a build in Openglobus way to calculate the point of view of a drone camera, or for that matter - any camera?

What we know:
- Drone Lon, Lat, Alt
- Drone yaw, pitch, roll
- Camera yaw, pitch, roll
- Elevation data of the ground (DEM)

I 've done some research about Quaternions, it seems like a complicate matter.
From what I understood so far, we need to calculate the drone quaternion using:
setFromEulerAngles(pitch, yaw, roll) and then multiply with the quaternion of camera.
And then somehow find terrain collision point correct?

### Michael Gevlich

Aug 31, 2022, 7:19:27 AM8/31/22
to openglobus
It is quite easy to find vector in 3D space of the drone basis, then transform it to 3D space of scene, then it could be searching terrain intersection function, but unfortunately there is no searching vector terrain intersection function.

A) Planet:
static getBearingNorthRotationQuat(cartesian) {
let n = cartesian.normal();
let t = Vec3.proj_b_to_plane(Vec3.UNIT_Y, n);
return Quat.getLookRotation(t, n);
}
, where cartesian - is xyz position of an object. If you have lonlat, then use lonLatToCartesian method from ellipsoid. getBearingNorthRotationQuat returns quaternion you can use for getting rotation into scene basis. Check updateDirection inside GeoObject.js.

B) Separately, of this, need a function getting terrain vector intersection.

Maybe one day I'll make it, because I need this function too...

### Michael Gevlich

Aug 31, 2022, 7:21:31 AM8/31/22
to openglobus
...it is easy to find intersection with earth if your vector is directed nadir, it is already here, but common direction, need to think about it, and first create an issue in the repository.