Hi
I test myself with only lines in the two movieClips, hitTest works fine
without fills...
David Buff
----- Original Message -----
From: "Millie Niss" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, November 09, 2006 4:01 AM
Subject: [Flashcoders] efficient line segment intersection algorithm?
As part of an app I'm writing, I need users to be able to manipulate a
drawing of a graph: Specifically, I have a bunch of circles ("nodes")
connected to each other by line segments ("edges"). Users can drag the
nodes around within a fixed area (this part works), but I need to stop
them from making the edges intersect each other (except where they meet at
the nodes).
I tried to do this using MovieClip.hitTest (each edge is its own
MovieClip, and I know the coordinates of all the nodes) but it didn't
work. I am sure there is a bug in my code, which I need to find.
Even if I fix it, however, the stupid algorithm that goes through every
node and checks if it hits any edge in the obvious (2 nested for loops)
way is horribly inefficient -- I probably need to do the math myself
rather than relying on hitTest. The number of nodes is user-configurable
so even if I get the stupid algorithm to work on my baby test case, I am
worried that it won't scale.
It occurred to me that possibly hitTest doesn't work to check whether a
point intersects with a clip that has strokes but no fills (ie my
edges)... Does hitTest use the pixels of strokes or does it only use the
insides of fills as the area it checks the test point against?
Millie Niss
[EMAIL PROTECTED]
http://www.sporkworld.org
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com