package org.nstart.dep265.tletools.zeptomoby.core

import kotlin.math.abs
import kotlin.math.acos
import kotlin.math.sqrt

@Suppress("unused")
class Vector(
    var x: Double = 0.0,
    var y: Double = 0.0,
    var z: Double = 0.0,
    var w: Double = 0.0) {

    fun sub(v: Vector) {
        x -= v.x
        y -= v.y
        z -= v.z
        w -= v.w
    }

    fun mul(f: Double) {
        x *= f
        y *= f
        z *= f
        w *= abs(f)
    }

    fun angle(v: Vector): Double = acos(dot(v) / (magnitude() * v.magnitude()))
    fun magnitude(): Double = sqrt(x*x + y*y + z*z)
    fun dot(v: Vector): Double = x*v.x + y*v.y + z*v.z
}