pub struct BB {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}Fields§
§x: u32§y: u32§w: u32§h: u32Implementations§
source§impl BB
impl BB
pub fn from_vec(points: &[PtI]) -> RvResult<Self>
pub fn distance_to_boundary(&self, pos: PtF) -> f32
pub fn split_horizontally(&self, y: u32) -> (Self, Self)
pub fn split_vertically(&self, x: u32) -> (Self, Self)
pub fn from_shape(shape: Shape) -> Self
pub fn y_max(&self) -> u32
pub fn x_max(&self) -> u32
pub fn intersect(self, other: BB) -> BB
pub fn intersect_or_self(&self, other: Option<BB>) -> BB
sourcepub fn max_squaredist<'a>(
&'a self,
other: impl Iterator<Item = PtI> + 'a + Clone
) -> (PtI, PtI, i64)
pub fn max_squaredist<'a>( &'a self, other: impl Iterator<Item = PtI> + 'a + Clone ) -> (PtI, PtI, i64)
Return points of greatest distance between self and other
pub fn min_max(&self, axis: usize) -> (u32, u32)
sourcepub fn points_iter<'a>(&'a self) -> impl Iterator<Item = PtI> + 'a + Clone
pub fn points_iter<'a>(&'a self) -> impl Iterator<Item = PtI> + 'a + Clone
Iteration order of corners 0 3 v ʌ 1 > 2
pub fn corner(&self, idx: usize) -> PtI
pub fn opposite_corner(&self, idx: usize) -> PtI
pub fn shape(&self) -> Shape
pub fn from_points(p1: PtI, p2: PtI) -> Self
pub fn x_range(&self) -> Range<u32>
pub fn y_range(&self) -> Range<u32>
pub fn center_f(&self) -> (f32, f32)
pub fn center(&self) -> PtI
pub fn min_usize(&self) -> (usize, usize)
pub fn max_usize(&self) -> (usize, usize)
pub fn min(&self) -> PtI
pub fn max(&self) -> PtI
pub fn follow_movement( &self, from: PtF, to: PtF, shape: Shape, oob_mode: OutOfBoundsMode ) -> Option<Self>
pub fn covers_y(&self, y: f32) -> bool
pub fn covers_x(&self, x: f32) -> bool
pub fn contains<P>(&self, p: P) -> boolwhere P: Into<PtF>,
pub fn contains_bb(&self, other: BB) -> bool
pub fn is_contained_in_image(&self, shape: Shape) -> bool
pub fn new_shape_checked( x: i32, y: i32, w: i32, h: i32, orig_im_shape: Shape, mode: OutOfBoundsMode ) -> Option<Self>
pub fn translate( self, x_shift: i32, y_shift: i32, shape: Shape, oob_mode: OutOfBoundsMode ) -> Option<Self>
pub fn new_fit_to_image(x: i32, y: i32, w: i32, h: i32, shape: Shape) -> BB
pub fn center_scale(&self, factor: f32, shape: Shape) -> Self
pub fn shift_max( &self, x_shift: i32, y_shift: i32, shape: Shape ) -> Option<Self>
pub fn shift_min( &self, x_shift: i32, y_shift: i32, shape: Shape ) -> Option<Self>
pub fn has_overlap(&self, other: &BB) -> bool
Trait Implementations§
source§impl<'de> Deserialize<'de> for BB
impl<'de> Deserialize<'de> for BB
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 Copy for BB
impl Eq for BB
impl StructuralEq for BB
impl StructuralPartialEq for BB
Auto Trait Implementations§
impl RefUnwindSafe for BB
impl Send for BB
impl Sync for BB
impl Unpin for BB
impl UnwindSafe for BB
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst>,
Approximate the subject with the default scheme.
source§fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject with a specific scheme.
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
source§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere Self: Sized + Into<Dst>,
Convert the subject to a given type.
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
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().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.