pub struct BB<T> {
pub x: T,
pub y: T,
pub w: T,
pub h: T,
}Fields§
§x: T§y: T§w: T§h: TImplementations§
Source§impl<T> BB<T>where
T: Calc + CoordinateBox,
impl<T> BB<T>where
T: Calc + CoordinateBox,
pub fn merge(&self, other: Self) -> Self
pub fn from_points_iter( points: impl Iterator<Item = Point<T>> + Clone, ) -> RvResult<Self>
pub fn from_vec(points: &[Point<T>]) -> RvResult<Self>
pub fn distance_to_boundary(&self, pos: Point<T>) -> T
pub fn split_horizontally(&self, y: T) -> (Self, Self)
pub fn split_vertically(&self, x: T) -> (Self, Self)
pub fn from_shape_int(shape: ShapeI) -> Self
pub fn from_shape(shape: Shape<T>) -> Self
pub fn y_max(&self) -> T
pub fn x_max(&self) -> T
pub fn intersect(self, other: BB<T>) -> BB<T>
pub fn points(&self) -> [Point<T>; 4]
pub fn intersect_or_self(&self, other: Option<BB<T>>) -> BB<T>
Sourcepub fn max_squaredist<'a>(
&'a self,
other: impl Iterator<Item = Point<T>> + 'a + Clone,
) -> (Point<T>, Point<T>, T)
pub fn max_squaredist<'a>( &'a self, other: impl Iterator<Item = Point<T>> + 'a + Clone, ) -> (Point<T>, Point<T>, T)
Return points of greatest distance between self and other
pub fn min_max(&self, axis: usize) -> (T, T)
Sourcepub fn points_iter<'a>(&'a self) -> impl Iterator<Item = Point<T>> + 'a + Clone
pub fn points_iter<'a>(&'a self) -> impl Iterator<Item = Point<T>> + 'a + Clone
Iteration order of corners 0 3 v ʌ 1 > 2
pub fn corner(&self, idx: usize) -> Point<T>
pub fn opposite_corner(&self, idx: usize) -> Point<T>
pub fn shape(&self) -> Shape<T>
pub fn from_points(p1: Point<T>, p2: Point<T>) -> Self
pub fn x_range(&self) -> Range<T>
pub fn y_range(&self) -> Range<T>
pub fn center_f(&self) -> (f64, f64)
pub fn min(&self) -> Point<T>
pub fn max(&self) -> Point<T>
pub fn covers_y(&self, y: T) -> bool
pub fn covers_x(&self, x: T) -> bool
pub fn contains<P>(&self, p: P) -> bool
pub fn contains_bb(&self, other: Self) -> bool
pub fn is_contained_in_image(&self, shape: ShapeI) -> bool
pub fn new_shape_checked( x: T, y: T, w: T, h: T, orig_im_shape: ShapeI, mode: OutOfBoundsMode<T>, ) -> Option<Self>
pub fn has_overlap(&self, other: &Self) -> bool
pub fn rot90_with_image_ntimes(&self, shape: ShapeI, n: u8) -> Selfwhere
T: Neg<Output = T>,
Source§impl BB<f64>
impl BB<f64>
pub fn translate( self, x_shift: f64, y_shift: f64, shape: ShapeI, oob_mode: OutOfBoundsMode<f64>, ) -> Option<Self>
pub fn follow_movement( &self, from: PtF, to: PtF, shape: ShapeI, oob_mode: OutOfBoundsMode<f64>, ) -> Option<Self>
pub fn new_fit_to_image(x: f64, y: f64, w: f64, h: f64, shape: ShapeI) -> Self
pub fn center_scale( &self, x_factor: f64, y_factor: f64, shape: ShapeI, center: Option<PtF>, ) -> Self
pub fn shift_max( &self, x_shift: f64, y_shift: f64, shape: ShapeI, ) -> Option<Self>
pub fn shift_min( &self, x_shift: f64, y_shift: f64, shape: ShapeI, ) -> Option<Self>
pub fn all_corners_close(&self, other: BbF) -> bool
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for BB<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for BB<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: Copy> Copy for BB<T>
impl<T: Eq> Eq for BB<T>
impl<T> StructuralPartialEq for BB<T>
Auto Trait Implementations§
impl<T> Freeze for BB<T>where
T: Freeze,
impl<T> RefUnwindSafe for BB<T>where
T: RefUnwindSafe,
impl<T> Send for BB<T>where
T: Send,
impl<T> Sync for BB<T>where
T: Sync,
impl<T> Unpin for BB<T>where
T: Unpin,
impl<T> UnwindSafe for BB<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.