initialize variable + guarantees
This commit is contained in:
parent
0da6da24ac
commit
fa0be33bf5
@ -131,6 +131,7 @@ impl EdgePool{
|
|||||||
}
|
}
|
||||||
impl From<&crate::model::IndexedModel> for PhysicsMesh{
|
impl From<&crate::model::IndexedModel> for PhysicsMesh{
|
||||||
fn from(indexed_model:&crate::model::IndexedModel)->Self{
|
fn from(indexed_model:&crate::model::IndexedModel)->Self{
|
||||||
|
assert!(indexed_model.unique_pos.len()!=0,"Mesh cannot have 0 vertices");
|
||||||
let verts=indexed_model.unique_pos.iter().map(|v|Vert(v.clone())).collect();
|
let verts=indexed_model.unique_pos.iter().map(|v|Vert(v.clone())).collect();
|
||||||
let mut vert_ref_guys=vec![VertRefGuy::default();indexed_model.unique_pos.len()];
|
let mut vert_ref_guys=vec![VertRefGuy::default();indexed_model.unique_pos.len()];
|
||||||
let mut edge_pool=EdgePool::default();
|
let mut edge_pool=EdgePool::default();
|
||||||
@ -247,8 +248,8 @@ impl TransformedMesh<'_>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn farthest_vert(&self,dir:Planar64Vec3)->VertId{
|
fn farthest_vert(&self,dir:Planar64Vec3)->VertId{
|
||||||
let best_dot=Planar64::MIN;
|
let mut best_dot=Planar64::MIN;
|
||||||
let best_vert;
|
let mut best_vert=VertId(0);
|
||||||
for (i,vert) in self.mesh.verts.iter().enumerate(){
|
for (i,vert) in self.mesh.verts.iter().enumerate(){
|
||||||
let p=self.transform.transform_point3(vert.0);
|
let p=self.transform.transform_point3(vert.0);
|
||||||
let d=dir.dot(p);
|
let d=dir.dot(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user