introduce dot128
This commit is contained in:
parent
6049aba716
commit
27a46093ae
@ -645,6 +645,12 @@ impl Planar64Vec3{
|
||||
)>>32) as i64)
|
||||
}
|
||||
#[inline]
|
||||
pub fn dot128(&self,rhs:Self)->i128{
|
||||
(self.0.x as i128)*(rhs.0.x as i128)+
|
||||
(self.0.y as i128)*(rhs.0.y as i128)+
|
||||
(self.0.z as i128)*(rhs.0.z as i128)
|
||||
}
|
||||
#[inline]
|
||||
pub fn cross(&self,rhs:Self)->Planar64Vec3{
|
||||
Planar64Vec3(glam::i64vec3(
|
||||
(((self.0.y as i128)*(rhs.0.z as i128)-(self.0.z as i128)*(rhs.0.y as i128))>>32) as i64,
|
||||
|
@ -794,9 +794,9 @@ impl TouchingState{
|
||||
//TODO: trey push solve
|
||||
for contact in &self.contacts{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let d=n.dot(*velocity);
|
||||
if d<Planar64::ZERO{
|
||||
*velocity-=n*(d/n.dot(n));
|
||||
let d=n.dot128(*velocity);
|
||||
if d<0{
|
||||
*velocity-=n*Planar64::raw(((d<<32)/n.dot128(n)) as i64);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,9 +804,9 @@ impl TouchingState{
|
||||
//TODO: trey push solve
|
||||
for contact in &self.contacts{
|
||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||
let d=n.dot(*acceleration);
|
||||
if d<Planar64::ZERO{
|
||||
*acceleration-=n*(d/n.dot(n));
|
||||
let d=n.dot128(*acceleration);
|
||||
if d<0{
|
||||
*acceleration-=n*Planar64::raw(((d<<32)/n.dot128(n)) as i64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user