On 08/03/2009 09:04 AM, Curtis Olson wrote: > .... 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.)
OK. > 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.) Should be trivial, given the positions and 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 don't see why not. In addition to the quaternion, you need to know something about the camera gimbals -- otherwise the problem is underspecified -- but presumably you do know that, so it's OK. For definiteness, let's assume that camera pan corresponds to rotation in the camera's XY plane, while camera tilt corresponds to rotation in the camera's XZ plane. The quaternion suffices to aim the _axis_ of the camera along the line to the target. The additional gimbal info is needed to pin down the rotation of the image _around_ that axis. > 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. Thin indeed. > 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? I suspect a tiny bit more work. The quaternion obtained above is expressed in the ECEF frame, and therefore getEulerRad will return angles in that frame. I reckon you need to rotate the quaternion into the camera's XYZ frame before calling getEulerRad. Again I am assuming that camera pan corresponds to rotation in the camera's XY plane, while camera tilt corresponds to rotation in the camera's XZ plane. > Am I on the right track here? Are there easier/better ways to accomplish > this? I cannot imagine an easier way of getting the correct answer. ------------------------------------------------------------------------------ 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