Skip to main content
gamedev.net
🔒 Locked

smooth camera path

Started by Eitsch Feb 14, 2007 at 12:32 PM 2 replies 1.9k views
Original Post
Eitsch
Eitsch
iam working on a "camera drive" module for my app. till now iam using linear interpolation between camera points. i thought about using some sort of spline to get smoother results. i googled around and found heavy weight libs to solve this problem. but what i need is just a function collection which allows to set some points and get interpolated position.... maybe something like that: spline.setPoints(vector points); and spline.getPositionAt(float a) where a is in the range[0...1] which represents current position on spline. what would you recommend in this case? thanks
Palidine
Palidine
Depending on the type of spline you'd need more than just the points. The "standard" spline I always think of is the photoshop spline: each point has 2 control points that modify the local curve to either side of the point.

Anyway, 10 second google found this library:

http://www.scs.fsu.edu/~burkardt/cpp_src/spline/spline.html

You may also just want to read up on splines on wikipedia, the math is relatively straight forward and is parameterized just like you need.

-me
TheAdmiral
TheAdmiral
Quote:
Originally posted by Paladine
The "standard" spline I always think of is the photoshop spline: each point has 2 control points that modify the local curve to either side of the point.

That's a Bézier spline, if you were wondering.

There are a brazillion different types of spline out there and you'd be wise to do a little research before deciding upon one.

Nevertheless, if you're looking for a quick answer, I'd recommend the not-computationally-optimal, but oh-so-easy-to-implement Catmull-Rom spline. Given the existing setup of your work, it should take very little effort to implement, as the interpolant is calculated on-the-fly by feeding your source-vectors in, with need for messy precalculations.

Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.