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

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

Thank you for any help


Other Threads

1. onConfigurationChanged not being invoked

I have an activity with onConfigurationChanged in it. I also have the
manifest set up like this:

<activity android:name=".MySplashActivity"

I thought that when the phone was rotated so that the landscape layout
kicks in, that onConfigurationChanged would get called but it does

I do see in the log though this:

11-03 21:38:59.788: INFO/ActivityManager(2259): Config changed:
{ scale=1.0 imsi=310/410 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=2

I am certain that onConfigurationChanged is not getting called (have
log statements and the de{*filter*} set...just never happens).

So what am I doing wrong?



2. What other markets are worth using

I'm considering which markets to sell my apps in and I would like to
get the opinions of other developers.

Other than the android market which markets do you sell your apps in
and which ones have you had success? Have you seen any changes to the
rate of sale in these other markets since the android market expanded
to other countries?


3. ContextMenu/AlertDialog with footer view (to add checkbox for 'make default' option)

4. Support for 24 bit Audio wave file ??

5. creating of explicit Accounts but with no Syncing involve

6. What are some good Automated Unit And System Test Tools for Android?

7. Failure to connect to camera service.