mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
@@ -18,8 +18,8 @@ macro_rules! impl_numeric_float {
|
||||
($t: ident) => {
|
||||
impl Numeric for $t {
|
||||
const INTEGRAL: bool = false;
|
||||
const MIN: Self = std::$t::MIN;
|
||||
const MAX: Self = std::$t::MAX;
|
||||
const MIN: Self = $t::MIN;
|
||||
const MAX: Self = $t::MAX;
|
||||
|
||||
#[inline(always)]
|
||||
fn to_f64(self) -> f64 {
|
||||
@@ -44,8 +44,8 @@ macro_rules! impl_numeric_integer {
|
||||
($t: ident) => {
|
||||
impl Numeric for $t {
|
||||
const INTEGRAL: bool = true;
|
||||
const MIN: Self = std::$t::MIN;
|
||||
const MAX: Self = std::$t::MAX;
|
||||
const MIN: Self = $t::MIN;
|
||||
const MAX: Self = $t::MAX;
|
||||
|
||||
#[inline(always)]
|
||||
fn to_f64(self) -> f64 {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::f32::INFINITY;
|
||||
use std::fmt;
|
||||
|
||||
use crate::{lerp, pos2, vec2, Div, Mul, Pos2, Rangef, Rot2, Vec2};
|
||||
@@ -33,8 +32,8 @@ pub struct Rect {
|
||||
impl Rect {
|
||||
/// Infinite rectangle that contains every point.
|
||||
pub const EVERYTHING: Self = Self {
|
||||
min: pos2(-INFINITY, -INFINITY),
|
||||
max: pos2(INFINITY, INFINITY),
|
||||
min: pos2(-f32::INFINITY, -f32::INFINITY),
|
||||
max: pos2(f32::INFINITY, f32::INFINITY),
|
||||
};
|
||||
|
||||
/// The inverse of [`Self::EVERYTHING`]: stretches from positive infinity to negative infinity.
|
||||
@@ -53,8 +52,8 @@ impl Rect {
|
||||
/// assert_eq!(rect, Rect::from_min_max(pos2(0.0, 1.0), pos2(2.0, 3.0)))
|
||||
/// ```
|
||||
pub const NOTHING: Self = Self {
|
||||
min: pos2(INFINITY, INFINITY),
|
||||
max: pos2(-INFINITY, -INFINITY),
|
||||
min: pos2(f32::INFINITY, f32::INFINITY),
|
||||
max: pos2(-f32::INFINITY, -f32::INFINITY),
|
||||
};
|
||||
|
||||
/// An invalid [`Rect`] filled with [`f32::NAN`].
|
||||
|
||||
@@ -138,7 +138,9 @@ fn test_aim() {
|
||||
assert_eq!(best_in_range_f64(99.999, 100.000), 100.0);
|
||||
assert_eq!(best_in_range_f64(10.001, 100.001), 100.0);
|
||||
|
||||
use std::f64::{INFINITY, NAN, NEG_INFINITY};
|
||||
const NAN: f64 = f64::NAN;
|
||||
const INFINITY: f64 = f64::INFINITY;
|
||||
const NEG_INFINITY: f64 = f64::NEG_INFINITY;
|
||||
assert!(best_in_range_f64(NAN, NAN).is_nan());
|
||||
assert_eq!(best_in_range_f64(NAN, 1.2), 1.2);
|
||||
assert_eq!(best_in_range_f64(NAN, INFINITY), INFINITY);
|
||||
|
||||
Reference in New Issue
Block a user