Struct k::joint::Range [−][src]
min/max range to check the joint position
Fields
min: T
max: T
Implementations
impl<T> Range<T> where
T: RealField,
[src]
T: RealField,
pub fn new(min: T, max: T) -> Self
[src]
Create new Range instance
In case min
is greater than max
, this function panics.
Examples
let range = k::joint::Range::new(-1.0, 1.0); // let range = k::joint::Range::new(1.0, -1.0); // panic
pub fn is_valid(&self, val: T) -> bool
[src]
Check if the value is in the range
true
means it is OK.
If the val is the same as the limit value (min
or max
), it returns true (valid).
Examples
let range = k::joint::Range::new(-1.0, 1.0); assert!(range.is_valid(0.0)); assert!(range.is_valid(1.0)); assert!(!range.is_valid(1.5));
pub fn clamp(&self, val: T) -> T
[src]
Clamp the value with the range
Examples
let range = k::joint::Range::new(-1.0, 1.0); assert_eq!(range.clamp(0.5), 0.5); assert_eq!(range.clamp(2.0), 1.0); assert_eq!(range.clamp(-2.0), -1.0);
Trait Implementations
impl<T: Clone + RealField> Clone for Range<T>
[src]
impl<T: Copy + RealField> Copy for Range<T>
[src]
impl<T: Debug + RealField> Debug for Range<T>
[src]
impl<T> From<RangeInclusive<T>> for Range<T> where
T: RealField,
[src]
T: RealField,
fn from(range: RangeInclusive<T>) -> Self
[src]
Examples
let range : k::joint::Range<f64> = (-1.0..=1.0).into(); assert!(range.is_valid(0.0)); assert!(range.is_valid(1.0)); assert!(!range.is_valid(1.5));
Auto Trait Implementations
impl<T> RefUnwindSafe for Range<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Range<T>
impl<T> Sync for Range<T>
impl<T> Unpin for Range<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Range<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,