Struct veloren_voxygen_anim::vek::Rect3
source · pub struct Rect3<P, E> {
pub x: P,
pub y: P,
pub z: P,
pub w: E,
pub h: E,
pub d: E,
}
Expand description
A Rect
extended to 3D.
This would have been named Box
, but it was “taken” by the standard library already.
You should probably use Aabb
because it is less confusing.
See also Rect
for a short discussion on the topic.
Fields§
§x: P
X position of the bottom-left-near corner.
y: P
Y position of the bottom-left-near corner.
z: P
Z position of the bottom-left-near corner.
w: E
Width.
h: E
Height, with Y axis going upwards.
d: E
Depth, with Z axis going forwards.
Implementations§
source§impl<P, E> Rect3<P, E>
impl<P, E> Rect3<P, E>
sourcepub fn new(x: P, y: P, z: P, w: E, h: E, d: E) -> Rect3<P, E>
pub fn new(x: P, y: P, z: P, w: E, h: E, d: E) -> Rect3<P, E>
Creates a new rectangle from position elements and extent elements.
sourcepub fn set_position(&mut self, p: Vec3<P>)
pub fn set_position(&mut self, p: Vec3<P>)
Sets this rectangle’s position.
sourcepub fn set_extent(&mut self, e: Extent3<E>)
pub fn set_extent(&mut self, e: Extent3<E>)
Sets this rectangle’s extent (size).
sourcepub fn position_extent(self) -> (Vec3<P>, Extent3<E>)
pub fn position_extent(self) -> (Vec3<P>, Extent3<E>)
Gets this rectangle’s position and extent (size).
sourcepub fn map<DP, DE, PF, EF>(self, pf: PF, ef: EF) -> Rect3<DP, DE>
pub fn map<DP, DE, PF, EF>(self, pf: PF, ef: EF) -> Rect3<DP, DE>
Returns this rectangle, converted with the given closures (one for position elements, the other for extent elements).
source§impl<T> Rect3<T, T>
impl<T> Rect3<T, T>
sourcepub fn into_aabb(self) -> Aabb<T>
pub fn into_aabb(self) -> Aabb<T>
Converts this into the matching axis-aligned bounding shape representation.
sourcepub fn contains_point(self, p: Vec3<T>) -> boolwhere
T: PartialOrd,
pub fn contains_point(self, p: Vec3<T>) -> boolwhere
T: PartialOrd,
Does this rectangle contain the given point ?
sourcepub fn contains_rect3(self, other: Rect3<T, T>) -> boolwhere
T: PartialOrd,
pub fn contains_rect3(self, other: Rect3<T, T>) -> boolwhere
T: PartialOrd,
Does this rectangle fully contain the given one ?
sourcepub fn collides_with_rect3(self, other: Rect3<T, T>) -> boolwhere
T: PartialOrd,
pub fn collides_with_rect3(self, other: Rect3<T, T>) -> boolwhere
T: PartialOrd,
Does this rectangle collide with another ?
source§impl<T> Rect3<T, T>
impl<T> Rect3<T, T>
sourcepub fn expanded_to_contain_point(self, p: Vec3<T>) -> Rect3<T, T>where
T: PartialOrd,
pub fn expanded_to_contain_point(self, p: Vec3<T>) -> Rect3<T, T>where
T: PartialOrd,
Returns this shape so that it contains the given point.
sourcepub fn expand_to_contain_point(&mut self, p: Vec3<T>)where
T: PartialOrd,
pub fn expand_to_contain_point(&mut self, p: Vec3<T>)where
T: PartialOrd,
Expands this shape so that it contains the given point.
sourcepub fn union(self, other: Rect3<T, T>) -> Rect3<T, T>
pub fn union(self, other: Rect3<T, T>) -> Rect3<T, T>
Gets the smallest rectangle that contains both this one and another.
sourcepub fn intersection(self, other: Rect3<T, T>) -> Rect3<T, T>
pub fn intersection(self, other: Rect3<T, T>) -> Rect3<T, T>
Gets the largest rectangle contained by both this one and another.
sourcepub fn expand_to_contain(&mut self, other: Rect3<T, T>)
pub fn expand_to_contain(&mut self, other: Rect3<T, T>)
Sets this rectangle to the union of itself with another.
sourcepub fn intersect(&mut self, other: Rect3<T, T>)
pub fn intersect(&mut self, other: Rect3<T, T>)
Sets this rectangle to the intersection of itself with another.
sourcepub fn collision_vector_with_rect3(self, other: Rect3<T, T>) -> Vec3<T>
pub fn collision_vector_with_rect3(self, other: Rect3<T, T>) -> Vec3<T>
Gets a vector that tells how much self
penetrates other
.
sourcepub fn split_at_x(self, sp: T) -> [Rect3<T, T>; 2]
pub fn split_at_x(self, sp: T) -> [Rect3<T, T>; 2]
Splits this shape in two, by a straight plane along the
x
axis.
The returned tuple is (low, high)
.
§Panics
sp
is assumed to be a position along the
x
axis that is within this shape’s bounds.
sourcepub fn split_at_y(self, sp: T) -> [Rect3<T, T>; 2]
pub fn split_at_y(self, sp: T) -> [Rect3<T, T>; 2]
Splits this shape in two, by a straight plane along the
y
axis.
The returned tuple is (low, high)
.
§Panics
sp
is assumed to be a position along the
y
axis that is within this shape’s bounds.
sourcepub fn split_at_z(self, sp: T) -> [Rect3<T, T>; 2]
pub fn split_at_z(self, sp: T) -> [Rect3<T, T>; 2]
Splits this shape in two, by a straight plane along the
z
axis.
The returned tuple is (low, high)
.
§Panics
sp
is assumed to be a position along the
z
axis that is within this shape’s bounds.
Trait Implementations§
source§impl<'de, P, E> Deserialize<'de> for Rect3<P, E>where
P: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, P, E> Deserialize<'de> for Rect3<P, E>where
P: Deserialize<'de>,
E: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rect3<P, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Rect3<P, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<P, E> PartialEq for Rect3<P, E>
impl<P, E> PartialEq for Rect3<P, E>
source§impl<P, E> Serialize for Rect3<P, E>
impl<P, E> Serialize for Rect3<P, E>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<P, E> Copy for Rect3<P, E>
impl<P, E> Eq for Rect3<P, E>
impl<P, E> StructuralPartialEq for Rect3<P, E>
Auto Trait Implementations§
impl<P, E> Freeze for Rect3<P, E>
impl<P, E> RefUnwindSafe for Rect3<P, E>where
P: RefUnwindSafe,
E: RefUnwindSafe,
impl<P, E> Send for Rect3<P, E>
impl<P, E> Sync for Rect3<P, E>
impl<P, E> Unpin for Rect3<P, E>
impl<P, E> UnwindSafe for Rect3<P, E>where
P: UnwindSafe,
E: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<C, M> ConvertSaveload<M> for C
impl<C, M> ConvertSaveload<M> for C
§type Error = Infallible
type Error = Infallible
§fn convert_into<F>(
&self,
_: F,
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
fn convert_into<F>( &self, _: F, ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F,
) -> Result<C, <C as ConvertSaveload<M>>::Error>
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F, ) -> Result<C, <C as ConvertSaveload<M>>::Error>
Data
) using
entity to marker mapping function§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§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>
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>
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>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default
and panics on an error case.