implement MinkowskiMesh::farthest_vert
This commit is contained in:
parent
751ccf57ca
commit
559a38b607
@ -415,6 +415,7 @@ impl Planar64{
|
|||||||
pub const ZERO:Self=Self(0);
|
pub const ZERO:Self=Self(0);
|
||||||
pub const ONE:Self=Self(1<<32);
|
pub const ONE:Self=Self(1<<32);
|
||||||
pub const MAX:Self=Self(i64::MAX);
|
pub const MAX:Self=Self(i64::MAX);
|
||||||
|
pub const MIN:Self=Self(i64::MIN);
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn int(num:i32)->Self{
|
pub const fn int(num:i32)->Self{
|
||||||
Self(Self::ONE.0*num as i64)
|
Self(Self::ONE.0*num as i64)
|
||||||
|
@ -244,6 +244,19 @@ impl TransformedMesh<'_>{
|
|||||||
normal_transform,
|
normal_transform,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn farthest_vert(&self,dir:Planar64Vec3)->VertId{
|
||||||
|
let best_dot=Planar64::MIN;
|
||||||
|
let best_vert;
|
||||||
|
for (i,vert) in self.mesh.verts.iter().enumerate(){
|
||||||
|
let p=self.transform.transform_point3(vert.0);
|
||||||
|
let d=dir.dot(p);
|
||||||
|
if best_dot<d{
|
||||||
|
best_dot=d;
|
||||||
|
best_vert=VertId(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
best_vert
|
||||||
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn vert_directed_edges(&self,vert_id:VertId)->Cow<Vec<DirectedEdgeId>>{
|
fn vert_directed_edges(&self,vert_id:VertId)->Cow<Vec<DirectedEdgeId>>{
|
||||||
self.mesh.vert_directed_edges(vert_id)
|
self.mesh.vert_directed_edges(vert_id)
|
||||||
@ -321,6 +334,9 @@ impl MinkowskiMesh<'_>{
|
|||||||
mesh1,
|
mesh1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn farthest_vert(&self,dir:Planar64Vec3)->MinkowskiVert{
|
||||||
|
MinkowskiVert::VertVert(self.mesh0.farthest_vert(dir),self.mesh1.farthest_vert(-dir))
|
||||||
|
}
|
||||||
fn closest_fev(&self,point:Planar64Vec3)->FEV<MinkowskiFace,MinkowskiEdge,MinkowskiVert>{
|
fn closest_fev(&self,point:Planar64Vec3)->FEV<MinkowskiFace,MinkowskiEdge,MinkowskiVert>{
|
||||||
//put some genius code right here instead of this
|
//put some genius code right here instead of this
|
||||||
//assume that point is outside the mesh and nonzero
|
//assume that point is outside the mesh and nonzero
|
||||||
|
Loading…
Reference in New Issue
Block a user