oxygen_quark/
vector.rs

1pub mod vector2d;
2pub mod vector3d;
3
4use std::result;
5
6#[derive(Debug)]
7pub enum VectorError {
8    NonThreeDimensionalVector,
9    NonExistingTransformError,
10}
11
12type Result<T> = result::Result<T, VectorError>;
13
14pub trait Vector {
15    type Data;
16
17    fn from(values: &[Self::Data]) -> Self;
18    fn component_product(self, other: Self) -> Self;
19    fn dot_product(self, other: Self) -> Self::Data;
20    fn cross_product(self, other: Self) -> Result<Self>
21    where
22        Self: Sized;
23    fn scale(&self, scale: Self::Data) -> Self;
24    fn norm(self) -> Self::Data;
25    fn normalise(self) -> Self;
26}