Is it normal that a rectangle with an origin left to its corner does
not contain a point like this: ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false Bernadette Queyras _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
bernadette Queyras escreveu:
> Is it normal that a rectangle with an origin left to its corner does > not contain a point like this: > > ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false > Bernadette, Inspect the rectangle you created and look at the method Rectangle>>containsPoint: aPoint "Answer whether the argument aPoint is within the receiver." ^origin <= aPoint and: [aPoint < corner] Notice that the logic checks if aPoint is greater than origin, but (0@0) <= (-0.5@-0.5) "false" also (-0.5@-0.5) < (-1@-1) "false" If this "normal" (which I believe you meant "acceptable") is a thing to check within the context of your application. HTH -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by bqueyras
Maybe the thread 'Rectangle #contains: and #containsPoint' (25/04/07)
will answer your question. HTH, Andrés bernadette Queyras escribió: > Is it normal that a rectangle with an origin left to its corner does > not contain a point like this: > > ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false > > Bernadette Queyras > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by bqueyras
Well, yes, I guess so. At least I get the same result in VA Smalltalk.
Looking at the implementiation it is at least explicable: containsPoint: operand "Answer true if the receiver contains the point operand. Otherwise answer false." ^operand >= origin and: [operand < corner] Good luck Joachim bernadette Queyras <[hidden email]> hat am 6. November 2009 um 16:05 geschrieben: > Is it normal that a rectangle with an origin left to its corner does > not contain a point like this: > > ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false > > Bernadette Queyras > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- ------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:[hidden email] Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by bqueyras
Yes.
If you're not sure when creating the rectangle which points x/y is topLeft, you should use the vertex:vertex: constructor. Cheers, Henry On Nov 6, 2009, at 4:05 56PM, bernadette Queyras wrote: > Is it normal that a rectangle with an origin left to its corner does > not contain a point like this: > > ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false > > Bernadette Queyras > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by bqueyras
> Is it normal that a rectangle with an origin left to its corner does > not contain a point like this: > > ( (0@0) corner: (-1@-1) ) containsPoint: (-0.5@-0.5) -> false Use the #vertex:vertex: message to create rectangles from arbitrary points. That sorts the points appropriately, i.e. in your case you get a rectangle (-1@-1) corner: 0@0. Andre _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |