Vector2

class Vector2(val x: Double, val y: Double)

Constructors

Link copied to clipboard
constructor(x: Double, y: Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val x: Double
Link copied to clipboard
val y: Double

Functions

Link copied to clipboard
fun abs(): Vector2
Link copied to clipboard
fun angle(): Double

The angle in RADIANS between the Y=0 line, and the line (0,0)->this

fun angle(other: Vector2): Double

Returns the angle in RADIANS of the lines (0,0)->this and (0,0)->other

Link copied to clipboard

The angle in degrees between the Y=0 line, and the line (0,0)->this

Returns the angle in degrees of the lines (0,0)->this and (0,0)->other

Link copied to clipboard
fun cross(other: Vector2): Double
Link copied to clipboard
fun distance(other: Vector2): Double
Link copied to clipboard
Link copied to clipboard
operator fun div(scale: Double): Vector2
operator fun div(other: Vector2): Vector2
Link copied to clipboard
fun dot(other: Vector2): Double
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Is this point on the left of the infinite line passing through points a to b?

Link copied to clipboard
fun length(): Double
Link copied to clipboard
Link copied to clipboard
operator fun minus(other: Vector2): Vector2
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Create a Vector of length 1 pointing in the same direction as this. The same as unit

Link copied to clipboard
operator fun plus(other: Vector2): Vector2
Link copied to clipboard
fun rotate(radians: Double): Vector2

Rotates the vector about the origin using RADIANS. The rotation is anticlockwise if the y-axis points downwards.

Link copied to clipboard
Link copied to clipboard
operator fun times(scale: Double): Vector2
operator fun times(other: Vector2): Vector2
Link copied to clipboard
fun to3d(): Vector3
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun towards(other: Vector2, distance: Double): Vector2
Link copied to clipboard
operator fun unaryMinus(): Vector2
Link copied to clipboard
fun unit(): Vector2

Create a Vector of length 1 pointing in the same direction as this. The same as normalise