Advertisement

Braid algorithm

Started by July 13, 2012 08:30 PM
7 comments, last by MrRowl 12 years, 7 months ago
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?
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.
Advertisement
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.
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
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.
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
Advertisement
Sorry about that - I guess it was a dynamically created image. I've edited the post now.
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.

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


Yes.

This topic is closed to new replies.

Advertisement