So I'm creating an EMP....
Note: this post has been copied from the Programming section, i won't link it b/c all the replies were useless.
A graphical one that is.
The technique that I'm using is this:
-create a grid of points
-have them move around according to formulas
-render them where lines are drawn from point to adjacent point.
So, a particle in the array at [3],[3] would have lines connected to [2][3] & [3][2] & [4][3] & [3][4].
At first, I did the simplest thing:
loop through with Particle p,pp being onces that need to be connected
g.drawLine(p.x,p.y,pp.x,pp.y);
This was incredibly slow.
Then I instead added all points to a Polygon and called:
g.drawPolygon(poly);
This was much faster, but the problem is that the polygon method connects some points that i dont want to be connected and doesn't connect others that i want to be connected.
Is there an algorithm for the order to add points to the polygon in order for it to correctly draw a grid with as little overlapping lines as possible?
Thanks!
[1101 byte] By [
Nethera] at [2007-11-27 6:53:35]

# 4
Is this a 3D game?
Ive done 3D programming and this is how i would do it to start with.
The EMP like in the movie is made to look like a blast wave that
is expanding. So just render an expanding Sphere.
The only way to properly render this would be to calculate the
distance between the camera and the emp wave positions at
the screen locations and use lighting to represent depth.
You dont have to to every pixel. Just do some point and interpolate
the rest.
# 11
>At first, I did the simplest thing:
>loop through with Particle p,pp being onces that need to be connected
>
>g.drawLine(p.x,p.y,pp.x,pp.y);
>
>This was incredibly slow.
that should not be slow at all. if you only hava a 10 by 10 grid of points it should only take miliseconds. I made a large applet that does pixel by pixel rendering with g.drawLine( x , y , x , y ); You should look over your method of drawing the lines. www.duke.edu/~kef14/Mandelbrot.html
the drawPolygon(); uses the drawLine() function...
Also for the polygons without overlap you should draw polygons in a checker-board pattern. --If you outline all of the black squares in a checker-board, you will get a grid with NO overlap. You will still have to draw a few lines around the perimeter to fill in the gaps.
hope that helps