🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to un-deform circle segment

Started by
0 comments, last by 51mon 3 years, 9 months ago

I have a set of connected line segments forming a loop. The loop is “supposed” to strive to form the shape of a circle. Some other constraints deforms the shape so sometimes the shape gets very messed up and don't look like a circle at all, e.g. the segments overlap eachother and vertices get in the “wrong” order. However they never get disconnected.

Now I'm trying to find a way to move the vertices so the overall shape approaches a circle again. I know the length each segment should have (ideally) and the angle between neighbouring segments.

Does anyone know some algorithm that might suit solving this problem?

The code will be executed in a shader. I tried only considering the 2 closest neighbours and move each vertex a fraction each frame in order for the process to be more stable. The algorithm don't need to fully conform in a single frame. So far I haven't found a fully satisfying method.

This topic is closed to new replies.

Advertisement