Jump to content
  • Advertisement
Sign in to follow this  
Gf11speed

Path Smoothing

This topic is 4479 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Gotcha. Like a gaussian blur.


This would also work too I think:
http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/ziad/project/mid_al.html

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
Or, maybe a B-spline. The catmull-rom becomes an nth-order curve (for n control points). A B-spline is a moving cubic curve.

(Am I way off? - don't hold me to this)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!