getDifference

fun Point.getDifference(that: Point): Offset

Receiver

The Point from whose coordinates the coordinates of that point will be subtracted.

Return

An instance of Offset built from the difference between the Point.x and Point.y coordinates of this receiver and that respectively.

val a = pointOf(xN, yN)
val b = pointOf(xM, yM)
val offset = b.getDifference(a)
assertEquals(offset.dX, xM - xN)
assertEquals(offset.dY, yM - yN)

Y
| b
yM - *
|
|
| a
yN - *
|
+---|---------|-----> X
xN xM

Author

Stanley Wintergreen

Since

0.1.0

Sources

Link copied to clipboard