pub struct RawDistancePixel(/* private fields */);Expand description
A raw pixel in a 2D image
This is either a single distance value or a description of a fill; both
cases are packed into an f32 (using NaN-boxing in the latter case).
The NaN-boxing is transparent to the user; for the curious, it is
implemented by splitting the mantissa into three components:
- Bit 0 indicates the sign of the fill (1 for inside, 0 for outside)
- Bits 1-9 indicate the depth at which evaluation terminated, which is useful for certain debug visualizations
- Bits 10-17 are a fixed bit pattern, which both ensures that the value is
treated as
NaNin the[empty, depth 0]case (rather than infinity) and distinguishes fromNaNvalues generated during normal evaluation
Implementations§
Source§impl RawDistancePixel
impl RawDistancePixel
Sourcepub fn inside(self) -> bool
pub fn inside(self) -> bool
Checks whether the pixel is inside or outside the model
Distances of exactly 0.0 and non-boxed NaN values are treated as
outside (i.e. returning false).
Sourcepub fn is_distance(self) -> bool
pub fn is_distance(self) -> bool
Checks whether this is a distance point sample
Sourcepub fn unpack(self) -> DistancePixel
pub fn unpack(self) -> DistancePixel
Unpacks into a DistancePixel
Trait Implementations§
Source§impl Clone for RawDistancePixel
impl Clone for RawDistancePixel
Source§fn clone(&self) -> RawDistancePixel
fn clone(&self) -> RawDistancePixel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RawDistancePixel
Source§impl Debug for RawDistancePixel
impl Debug for RawDistancePixel
Source§impl Default for RawDistancePixel
impl Default for RawDistancePixel
Source§fn default() -> RawDistancePixel
fn default() -> RawDistancePixel
Returns the “default value” for a type. Read more
Source§impl From<DistancePixel> for RawDistancePixel
impl From<DistancePixel> for RawDistancePixel
Source§fn from(p: DistancePixel) -> Self
fn from(p: DistancePixel) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RawDistancePixel
impl RefUnwindSafe for RawDistancePixel
impl Send for RawDistancePixel
impl Sync for RawDistancePixel
impl Unpin for RawDistancePixel
impl UnsafeUnpin for RawDistancePixel
impl UnwindSafe for RawDistancePixel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.