1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Add emath::fast_midpoint (#7435)

This commit is contained in:
Emil Ernerfeldt
2025-08-08 12:04:51 +02:00
committed by GitHub
parent 3024c39eaf
commit 6fae65a3fa
5 changed files with 23 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
use std::fmt;
use crate::{Div, Mul, NumExt as _, Pos2, Rangef, Rot2, Vec2, lerp, pos2, vec2};
use crate::{Div, Mul, NumExt as _, Pos2, Rangef, Rot2, Vec2, fast_midpoint, lerp, pos2, vec2};
use std::ops::{BitOr, BitOrAssign};
/// A rectangular region of space.
@@ -331,8 +331,8 @@ impl Rect {
#[inline(always)]
pub fn center(&self) -> Pos2 {
Pos2 {
x: f32::midpoint(self.min.x, self.max.x),
y: f32::midpoint(self.min.y, self.max.y),
x: fast_midpoint(self.min.x, self.max.x),
y: fast_midpoint(self.min.y, self.max.y),
}
}