Bug Report/Fix
John-Reed Maffeo
rlpa80 at email.sps.mot.com
Wed Nov 25 17:01:21 UTC 1998
I was working on some graphics code last night and found what I
think is a problem in the Path hierarchy.
The original methods collect: and select: tried to send the message
form: to newCollection. The method form: is a Path instance message; it
is not understood by collection.
The original method displayOn: transformation: clippingBox: rule:
fillColor:
sent the message do: to transformedPath. The message collect: should be
used
instead.
In addition to the code fix, I am suggesting a modification to the
comment
associated with LinearFit. The definitions I got from Ivan Tomek and
Leandro Caniglia were very helpful.
original comment:
"I represent a piece-wise linear approximation to a set of points in the
plane."
revised comment:
"I represent a piecewise-linear approximation to a set of points on a
plane. A piecewise-linear approximation is the best fit of a set of
points by a
continuous series of straight line segments. A square is an example of
a piecewise-liner approximation of a circle."
'From Squeak 2.2 of Sept 23, 1998 on 24 November 1998 at 10:36:51 pm'!
!Path methodsFor: 'enumerating'!
collect: aBlock
"Evaluate aBlock for each point in the receiver's collectionOfPoints.
Answer with a new collection."
| newCollection |
newCollection _ collectionOfPoints collect: aBlock.
^newCollection! !
!Path methodsFor: 'enumerating'!
select: aBlock
"Evaluate aBlock for each point in the receiver's collectionOfPoints.
Answer with a new collection."
| newCollection |
newCollection _ collectionOfPoints select: aBlock.
^newCollection! !
!LinearFit methodsFor: 'displaying'!
displayOn: aDisplayMedium transformation: aTransformation clippingBox:
clipRect rule: anInteger fillColor: aForm
"Create a new LinearFit and apply aTransformation to the
collectionOfPoints. Display the new LinearFit."
| newLinearFit transformedPath |
transformedPath _ aTransformation applyTo: self.
newLinearFit _ LinearFit new.
transformedPath collect: [:point | newLinearFit add: point].
newLinearFit form: self form.
newLinearFit
displayOn: aDisplayMedium
at: 0 @ 0
clippingBox: clipRect
rule: anInteger
fillColor: aForm! !
More information about the Squeak-dev
mailing list
|