use geometry_coords::CoordinateScalar;
use geometry_cs::Cartesian;
use geometry_tag::PointTag;
use geometry_trait::{Geometry, Point, PointMut};
use crate::Adapt;
impl<T: CoordinateScalar> Geometry for Adapt<(T, T)> {
type Kind = PointTag;
type Point = Self;
}
impl<T: CoordinateScalar> Point for Adapt<(T, T)> {
type Scalar = T;
type Cs = Cartesian;
const DIM: usize = 2;
#[inline]
fn get<const D: usize>(&self) -> T {
match D {
0 => self.0.0,
1 => self.0.1,
_ => unreachable!(),
}
}
}
impl<T: CoordinateScalar> PointMut for Adapt<(T, T)> {
#[inline]
fn set<const D: usize>(&mut self, value: T) {
match D {
0 => self.0.0 = value,
1 => self.0.1 = value,
_ => unreachable!(),
}
}
}
impl<T: CoordinateScalar> Geometry for Adapt<(T, T, T)> {
type Kind = PointTag;
type Point = Self;
}
impl<T: CoordinateScalar> Point for Adapt<(T, T, T)> {
type Scalar = T;
type Cs = Cartesian;
const DIM: usize = 3;
#[inline]
fn get<const D: usize>(&self) -> T {
match D {
0 => self.0.0,
1 => self.0.1,
2 => self.0.2,
_ => unreachable!(),
}
}
}
impl<T: CoordinateScalar> PointMut for Adapt<(T, T, T)> {
#[inline]
fn set<const D: usize>(&mut self, value: T) {
match D {
0 => self.0.0 = value,
1 => self.0.1 = value,
2 => self.0.2 = value,
_ => unreachable!(),
}
}
}