I asked earlier about using the FlightGear view system to keep a camera
fixed on a specific point in the world. A real world usage example perhaps
could be a gyro stabilized view on a news helicopter. Ron Jensen was kind
enough to post a view configuration that did exactly this. I've been
looking though the viewer math that processes this configuration and it I
think I am understanding a fair bit of it, but the code is designed to
produce a view transformation matrix (I believe) is OSG world space.
What I am trying to accomplish is a bit different. I want to know the
heading and pitch offsets (pan & tilt angles) that will point the camera at
the target ... while the aircraft flies through any arbitrary position and
orientation.
I know the target lon/lat/elevation.
I know the viewer lon/lat/elevation.
I know the viewer orientation in the local world coordination frame.
It seems like it makes sense to transform these to ECEF (earth centered
coordinate frame.)
I should be able to compute my aircraft "up" vector in ECEF
I should be able to compute a "forward" vector in ECEF (or which ever vector
corresponds to my camera's zero/zero pan/tilt orientation.)
Once the view and target locations are transformed to ECEF, I can compute a
vector from the eye to the target in ECEF.
I can compute an aircraft up vector in ECEF
I can compute a "forward" vector in ECEF. The forward vector should
correspond to a camera pan/tilt orientation of zero/zero relative to the
aircraft.
Can I use the quaternian fromRotateTo() function to create a quaternian than
represents a rotation from the camera's default zero/zero direction to the
target direction?
I see two forms of the quaternian fromRotateTo() function, one that just
takes two vectors and one that includes indices to two unit vectors? Is
there any explanation of how that works? The comments in the code are
pretty thin.
Then assuming I'm on the right track here, from this quaternian, how do I
extract out the actual euler angles. Can I just call getEulerRad() and will
my angles just pop out, or do I need to do additional work?
Am I on the right track here? Are there easier/better ways to accomplish
this?
What I want in the end are two angles (pan & tilt) to move my camera to stay
fixed on an arbitrary point, no matter how the aircraft moves or is
oriented.
Thanks,
Curt.
--
Curtis Olson: http://baron.flightgear.org/~curt/
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel