mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-22 23:26:33 +11:00
Merge pull request #292 from corwinkuiper/fix-fast-normalise
take absolute values of the x, y coordinate
This commit is contained in:
commit
3dda6fb0da
2 changed files with 5 additions and 2 deletions
|
@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Custom allocator support using the `Allocator` trait for `HashMap`. This means the `HashMap` can be used with `InternalAllocator` to allocate to IWRAM or the `ExternalAllocator` to explicitly allocate to EWRAM.
|
||||
- Support for using windows on the GBA. Windows are used to selectively enable rendering of certain layers or effects.
|
||||
|
||||
## Fixed
|
||||
- Fixed the fast magnitude function in agb_fixnum. This is also used in fast_normalise. Previously only worked for positive (x, y).
|
||||
|
||||
## [0.11.1] - 2022/08/02
|
||||
|
||||
Version 0.11.1 brings documentation for fixed point numbers. We recommend all users upgrade to this version since it also includes fixes to a few functions in fixnum. See changed section for breaking changes.
|
||||
|
|
|
@ -693,8 +693,8 @@ impl<const N: usize> Vector2D<Num<i32, N>> {
|
|||
/// ```
|
||||
#[must_use]
|
||||
pub fn fast_magnitude(self) -> Num<i32, N> {
|
||||
let max = core::cmp::max(self.x, self.y);
|
||||
let min = core::cmp::min(self.x, self.y);
|
||||
let max = core::cmp::max(self.x.abs(), self.y.abs());
|
||||
let min = core::cmp::min(self.x.abs(), self.y.abs());
|
||||
|
||||
max * num!(0.960433870103) + min * num!(0.397824734759)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue