So I'm creating an EMP....

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!

[983 byte] By [Nethera] at [2007-11-27 6:53:27]
# 1
WTF is an EMP?Are you starting a bad british rock band?
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 2
> WTF is an EMP?[url= http://en.wikipedia.org/wiki/Electromagnetic_pulse]ElectroMagnetic Pulse[/url].It was totally in the Matrix. And Lost.
kevjavaa at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 3
I know what that EMP means but what does that have to do with dots?
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 4
> WTF is an EMP?Excessive MultiPosting?
Hippolytea at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 5
i want to graphically render one, and i'm using lines drawn on different points to do it.
Nethera at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 6
> > WTF is an EMP?> > Excessive MultiPosting?Sorry, that's the [url= http://forum.java.sun.com/thread.jspa?threadID=5181596&start=90]other thread[/url] (log out before viewing:).
kevjavaa at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 7
"event monitoring points"?[ general crankiness ]i think these forums have me burned out.either that or my office which is literally like 200 degrees F even though its only 80 outside.ITS UNBELIEVABLE! Ohhhhh
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 8

> > WTF is an EMP?

>

> Excessive MultiPosting?

I like these even better: http://www.abbreviations.com/bs.asp?st=EMP

Escaped Mental Patient

Experimentation Master Plan

Ethical Massage Practitioner

Eye Mommy Planet

Enhanced Marksmanship Program

Hippolytea at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 9
jesus, i thought the matrix was a popular movie....
Nethera at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 10
It was. And having studied electrical engineering I know what an EMP is, lol. But youre talking about lines and points and I didnt see the connection. Are you trying to program the Matrix?
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 11
> I like these even betterI need an UN-Ethical Massage Practitioner after today.
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 12
yes i'm trying to program the matrix!!no, i'm trying to render the graphical effect to make it look like an EMP is going off in my game.
Nethera at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 13
well considering that that region of the EM specturm isnt visiblecant you just SAY it went off?
TuringPesta at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 14
but the matrix had a graphical effect!
Nethera at 2007-7-12 18:28:13 > top of Java-index,Java Essentials,Java Programming...
# 15
i see. try emailing Larry or Andy Wachowski?
TuringPesta at 2007-7-21 22:08:21 > top of Java-index,Java Essentials,Java Programming...
# 16
Try the 2d and 3d forums or even the Swing/AWT or gaming forumsfor help. Thats where these sort of 2d and 3d rendering questionsare answered.
TuringPesta at 2007-7-21 22:08:21 > top of Java-index,Java Essentials,Java Programming...
# 17
> Try the 2d and 3d forums or even the Swing/AWT or> gaming forums> for help. Thats where these sort of 2d and 3d> rendering questions> are answered.alright, will do
Nethera at 2007-7-21 22:08:21 > top of Java-index,Java Essentials,Java Programming...
# 18
Moved to Game Forums: http://forum.java.sun.com/thread.jspa?messageID=9707613
Nethera at 2007-7-21 22:08:21 > top of Java-index,Java Essentials,Java Programming...