Skip to content

Commit

Permalink
- Deprecated Point>>#dist: (in favour of Point>>#distanceTo:)
Browse files Browse the repository at this point in the history
- Removed test PointTest>>#testDist (it was the same as PointTest>>#testDistanceTo)
  • Loading branch information
dupriezt committed Feb 9, 2021
1 parent 3a5e66e commit 8581b1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/Graphics-Tests/PointTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,6 @@ PointTest >> testCrossProduct [
self assert: (1 @ 2 crossProduct: 3 @ 4) equals: -2
]

{ #category : #'tests - point functions' }
PointTest >> testDist [
self assert: (0 @ 0 dist: 0 @ 0) equals: 0.
self assert: (0 @ 0 dist: 0 @ 5) equals: 5.
self assert: (5 @ 0 dist: 0 @ 0) equals: 5.
self assert: (3 @ 0 dist: 0 @ 4) equals: 5.
self assert: (5 @ 0 dist: 2 @ 4) equals: 5.
self deny: (0 @ 0 dist: 0 @ 0) equals: 1
]

{ #category : #'tests - point functions' }
PointTest >> testDistanceTo [
self assert: (0 @ 0 distanceTo: 0 @ 0) equals: 0.
Expand Down
7 changes: 7 additions & 0 deletions src/Math-Operations-Extensions/Point.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ Point >> degrees [
Point >> dist: aPoint [
"Answer the distance between aPoint and the receiver."
| dx dy |
self
deprecated: 'Use #distanceTo: instead.'
on: '9 February 2021'
in: #Pharo9
transformWith: '`@receiver dist: `@arg' -> '`@receiver distanceTo: `@arg'.


dx := aPoint x - x.
dy := aPoint y - y.
^ (dx * dx + (dy * dy)) sqrt
Expand Down

0 comments on commit 8581b1b

Please sign in to comment.