On Fri, Aug 8, 2008 at 11:25 PM, Michael George <[EMAIL PROTECTED]> wrote: > Knapp wrote: >> >> On Fri, Aug 8, 2008 at 5:58 PM, Michael George <[EMAIL PROTECTED]> >> wrote: >> >>> >>> It's still somewhat on the back burner, but I've been working on a >>> library >>> to allow you to drag and drop irregularly shaped objects (esp. circles >>> and >>> polygons) while preventing interpenetration. It's a surprisingly hard >>> problem and I'm reading a lot of computational geometry papers to find an >>> algorithm to solve it. >>> >>> >>> >> >> You talking 3d? If it is 2d, then just drop lines from the outside edges. >> > > No, I'm talking about 2d. If you have an easy solution, I'd love to see it, > but I think I've just failed to communicate the problem. I want to allow > objects to be dragged into holes that are just the right size, and to make > it easy to drag objects along the edges of other objects. I've formalized > the problem as follows: given an object and a collection of obstacles, and > the position of the mouse, find the point closest to the mouse where the > object can be placed without intersecting with any of the obstacles. > > Can you expand on what you are suggesting? > > --Mike > Yes, I thought that perhaps I did not get it also. So now that I think I do get it. What about using to sprites and pixel perfect collision? One would be the shape and the other would be the hole. If sprites with holes don't work then use a bunch of sprites to create the hole's edges. Did I get it this time? Still not totally sure.
Another way is to use the center point of the object and set up paths that the object must stay within that are defined by rectangles. Can you rotate the objects? I am not sure what you mean by drag objects along the edges of other objects or why you would want to do it. I still feel that sprite collision might be the way to go. -- Douglas E Knapp http://sf-journey-creations.wikispot.org/Front_Page