use std::ops::{Add, Sub};
use derive_more::*;
use crate::prelude::*;
#[derive(Clone, Copy, Debug, Display, From, PartialEq)]
pub struct PositionVector<T: Scalar>(pub(crate) Vector<T>);
impl<T: Scalar> From<PositionVector<T>> for Vector<T> {
fn from(from: PositionVector<T>) -> Self {
from.0
}
}
impl<T: Scalar> Add<RelativeVector<T>> for PositionVector<T> {
type Output = Self;
fn add(self, other: RelativeVector<T>) -> Self {
Self(self.0 + other.0)
}
}
impl<T: Scalar> Sub<RelativeVector<T>> for PositionVector<T> {
type Output = Self;
fn sub(self, other: RelativeVector<T>) -> Self {
Self(self.0 - other.0)
}
}
impl<T: Scalar> Sub for PositionVector<T> {
type Output = RelativeVector<T>;
fn sub(self, other: PositionVector<T>) -> Self::Output {
RelativeVector(self.0 - other.0)
}
}
impl<T: IntScalar> Eq for PositionVector<T> {}