Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 3.99 KB

index.md

File metadata and controls

39 lines (30 loc) · 3.99 KB

//astronomy/io.github.cosinekitty.astronomy/Vector

Vector

data class Vector(x: Double, y: Double, z: Double, t: Time)

A 3D Cartesian vector whose components are expressed in Astronomical Units (AU).

Constructors

Vector
fun Vector(x: Double, y: Double, z: Double, t: Time)

Functions

Name Summary
angleWith
fun angleWith(other: Vector): Double
Calculates the angle in degrees (0..180) between two vectors.
div
operator fun div(denom: Double): Vector
Divides a vector by a scalar.
dot
infix fun dot(other: Vector): Double
Takes the dot product of two vectors.
length
fun length(): Double
The total distance in AU represented by this vector.
minus
operator fun minus(other: Vector): Vector
Subtracts one vector from another. Both operands must have identical times.
plus
operator fun plus(other: Vector): Vector
Adds two vectors. Both operands must have identical times.
toEquatorial
fun toEquatorial(): Equatorial
Given an equatorial vector, calculates equatorial angular coordinates.
toHorizontal
fun toHorizontal(refraction: Refraction): Spherical
Converts Cartesian coordinates to horizontal coordinates.
toObserver
fun toObserver(equator: EquatorEpoch): Observer
Calculates the geographic location corresponding to a geocentric equatorial vector.
toSpherical
fun toSpherical(): Spherical
Converts Cartesian coordinates to spherical coordinates.
unaryMinus
operator fun unaryMinus(): Vector
Negates a vector; the same as multiplying the vector by the scalar -1.
withTime
fun withTime(time: Time): Vector
Creates a new vector with the same coordinates but a different time.

Properties

Name Summary
t
val t: Time
The date and time at which this vector is valid.
x
val x: Double
A Cartesian x-coordinate expressed in AU.
y
val y: Double
A Cartesian y-coordinate expressed in AU.
z
val z: Double
A Cartesian z-coordinate expressed in AU.