data structures
This commit is contained in:
parent
558febabc3
commit
06eeac6043
@ -3,13 +3,13 @@ use crate::model_physics::{VirtualMesh,FEV,FaceId};
|
|||||||
use crate::integer::{Time,Planar64Vec3};
|
use crate::integer::{Time,Planar64Vec3};
|
||||||
|
|
||||||
struct State{
|
struct State{
|
||||||
time:Time,
|
|
||||||
fev:FEV,
|
fev:FEV,
|
||||||
|
time:Time,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Transition{
|
enum Transition{
|
||||||
Miss,
|
Miss,
|
||||||
NextState(State),
|
Next(FEV,Time),
|
||||||
Hit(FaceId,Time),
|
Hit(FaceId,Time),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
use crate::integer::{Planar64,Planar64Vec3};
|
use crate::integer::{Planar64,Planar64Vec3};
|
||||||
|
|
||||||
|
#[derive(Clone,Copy)]
|
||||||
pub struct VertId(usize);
|
pub struct VertId(usize);
|
||||||
|
#[derive(Clone,Copy)]
|
||||||
pub struct EdgeId(usize);
|
pub struct EdgeId(usize);
|
||||||
|
#[derive(Clone,Copy)]
|
||||||
pub struct FaceId(usize);
|
pub struct FaceId(usize);
|
||||||
|
|
||||||
//Vertex <-> Edge <-> Face -> Collide
|
//Vertex <-> Edge <-> Face -> Collide
|
||||||
pub enum FEV{
|
pub enum FEV{
|
||||||
Face(FaceId),
|
Face(FaceId),
|
||||||
Edge(EdgeId),
|
Edge(EdgeId),
|
||||||
Vertex(VertId),
|
Vert(VertId),
|
||||||
}
|
}
|
||||||
|
|
||||||
//use Unit32 #[repr(C)] for map files
|
//use Unit32 #[repr(C)] for map files
|
||||||
@ -17,17 +20,15 @@ struct Face{
|
|||||||
dot:Planar64,
|
dot:Planar64,
|
||||||
}
|
}
|
||||||
struct FaceRefs{
|
struct FaceRefs{
|
||||||
edges:Vec<EdgeId>,
|
edges:Vec<(EdgeId,FaceId)>,
|
||||||
verts:Vec<VertId>,
|
verts:Vec<VertId>,
|
||||||
}
|
}
|
||||||
struct EdgeRefs{
|
struct EdgeRefs{
|
||||||
faces:[FaceId;2],//left, right
|
faces:[FaceId;2],//left, right
|
||||||
verts:[VertId;2],//bottom, top
|
verts:[(VertId,FaceId);2],//bottom, top
|
||||||
vert_faces:[FaceId;2],//bottom, top
|
|
||||||
}
|
}
|
||||||
struct VertRefs{
|
struct VertRefs{
|
||||||
faces:Vec<FaceId>,
|
edges:Vec<(EdgeId,FaceId)>,
|
||||||
edges:Vec<EdgeId>,
|
|
||||||
}
|
}
|
||||||
pub struct PhysicsMesh{
|
pub struct PhysicsMesh{
|
||||||
faces:Vec<Face>,
|
faces:Vec<Face>,
|
||||||
@ -36,28 +37,22 @@ pub struct PhysicsMesh{
|
|||||||
vert_topology:Vec<VertRefs>,
|
vert_topology:Vec<VertRefs>,
|
||||||
}
|
}
|
||||||
impl PhysicsMesh{
|
impl PhysicsMesh{
|
||||||
pub fn face_normal(&self,face_id:FaceId)->Planar64Vec3{
|
pub fn face_nd(&self,face_id:FaceId)->(Planar64Vec3,Planar64){
|
||||||
self.faces[face_id.0].normal
|
(self.faces[face_id.0].normal,self.faces[face_id.0].dot)
|
||||||
}
|
}
|
||||||
//ideally I never calculate the vertex position, but I have to for the graphical meshes...
|
//ideally I never calculate the vertex position, but I have to for the graphical meshes...
|
||||||
pub fn face_edges(&self,face_id:FaceId)->&Vec<EdgeId>{
|
pub fn face_edges(&self,face_id:FaceId)->&Vec<(EdgeId,FaceId)>{
|
||||||
&self.face_topology[face_id.0].edges
|
&self.face_topology[face_id.0].edges
|
||||||
}
|
}
|
||||||
pub fn edge_side_faces(&self,edge_id:EdgeId)->&[FaceId;2]{
|
pub fn edge_side_faces(&self,edge_id:EdgeId)->&[FaceId;2]{
|
||||||
&self.edge_topology[edge_id.0].faces
|
&self.edge_topology[edge_id.0].faces
|
||||||
}
|
}
|
||||||
pub fn edge_end_faces(&self,edge_id:EdgeId)->&[FaceId;2]{
|
pub fn edge_ends(&self,edge_id:EdgeId)->&[(VertId,FaceId);2]{
|
||||||
&self.edge_topology[edge_id.0].vert_faces
|
|
||||||
}
|
|
||||||
pub fn edge_verts(&self,edge_id:EdgeId)->&[VertId;2]{
|
|
||||||
&self.edge_topology[edge_id.0].verts
|
&self.edge_topology[edge_id.0].verts
|
||||||
}
|
}
|
||||||
pub fn vert_edges(&self,vert_id:VertId)->&Vec<EdgeId>{
|
pub fn vert_edges(&self,vert_id:VertId)->&Vec<(EdgeId,FaceId)>{
|
||||||
&self.vert_topology[vert_id.0].edges
|
&self.vert_topology[vert_id.0].edges
|
||||||
}
|
}
|
||||||
pub fn vert_faces(&self,vert_id:VertId)->&Vec<FaceId>{
|
|
||||||
&self.vert_topology[vert_id.0].faces
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Note that a face on a minkowski mesh refers to a pair of fevs on the meshes it's summed from
|
//Note that a face on a minkowski mesh refers to a pair of fevs on the meshes it's summed from
|
||||||
|
Loading…
Reference in New Issue
Block a user