Sign in to follow this  
Gf11speed

Path Smoothing

Recommended Posts

I have a set of 2D points (x,y), that forms a staircase function that looks like this (with a point * at each change of direction): .................................. ...................*----*...... ...................|.............. ...................|.............. ............*----*........... ............|................... ............|................... .....*----*.................... .................................. I want to be able to create a path that smoothens the above path instead of having the "staircase" effect (without reinventing the wheel). What is the best way to do this?? Isn't there a well-known algorithm for doing this? Thanks!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
For each vertex, take a weighted average of it and its nearby vertices and set the average as the new value. It's like applying a blur to the positions of the vertices.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gf11speed
I want to be able to create a path that smoothens the above path instead of having the "staircase" effect (without reinventing the wheel). What is the best way to do this?? Isn't there a well-known algorithm for doing this? Thanks!


The ideal answer depends on what you're looking for... but assuming that you wish to constrain the path at the end points, then a Catmull-Rom spline with the waypoints as knots will give you a smooth curve with desirable continuity results.

Cheers,

Timkin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this