TransformedMesh::new to avoid pub

This commit is contained in:
Quaternions 2023-11-03 18:57:49 -07:00
parent d8e605d203
commit 7ad0270d2f
2 changed files with 19 additions and 6 deletions

View File

@ -271,6 +271,19 @@ pub struct TransformedMesh<'a>{
normal_determinant:Planar64,
}
impl TransformedMesh<'_>{
pub fn new<'a>(
mesh:&'a PhysicsMesh,
transform:&'a crate::integer::Planar64Affine3,
normal_transform:&'a crate::integer::Planar64Mat3,
normal_determinant:Planar64
)->TransformedMesh<'a>{
TransformedMesh{
mesh,
transform,
normal_transform,
normal_determinant,
}
}
pub fn brute_in(&self,body:&crate::physics::Body,time_limit:crate::integer::Time)->Option<(FaceId,crate::integer::Time)>{
//check each face
let mut best_time=time_limit;

View File

@ -180,12 +180,12 @@ impl PhysicsModels{
//TODO: "statically" verify the maps don't refer to any nonexistant data, if they do delete the references.
//then I can make these getter functions unchecked.
fn mesh(&self,model_id:usize)->TransformedMesh{
TransformedMesh{
mesh:&self.meshes[self.models[model_id].mesh_id],
transform:&self.models[model_id].transform,
normal_transform:&self.models[model_id].normal_transform,
normal_determinant:self.models[model_id].normal_determinant,
}
TransformedMesh::new(
&self.meshes[self.models[model_id].mesh_id],
&self.models[model_id].transform,
&self.models[model_id].normal_transform,
self.models[model_id].normal_determinant,
)
}
fn model(&self,model_id:usize)->&PhysicsModel{
&self.models[model_id]