hitTest has a version that tests a point against the actual shape of a MovieClip. The other varaiation tests two MovieClips, but only compares their bounding boxes, not the actual shapes.

I found a useful segment intersection algorithm in the book

_Computational Geometry: Algorithms and Applications_, by Mark de Berg
http://www.amazon.com/Computational-Geometry-Algorithms-Applications-Second/dp/3540656200/ref=pd_ys_qtk_rvi_img/102-1020427-4119337

which I bought (will be shipped tomorrow).

The algorithm is quite understandable and efficient. It does use binary trees, so I have to code a binary tree class before I can implement the algorithm. I guess that is good practice for me because I just started doing AS 2.0 OOP stuff. (I did C++ in the Bad Old Days, so I am not an OO neophyte, but the bad old days were a long time ago. I don't even think design patterns were invented. If they were, they were not taught at my university.)

ObGripe: I was impatient so I also bought the online electronic edition ($10 after buying the book at regular price) from Amazon and was able to get the algorithm I needed (good explanation with background, discussion of time/space issues, and pseudocode; no sample source but that's the way I prefer it). I was annoyed to discover that one has to print the pages in the e-book one at a time (and they come up slowly -- on DSL -- and print slowly...) rather than by specifying a range of pages. The ad about the online book said it was printable, and it never occurred to me that the printing would be so difficult and slow. Also, the pubisher has a limit on how many pages you are allowed to print (not specified either, so I guess it will just stop printing when I reach the limit). Aaagh.

Millie Niss
[EMAIL PROTECTED]
http://www.sporkworld.org
----- Original Message ----- From: "JulianG" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, November 09, 2006 8:00 AM
Subject: Re: [Flashcoders] efficient line segment intersection algorithm?


I think HitTest only works with the bounding box of the MovieClip. So it's not appropriate for what you're doing. Try this Metanet Tutorial: Beyond HitTest() <http://www.harveycartel.org/metanet/tutorials.html> Collision Detection in Flash.

cheers,
JulianG


Millie Niss wrote:

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?

_______________________________________________
[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

Reply via email to