File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -32,17 +32,22 @@ CTAlternateArray2D class >> width2Height3 [
3232
3333{ #category : ' iterate' }
3434CTAlternateArray2D >> allPositionsDo: aBlock [
35- " Execute a Block on all the positions (points) of the receiver."
36- self firstPosition pointTo: self dimension do: aBlock
35+ 1 to: self width do: [ :x |
36+ 1 to: self height do: [ :y |
37+ aBlock value: x@y ] ]
3738]
3839
3940{ #category : ' iterate' }
40- CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [
41+ CTAlternateArray2D >> allPositionsWithin: someDistance from: someOrigin [
4142 | answer topLeft bottomRight |
4243 answer := OrderedCollection new .
4344 topLeft := someOrigin - someDistance max: self firstPosition.
4445 bottomRight := someOrigin + someDistance min: self dimension.
45- topLeft pointTo: bottomRight do: [ :each | answer add: each ].
46+
47+ topLeft x to: bottomRight x do: [ :x |
48+ topLeft y to: bottomRight y do: [ :y |
49+ answer add: x@y ] ].
50+
4651 ^ answer
4752]
4853
You can’t perform that action at this time.
0 commit comments