Jump to content
  • Advertisement
Sign in to follow this  
Alessandro

Braid algorithm

This topic is 2255 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

Hi, how difficult would it be to create an algorithm that generate a braid like this: http://www.wikihow.com/Braid

I suppose one should compute 3 elicoidal paths for each hair?

Share this post


Link to post
Share on other sites
Advertisement
My initial impression is that it's just three helices with 120 degrees phase shifts.

edit: Played a bit with it. It's almost three helices: the path for helix n is p[sub]n[/sub](t) = [t, sin(t*2*pi+phi), cos(t*4*pi+2*phi+pi/2)] where phi is 2*n*pi/6. Edited by Brother Bob

Share this post


Link to post
Share on other sites
You can probably create an initial rough shape with the same topology and then smooth it out while constraining the distances between the three curves (so that you can construct tubes around the curves.

EDIT: This idea can be used to create more general braids. In this case, it's probably also possible to come up with an exact solution. Edited by apatriarca

Share this post


Link to post
Share on other sites
My wild guess is to use Bezier curves.

It kinda reminds me, when I was a kid, I use to frequent a bakery, their specialty was a braided bread just like that one. Good times...

But anyways, I think you can find something useful out of Bezier curves for this.

Good luck

Share this post


Link to post
Share on other sites
The path of each strand isn't a helix - when viewed along the length of the braid it's a figure-eight (remember when you make one you always lift the outer strand up before shifting it over back into the braid). So it could be constructed using this equation:


x(t) = a sin(t)
y(t) = a sin(t) cos(t)


with a 120 degree phase shift for each strand, where t increases along the braid.

Share this post


Link to post
Share on other sites
Thank you very much for all your suggestions, I'll try to code something next days and show what I can come up with. MrRowl, unfortunately the image with the equation doesn't show, would it be possible for you to post it again? Many thanks

Share this post


Link to post
Share on other sites
Sorry about that - I guess it was a dynamically created image. I've edited the post now.

Share this post


Link to post
Share on other sites
Thank you very much MrRowl. Just a clarification, the formula would be:

x(t) = a * sin(t)
y(t) = a * sin(t) * cos(t)

Right? Where a is a constant value to give the braid some dimension.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!