stupid hermite interpolation... well it's not what i want anyway
ok i shouldn''t say "stupid" as hermite interpolation is useful but not for what i''m doing.
ok i''ve been doing a little experimentation with the hermite interpolation and vectors in DX. well i''ve run into a bit of a problem.
i want to make a sort of camera scripting thing, where the path is defined by nodes, and then the camera''s path is smoothly interpolated on a continuous arc through these nodes. using hermite interpolation, and setting the tangent vector for each node to be the next node in the sequence, i got it to look very close to what i wanted. in fact it moves in the exact pattern i want it to move, but not the right speed.
you see, because it uses a parabola to do the interpolation, it slows down near the nodes and speeds up when it''s between them. so it''s a very obvious speeding up and slowing down as the camera moves from node to node.
i was wondering if there was another type of interpolation that would move in an arc, like hermite, but that would not slow down near the endpoints of the arc!
__________________________________________
you just think i''m here. i''m really not.
_______________________________________________________________________Hoo-rah.
scale your velocity along the u axis by the reciprocal of the unit arclength at the current point.
My, that made no sense. Lessee. Formula for arclength is:
Integral r to s of (sqrt((h''(t))^2 + ((g''(t))^2)dt)
So the "sparseness" of the curve is:
s(t) = sqrt((h''(t))^2 + ((g''(t))^2)
So each frame, you have a current t(n-1). So your new t(n) is:
t(n) = t(n-1) * (1 + v/s(t(n)))
This formula is an approximation, but if you move slowly over t, you should be fine. You''re on your own figuring out the derivatives; it''s been a while since I was in calculus.
And please, someone call me on it if I''m talking out of my ass.
But... but that''s what HITLER would say!!
My, that made no sense. Lessee. Formula for arclength is:
Integral r to s of (sqrt((h''(t))^2 + ((g''(t))^2)dt)
So the "sparseness" of the curve is:
s(t) = sqrt((h''(t))^2 + ((g''(t))^2)
So each frame, you have a current t(n-1). So your new t(n) is:
t(n) = t(n-1) * (1 + v/s(t(n)))
This formula is an approximation, but if you move slowly over t, you should be fine. You''re on your own figuring out the derivatives; it''s been a while since I was in calculus.
And please, someone call me on it if I''m talking out of my ass.
But... but that''s what HITLER would say!!
i think i might know what you''re talking about kinda i''m not in calc yet (hell i''m not even in trig yet) tho.
as a sort of compensation for the slowdown, i made a little loop that kept moving the object along the arc until it had moved a minimum distance (like 1 unit). unfortunately this didn''t work very well; in fact, depending on the minimum distance i had it set for, either the problem got WORSE or instead of slowing down at the nodes, it sped up!
maybe there''s a formula out there for making "linear" arcs..?
as a sort of compensation for the slowdown, i made a little loop that kept moving the object along the arc until it had moved a minimum distance (like 1 unit). unfortunately this didn''t work very well; in fact, depending on the minimum distance i had it set for, either the problem got WORSE or instead of slowing down at the nodes, it sped up!
maybe there''s a formula out there for making "linear" arcs..?
_______________________________________________________________________Hoo-rah.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement