Creating a 2D Line Branch
- by Danran
I'm looking into creating a 2D line branch, something for a "lightning effect". I did ask this question before on creating a "lightning effect" (mainly though referring to the process of the glow & after effects the lightning has & to whether it was a good method to use or not);
Methods of Creating a "Lightning" effect in 2D
However i never did get around to getting it working. So i've been trying today to get a seconded attempt going but i'm getting now-were :/.
So to be clear on what i'm trying to-do, in this article posted;
http://drilian.com/2009/02/25/lightning-bolts/
I'm trying to create the line segments seen in the images on the site. I'm confused mainly by this line in the pseudo code;
// Offset the midpoint by a random amount along the normal.
midPoint += Perpendicular(Normalize(endPoint-startPoint))*RandomFloat(-offsetAmount,offsetAmount);
If someone could explain this to me it would be really grateful :).