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. How to set text color for widget

Hi guys,

I want to change the text color on FMRadio off from red to gray. i
tried with settextcolor(viewid,color) but i am getting error display
as "problem loading widget".

In the Logs it says pdateAppWidget couldn't find any view, using
error view, android.widget.RemoteViews$ActionException: view:
LinearLayout doesn't have method: setTextColor(int)

Can anyone please help me in changing the color of the widget on state



2. Soft Keyboard covers part of dialogbox in pan and scan mode

I have a view with a text edit box at the bottom, which when clicked
invokes a soft keyboard and the view is shifted up. The issue is that
the keyboard obscures a significant portion of the text edit box.
Looking at the diagrams @
, it seems that's normal/expected ? I would atleast expect to see the
edges of the text entry box itself, if not the entire dialog, [ as it
is in this link ]. Is this a known Android issue. Any suggestions on



3. Need Help - View Flipper Force Close Error

4. bluetooth discoverability limitations?

5. ByteBuffers and GLES

6. Connect to localhost on a Nexus One?

7. Resource not found exception in ListActivity