I know (from a motion capture system) the location in 3D space of
three markers placed on the head of an person, at the front, at the
back left, and the back right. Assume that the person's gaze is in the
direction of a vector from the center of the triangle out through the
front marker, and up and down from their visual perspective is
perpendicular to the triangle.
I want to use the 3D plotting system Blender (www.blender.org) to
replicate the person's eye view of the other markers in my scene. All
I need to do is position Blender's camera at the location of the front
head marker (this I can do), and rotate it to face the right direction
and have the right tilt (this I can't do yet).
Blender uses Python as a scripting language, and has a range of high
level commands for manipulating vectors, matrixes, and quaternions
(http://www.blender.org/modules/documentation/240PythonDoc/Mathutils-module.html).
I am comfortable with using the language but I don't really understand
the geometry. I am sure that if one understands the geometry the
necessary script would be very simple to write.
If you aren't familiar with Blender or Python you may still be able to
answer this question providing you can provide an algorithm
(implementable in Python, perl, or C), which outputs a Euler for the
rotation (as Blender Python understand a Euler, see:
http://www.blender.org/modules/documentation/240PythonDoc/Object.Object-class.html#setEuler).
So to restate, an acceptable answer is preferably a Python script
which rotates a camera based, as describe, on the three points, using
the Python Blender mathutils. Failing that, an acceptable answer may
be a formula which I can easily implement. I don't know a lot of
matrix algebra, so such a formula should be written in explicit pseudo
code using basic math and trig functions which I can port into a
language such as Python or C.
Thanks in advance!
Ben |