Hey guys
I have a bunch of keyframed points that translate over time. They translate according to the rotation of a fixed point (think of facialanimation tracker moving with a headbone), from those points i would like to find the original rotationpoint since i don't have that data.
My math skills arn't what they should be but i tried the following
- combine all points lengths and average them- Take the arc tangent of the each point between two frames- Convert spherical to Cartesian coordinates using the following formula
and the corresponding maxscript
fn drawLineBetweenTwoPoints pointA pointB =
(
ss = SplineShape pos:pointA
ss.render_renderable =false
addNewSpline ss
addKnot ss 1 #corner #line PointA
addKnot ss 1 #corner #line PointB
updateShape ss
ss
)
average = 0
for i=1 to selection.count-1 do
(
[COLOR=Red]average += (length selection[i].pos)[/COLOR]
--print average
)
lengte = ((average)/(selection.count))
xrot = 0
yrot = 0
zrot = 0
for i=1 to selection.count-1 do
(
[COLOR=YellowGreen] xrot += atan2 (at time 2 selection[i].pos.x) (at time 1 selection[i].pos.x)
yrot += atan2 (at time 2 selection[i].pos.y) (at time 1 selection[i].pos.y)
zrot += atan2 (at time 2 selection[i].pos.z) (at time 1 selection[i].pos.z)[/COLOR]
)
xrot = xrot/selection.count
yrot = yrot/selection.count
zrot = zrot/selection.count
[COLOR=Orange]posx = lengte * sin zrot * cos xrot
posy = lengte * sin zrot * sin xrot
posz = lengte * cos zrot
[/COLOR]
for i=1 to selection.count do
(
drawLineBetweenTwoPoints selection[i].pos [posx,posy,posz]
)
the result i got wasn't far from what the point could be but i think it was a lucky coincidence instead of my thoughtprocess actually being correct.
excuse my stupidity in case i'm doing some idiotic stuff here :P
Replies
all you need is 4 points and you're golden
link:
http://paulbourke.net/geometry/spherefrom4/