toVector

fun Point.toVector(finish: Point): Vector

Return

An instance of Vector built from the this receiver as Vector.start and finish as Vector.finish.

val start = pointOf(1, 2)
val finish = pointOf(3, 4)
val vector = start.toVector(finish)
assertEquals(vector.start, start)
assertEquals(vector.finish, finish)

Author

Stanley Wintergreen

Since

0.1.0


fun Point.toVector(offset: Offset): Vector

Return

An instance of Vector for which Vector.start is this receiver and Vector.finish is this receiver modified by the offset.

val start = pointOf(1, 2)
val offset = offsetOf(3.0, 4.0)
val vector = start.toVector(offset)
assertEquals(vector.start, start)
assertEquals(vector.finish, start.updated(offset))

Author

Stanley Wintergreen

Since

0.1.0

See also


fun Point.toVector(finish: Point, offset: Offset): Vector

Return

An instance of Vector for which Vector.start is this receiver modified by the offset and Vector.finish is finish modified by the offset.

val start = pointOf(1, 2)
val finish = pointOf(3, 4)
val offset = offsetOf(5.0, 6.0)
val vector = start.toVector(finish, offset)
assertEquals(vector.start, start.updated(offset))
assertEquals(vector.finish, finish.updated(offset))

Author

Stanley Wintergreen

Since

0.1.0

See also


fun Point.toVector(length: Double, angle: Double): Vector

Return

An instance of Vector for which Vector.start is this receiver and Vector.finish is this receiver moved by the length and angle.

val start = pointOf(1, 2)
val length = 3.0
val angle = 4.0
val vector = start.toVector(length = length, angle = angle)
assertEquals(vector.start, start)
assertEquals(vector.finish, start.moved(length = length, angle = angle))

Author

Stanley Wintergreen

Since

0.1.0

See also

Sources

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard