Mantis - Squeak
Viewing Issue Advanced Details
6461 Morphic major always 05-03-07 12:29 09-15-08 19:43
hangal  
 
normal  
closed 3.9  
fixed  
none    
none 3.10  
0006461: PolygonMorph intersects method does not work
I am using Squeak-3.9-final-7067.image on win-xp.

I create a polygon using:
p := PolygonMorph new.
p vertices: {0@0. 0@200. 200@200} color: Color black borderWidth: 2
borderColor: Color green.

However any attempt to use the intersects: aRectangle method in
PolygonMorph, e.g.

r := Rectangle new.
r setOrigin: 150@0 corner: 175@25. /> p intersects: r

returns a message not understood.
because PolygonMorph's intersects calls super intersects,
when no such method exists in any of its superclass.


On the beginners mailing list, Jerome Peace says:

Date: Wed, 2 May 2007 21:48:23 -0700 (PDT)
From: Jerome Peace <peace_the_dreamer@yahoo.com>
Subject: [Newbies] Re: PolygonMorph intersection
To: "beginners@lists.squeakfoundation.org"

...
In building the 3.9 release the release team added
pieces of the the Connectors package.
And while they did as best they could they missed a
piece.

The PolygonMorph>>intersects: methods calls super
intersects: . None of the classes above PolygonMorph
defines the intersects: method. Thus the error
message.
...
related to 0006457new  [RFI] Need a utility to check on super unimplemented calls. 
 UnimplementedCallBugz.st [^] (525 bytes) 05-04-07 04:01
 Morph-intersects.st [^] (299 bytes) 06-25-07 13:02

Notes
(0010647)
nicolas cellier   
05-03-07 13:47   
Maybe try (bounds intersects: aRectangle) instead of (super intersects: aRectangle).

But then, there is no #intersectsLineFrom:to: implemented.

And aRectangle inside polygon not crossing any polygon line will answer false.
This is more a polylineIntersects: algorithm than a polygonIntersects:
(0010650)
wiz   
05-03-07 21:43   
Hi hangal

Nicely reported.

I found the missing method in a connectors package.

The super class was Morph which simply checks the boundry rectangles for intersection.

The next thing that needs doing is writing the test for this.


Yours in service, --Jerome Peace
(0010651)
wiz   
05-03-07 21:50   
Hi nicolas,

I didn't try to address the intention of the code, since I knew I would find the missing piece if I looked in the right place. I figure in this report to just address the breakage.

In the related report address the lack of a probe to warn when something like this breaks.

And in the beginners list address the problem of getting the intent of the code to work.

Thanks for adding your insight to this and the related report.
That was quick.

Yours in curiosity and service, --Jerome Peace

(0010658)
wiz   
05-04-07 04:05   
 UnimplementedCallBugz.st uploaded

is the very simple test of PolygonMorph>>intersects:

Fails before the fix applied and passes after.

Test just tests if the method can be sent w/o Error.

And that completes the simple fix.

(0010683)
wiz   
05-08-07 19:39   
"fix begin"
Installer mantis bug: nnnn fix: 'Morph-intersects.st'.
"fix test"
Installer mantis bug: nnnn fix: 'UnimplementedCallBugz.st'.
"fix end"
(0010831)
edgardec   
06-25-07 17:42   
This now is 7115Morph-intersects and was in updates for 3.10
Thanks Jerome !
(0012660)
KenCausey   
09-15-08 19:43   
Harvested in update 7104 and released in 3.10.