package advmath // VecConst represents any vector of a given spacial dimension // N is the number space of the vectors individual units type VecConst[N Real] interface { Vec2[N] | Vec3[N] | Vec4[N] } // Vec represents any vector in a given spacial dimension (up to 4d) // N is the number space of the vectors individual units // V is the vector dimension (one of Vec2, Vec3, Vec4) type Vec[N Real, V VecConst[N]] interface { X() N Y() N Z() N W() N // Add returns a new vector which represents the sum of this vector and o Add(o Vec[N, V]) Vec[N, V] // Add returns a new vector which represents the difference of this vector and o Sub(o Vec[N, V]) Vec[N, V] // Add returns a new vector which represents the multiplication of this vector and o Mul(o Vec[N, V]) Vec[N, V] // Add returns a new vector which represents the division of this vector and o Div(o Vec[N, V]) Vec[N, V] // Len returns the length of this vector Len() N // Norm returns a new vector of length 1 pointing in the same direction Norm() Vec[N, V] // Dot returns the dot product of this vector and o Dot(o Vec[N, V]) N // Lerp returns the vector inbetween this vector and o. // t should be between [0, 1] (both inclusive) and determines where the returning vector should be between these vectors. Lerp(o Vec[N, V], t N) Vec[N, V] StringPrecise() string String() string } var _ Vec[int, Vec2[int]] = &Vec2[int]{} var _ Vec[int, Vec3[int]] = &Vec3[int]{} var _ Vec[int, Vec4[int]] = &Vec4[int]{}