use num_traits::ToPrimitive;
use crate::{
numeric::{cgar_f64::CgarF64, cgar_rational::CgarRational, lazy_exact::LazyExact},
operations::*,
};
use std::{
hash::Hash,
ops::{Add, AddAssign, Div, Mul, Neg, Sub, SubAssign},
};
use std::fmt::Debug;
pub trait FromRef<T> {
fn from_ref(value: &T) -> Self;
}
pub trait RefInto<T> {
fn ref_into(&self) -> T;
}
pub trait Scalar:
Clone
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
+ Default
+ Debug
+ Abs
+ Zero
+ One
+ Neg<Output = Self>
+ Eq
+ PartialEq
+ ToPrimitive
+ Hash
+ PartialOrd
+ From<i32>
+ From<f64>
+ From<rug::Rational>
+ From<CgarF64>
+ From<CgarRational>
+ From<LazyExact>
+ Into<CgarF64>
+ FromRef<CgarF64>
+ FromRef<CgarRational>
+ FromRef<LazyExact>
+ RefInto<CgarF64>
+ RefInto<CgarRational>
+ RefInto<LazyExact>
{
fn min(self, other: Self) -> Self {
if self < other { self } else { other }
}
fn max(self, other: Self) -> Self {
if self > other { self } else { other }
}
fn sign(&self) -> i8;
fn from_num_den(num: i32, den: i32) -> Self;
fn cmp_ref(a: &Self, b: &Self) -> core::cmp::Ordering;
fn tolerance() -> Self;
fn tolerance_squared() -> Self;
fn point_merge_threshold() -> Self;
fn edge_degeneracy_threshold() -> Self;
fn area_degeneracy_threshold() -> Self;
fn query_tolerance() -> Self;
fn query_tolerance_squared() -> Self;
fn point_merge_threshold_squared() -> Self;
fn approx_eq(&self, other: &Self) -> bool;
fn as_f64_fast(&self) -> Option<f64>;
fn double_interval(&self) -> Option<(f64, f64)> {
None }
fn ball_center_f64(&self) -> f64;
}