#[derive(Debug)]
pub enum FEV<M:MeshTopology>{
	Vert(M::Vert),
	Edge(M::Edge),
	Face(M::Face),
}

pub trait UndirectedEdge{
	type DirectedEdge:DirectedEdge<UndirectedEdge=Self>;
	fn as_directed(self,parity:bool)->Self::DirectedEdge;
}
pub trait DirectedEdge{
	type UndirectedEdge:UndirectedEdge<DirectedEdge=Self>;
	fn as_undirected(self)->Self::UndirectedEdge;
	fn parity(&self)->bool;
	fn reverse(self)->Self
		where
			Self:Sized
	{
		let parity=!self.parity();
		self.as_undirected().as_directed(parity)
	}
}

pub trait MeshTopology{
	type Face;
	type Edge:UndirectedEdge<DirectedEdge=Self::DirectedEdge>;
	type DirectedEdge:DirectedEdge<UndirectedEdge=Self::Edge>;
	type Vert;
	fn for_each_vert_edge(&self,vert_id:Self::Vert,f:impl FnMut(Self::DirectedEdge));
	fn for_each_vert_face(&self,vert_id:Self::Vert,f:impl FnMut(Self::Face));
	fn edge_faces(&self,edge_id:Self::Edge)->impl AsRef<[Self::Face;2]>;
	fn edge_verts(&self,edge_id:Self::Edge)->impl AsRef<[Self::Vert;2]>;
	#[expect(unused)]
	fn for_each_face_vert(&self,face_id:Self::Face,f:impl FnMut(Self::Vert));
	fn for_each_face_edge(&self,face_id:Self::Face,f:impl FnMut(Self::DirectedEdge));
}

// Make face_nd d value relative
// euclidean point?
// Simplex physics
// Directed edge necessary?
// recursive for_each function calls
// define faces from vertices (Fixed<2> vs Fixed<3>)
pub trait MeshQuery:MeshTopology{
	type Position;
	type Direction;
	type Normal;
	type Offset;
	fn vert(&self,vert_id:Self::Vert)->Self::Position;
	fn farthest_vert(&self,dir:Self::Direction)->Self::Vert;
	/// This must return a point inside the mesh.
	fn hint_point(&self)->Self::Position;
	fn face_nd(&self,face_id:Self::Face)->(Self::Normal,Self::Offset);
	fn edge_n(&self,edge_id:Self::Edge)->Self::Direction;
	fn directed_edge_n(&self,directed_edge_id:Self::DirectedEdge)->Self::Direction;
}
