integer edits
This commit is contained in:
parent
59348f8cbe
commit
3f62b9b353
@ -606,15 +606,15 @@ impl Planar64Vec3{
|
|||||||
Self(glam::i64vec3(x,y,z))
|
Self(glam::i64vec3(x,y,z))
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn x(&self)->Planar64{
|
pub const fn x(&self)->Planar64{
|
||||||
Planar64(self.0.x)
|
Planar64(self.0.x)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn y(&self)->Planar64{
|
pub const fn y(&self)->Planar64{
|
||||||
Planar64(self.0.y)
|
Planar64(self.0.y)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn z(&self)->Planar64{
|
pub const fn z(&self)->Planar64{
|
||||||
Planar64(self.0.z)
|
Planar64(self.0.z)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -642,7 +642,7 @@ impl Planar64Vec3{
|
|||||||
self.0.cmplt(rhs.0)
|
self.0.cmplt(rhs.0)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn dot(&self,rhs:Self)->Planar64{
|
pub const fn dot(&self,rhs:Self)->Planar64{
|
||||||
Planar64(((
|
Planar64(((
|
||||||
(self.0.x as i128)*(rhs.0.x as i128)+
|
(self.0.x as i128)*(rhs.0.x as i128)+
|
||||||
(self.0.y as i128)*(rhs.0.y as i128)+
|
(self.0.y as i128)*(rhs.0.y as i128)+
|
||||||
@ -650,13 +650,13 @@ impl Planar64Vec3{
|
|||||||
)>>32) as i64)
|
)>>32) as i64)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn dot128(&self,rhs:Self)->i128{
|
pub const fn dot128(&self,rhs:Self)->i128{
|
||||||
(self.0.x as i128)*(rhs.0.x as i128)+
|
(self.0.x as i128)*(rhs.0.x as i128)+
|
||||||
(self.0.y as i128)*(rhs.0.y as i128)+
|
(self.0.y as i128)*(rhs.0.y as i128)+
|
||||||
(self.0.z as i128)*(rhs.0.z as i128)
|
(self.0.z as i128)*(rhs.0.z as i128)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn cross(&self,rhs:Self)->Planar64Vec3{
|
pub const fn cross(&self,rhs:Self)->Planar64Vec3{
|
||||||
Planar64Vec3(glam::i64vec3(
|
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,
|
(((self.0.y as i128)*(rhs.0.z as i128)-(self.0.z as i128)*(rhs.0.y as i128))>>32) as i64,
|
||||||
(((self.0.z as i128)*(rhs.0.x as i128)-(self.0.x as i128)*(rhs.0.z as i128))>>32) as i64,
|
(((self.0.z as i128)*(rhs.0.x as i128)-(self.0.x as i128)*(rhs.0.z as i128))>>32) as i64,
|
||||||
@ -664,12 +664,6 @@ impl Planar64Vec3{
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn walkable(&self,slope:Planar64,up:Self)->bool{
|
|
||||||
let y=self.dot(up);
|
|
||||||
let x=self.cross(up).length();
|
|
||||||
x*slope<y
|
|
||||||
}
|
|
||||||
#[inline]
|
|
||||||
pub fn length(&self)->Planar64{
|
pub fn length(&self)->Planar64{
|
||||||
let radicand=(self.0.x as i128)*(self.0.x as i128)+(self.0.y as i128)*(self.0.y as i128)+(self.0.z as i128)*(self.0.z as i128);
|
let radicand=(self.0.x as i128)*(self.0.x as i128)+(self.0.y as i128)*(self.0.y as i128)+(self.0.z as i128)*(self.0.z as i128);
|
||||||
Planar64(unsafe{(radicand as f64).sqrt().to_int_unchecked()})
|
Planar64(unsafe{(radicand as f64).sqrt().to_int_unchecked()})
|
||||||
|
Loading…
Reference in New Issue
Block a user