Consider two rectangles, a and b. The only constraint I will put on them is
that neither contains the other. I wish to create a PolygonMorph programmatically consisting of a merge: b with b removed but all of a retained in the case a and b overlap. I think I see my way to how to do this, but if anyone knows of any code I can look at where something like this is already implemented I'd be much obliged. My idea for how to go about this is to use "turtle logic" more or less as follows: Start with the first vertex of a merge: b which is not inside of b. Proceed clockwise along the bounds of a merge: b; if you hit b turn left, if you hit a turn right. But this may be doing things the hard way. -Thanks, Jim |
On May 6, 2007, at 16:12 , Jim Rosenberg wrote: > Consider two rectangles, a and b. The only constraint I will put on > them is that neither contains the other. I wish to create a > PolygonMorph programmatically consisting of a merge: b with b > removed but all of a retained in the case a and b overlap. I think > I see my way to how to do this, but if anyone knows of any code I > can look at where something like this is already implemented I'd be > much obliged. > > My idea for how to go about this is to use "turtle logic" more or > less as follows: Start with the first vertex of a merge: b which is > not inside of b. Proceed clockwise along the bounds of a merge: b; > if you hit b turn left, if you hit a turn right. But this may be > doing things the hard way. Sounds reasonable. There is a polygon clipper in Rome that you could take a look at. The class is named RomePolygonClipper in package Rome- Reference at http://squeaksource.com/Rome.html Might be simpler if you state the larger problem you need this for. - Bert - |
In reply to this post by Jim Rosenberg
>Consider two rectangles, a and b. The only constraint I will put on them is that neither contains the other. I wish to create a PolygonMorph programmatically consisting of a merge: b with b removed but all of a retained in the case a and b overlap. I think I see my way to how to do this, but if anyone knows of any code I can look at where something like this is already implemented I'd be much obliged.
> >My idea for how to go about this is to use "turtle logic" more or less as follows: Start with the first vertex of a merge: b which is not inside of b. Proceed clockwise along the bounds of a merge: b; if you hit b turn left, if you hit a turn right. But this may be doing things the hard way. > >-Thanks, Jim Hi, Jim - While it does not produce a polygon, you might well find <Rectangle>areasOutside: <Rectangle> to be a useful first step. I wrote the original version and should probably apologize for not calling it something closer to "difference". - Dan |
--On May 6, 2007 8:41:26 PM -0700 Dan Ingalls <[hidden email]> wrote:
> While it does not produce a polygon, you might well find > <Rectangle>areasOutside: <Rectangle> to be a useful first step. Many thanks for all the replies on this topic! Dan, the areasOutside: method gives me everything I need. Thanks for the tip! I don't really need a PolygonMorph per se -- having a collection of rectangles works fine. Since I've been asked what the application is, it's time to seriously delurk. The application here is for interactive poetry. You can get a look at what I'm up to here: <http://www.well.com/user/jer/inframergence/readMe.html> (This is a fragment of a large work in progress.) To summarize the problem: I have a class of my own that has "special behavior" and forms a rectangular mouseEnter hot-spot. I'm forming a chain of these things in which mouse entry pops up the next and previous entry in the chain. These are heavily overlaid, and I need to form "event blocker" skirts which inhibit other objects that are not part of the current chain. I've been doing this using the merge of the current rectangle with the next and previous one in the chain. This works fine as long as the areas don't overlap, but when they overlap it is trouble -- I get flashing behavior. (The next and previous elements of the chain are brought in front of the the current one.) Thus far this has not been a problem, but for esthetic reasons, I will need to move to overlapping elements and thus needed a solution to this problem. So, the real problem is to make my event blocker skirts omit the next and previous elements, and that way the current element can be on top -- no flashing. I have this all working now, and the code is very simple. * * * More generally: there are many of us in the world doing digital poetry, but I am the only one I know of using Squeak. Morphic has turned out to be exactly the paradigm I had been looking for for years! If you're curious, I have a completed work available on the web here: <http://www.well.com/user/jer/inter_works.html#d6> I have a technical description of some of the issues related to this work in a paper titled "Hypertext in the Open Air: A Systemless Approach to Spatial Hypertext" presented at the 3rd Workshop on Spatial Hypertext here: <http://www.well.com/user/jer/SH3.pdf> and a more literary essay giving the motivation of my Squeak work here: <http://www.well.com/user/jer/q2m.html> Squeak / Morphic have been a dream come true for me, quite literally. Thank you to everyone in the Squeak community, you are wonderful!! --- Jim Rosenberg http://www.well.com/user/jer/ Internet: [hidden email] |
On May 13, 2007, at 2:34 , Jim Rosenberg wrote:
> Since I've been asked what the application is, it's time to > seriously delurk. The application here is for interactive poetry. > You can get a look at what I'm up to here: > > <http://www.well.com/user/jer/inframergence/readMe.html> > > (This is a fragment of a large work in progress.) > > [...] > * * * > > More generally: there are many of us in the world doing digital > poetry, but I am the only one I know of using Squeak. Morphic has > turned out to be exactly the paradigm I had been looking for for > years! If you're curious, I have a completed work available on the > web here: > > <http://www.well.com/user/jer/inter_works.html#d6> > > I have a technical description of some of the issues related to > this work in a paper titled "Hypertext in the Open Air: A > Systemless Approach to Spatial Hypertext" presented at the 3rd > Workshop on Spatial Hypertext here: > > <http://www.well.com/user/jer/SH3.pdf> > > and a more literary essay giving the motivation of my Squeak work > here: > > <http://www.well.com/user/jer/q2m.html> > > Squeak / Morphic have been a dream come true for me, quite > literally. Thank you to everyone in the Squeak community, you are > wonderful!! > > --- > Jim Rosenberg http://www.well.com/user/jer/ > Internet: [hidden email] This is way cool, Jim! :) - Bert - |
Free forum by Nabble | Edit this page |