Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining Overlapping Items

Status
Not open for further replies.

srhoads

Programmer
Nov 21, 2001
21
0
0
US
I am posting this for the 2nd time because this feature is important to me.

Does anybody know how to determine if 2 canvas items touch or overlap? I need to determine this for extremely complex shapes. Simple examples are geometry shaped like the letters A X Y L T . I would like to manually and automatically move these shapes close together but not overlap.

All I need is a simple boolean variable if 2 items occupy the same pixel on the screen.
 
The only thing I can think of is to use:
pathName coords tagOrId ?coordList?
"Query or modify the coordinates that define an item. If no coordinates are specified, this command returns a list whose elements are the coordinates of the item named by tagOrId. If coordinates are specified, then they replace the current coordinates for the named item. If tagOrId refers to multiple items, then the first one in the display list is used."

The problem is that you have to loop through all the items, 2 at a time. Bob Rashkin
rrashkin@csc.com
 
I think this will only give me the endpoints of entities such as lines or the rectangular envelope of arcs. I need to know all pixels of arcs and sloping lines. For example moving the following letters close together A * e . T
 
I have found the solution.

Using "$win overlapping $x $y $x $y" which is a zero-size rectangular area I can find the screen coordinates of the outline of an object and push them together by a calculated distance.
 
Excellent! Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top