View Single Post
Old 12th January 2004, 22:15   #13
Major Dude
Deamon's Avatar
Join Date: Nov 2002
Location: Arnhem, the Netherlands
Posts: 927
Somewhat simpler (but the theory is the same):


per frame:

p=0; (this is to reset the counter p you use for each point)

per point:

p=p+1; (meaning for every point p is increased by one).

In this case (and in all cases) you use a counter variable for each point. This counter is called p in this example.

Since we know n is the number of points to render, we set n to 2 in this case, otherwise the rest of the points have the coords (0,0). The equal statement is 1 or 0. It's 1 when p=1 for the first point, and p=2 for the second point. The rest of the points have coords (0,0), but since we don't have any other points, we don't have to bother about that. The reason why it works:

It works Per Point. It's really important to realise this. The code is run for every single dot. P is increased every dot, so we can number them. Point 1 equals p=1 etc. After that, you only have to enter coordinates for each point, and use the counter. Mind that N has to equal the last number of P or the last dots won't be drawn.

The statement:

If you multiply (*) any number 0, the result will be 0. If you multply by 1, the result will remain the same. Knowing this, we can do things like x=0.3*equal(p,1). In normal language: X equal 0.3 if p=1, otherwise it'll be 0.

.:HyperNation @ winamp:. .:DeviantArt:.
Thermal is now available for download at DeviantArt.
Deamon is offline   Reply With Quote