Please help. Canvas Coordinate information

by chris harper » Tue, 16 Mar 2010 04:44:37 GMT


Sponsored Links
 Any help would be great on this thank you.

If you have two objects on the canvas (obj A) (obj B) and they both
move around dynamically (i.e the X,Y values are constantly changing).

I need to check if they intersect.

I know you can do something like ObjA.X == ObjB.X && and ObjA.Y ==
ObjB.Y but the objects are complex (i.e made up of multiple images and
x,y positions for each).
So constantly checking track of every single x,y position for Obj A
and checking it against every x,y image position of Obj B is a lot of
overhead for each redraw.

My question then is there a better way to do this? For example can you
some how get information from the canvas of position x,y and tell if
there is another image set to that position already? Then each object
can just check it's own x,y position to see if "intersects" with
another object (whatever it might be)? I mean it makes sense that if
you draw Obj A at X,Y the canvas knows about it, so Obj B should be
able to get that information?

Is this possible somehow? I been checking the libs and I have not
found anything yet.

Or if anyone else has any ideas of checking dynamically changing
object positions and intersections between them I am welcome to any
ideas?

Or am I stuck with keeping track and comparing every x,y for each
object on every iteration?

Thank you for any help
-Chris

--



Other Threads

1. zapfino

Anyone know where I can find zapfino for Android CHEAP!! (<$40)

intbt

-- 

2. finding spinner widgets

Where can I find a complete list of the spinner types available for
use?

Also how about a list of DIALOG IDs?

intbt

-- 

3. ContentResolver resolver reslut GREF has increased to 1901

4. setImageViewResource not working

5. After onActivityResult event State Is Gone (Droid Phones)

6. File extensions and MIME type

7. is there a way to make drawable clickable?