Hello, 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.
My original goal is to check if a line segment L is completely contained within this polygon p. Since the System browser shows that PolygonMorph has an intersects: aRectangle message, I thought I would create a rectangle with the original and corner as the end points of L and use it to query intersects.
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.
Am I doing something fundamentally wrong ?
I can probably work around, but I would like to know why a method documented in the system browser does not work as expected. thanks,
sgh
Hello, 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.
My original goal is to check if a line segment L is completely contained within this polygon p. Since the System browser shows that PolygonMorph has an intersects: aRectangle message, I thought I would create a rectangle with the original and corner as the end points of L and use it to query intersects.
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.
Am I doing something fundamentally wrong ?
I can probably work around, but I would like to know why a method documented in the system browser does not work as expected. thanks,
sgh
r := Rectangle new. r setOrigin: 150@0 corner: 175@25. p intersects: r returns a message not understood.
Am I doing something fundamentally wrong ?
Yes you are. a rectangle is a polygon indeed. However, a PolygonMorph is a BorderedMorph, NOT a RectangleMorph.
If you look for implementers of #intersects: , you will get only RectangleMorph.
PolygonMorph DOES NOT IMPLEMENT #intersects. So the system does indeed NOT UNDERSTAND the message.
beginners@lists.squeakfoundation.org