mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
wip: fixing Map, centering
This commit is contained in:
parent
059ff2ca79
commit
d17d20e7db
10 changed files with 104 additions and 78 deletions
|
|
@ -90,6 +90,9 @@ pub trait Area<N: Coordinate> {
|
|||
Ok(self)
|
||||
}
|
||||
}
|
||||
#[inline] fn xy (&self) -> [N;2] {
|
||||
[self.x(), self.y()]
|
||||
}
|
||||
#[inline] fn wh (&self) -> [N;2] {
|
||||
[self.w(), self.h()]
|
||||
}
|
||||
|
|
@ -121,7 +124,10 @@ pub trait Area<N: Coordinate> {
|
|||
[self.x(), self.x2(), self.y(), self.y2()]
|
||||
}
|
||||
#[inline] fn center (&self) -> [N;2] {
|
||||
[self.x() + self.w() / 2.into(), self.y() + self.h() / 2.into()]
|
||||
[self.x() + self.w()/2.into(), self.y() + self.h()/2.into()]
|
||||
}
|
||||
#[inline] fn centered (&self) -> [N;2] {
|
||||
[self.x().minus(self.w()/2.into()), self.y().minus(self.h()/2.into())]
|
||||
}
|
||||
fn zero () -> [N;4] {
|
||||
[N::zero(), N::zero(), N::zero(), N::zero()]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue