pub struct Union<Lhs, Rhs, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize>{ /* private fields */ }Expand description
Hard union of two SDFs.
See crate::combinators::SdfCombinationOperations for more information on how to use this.
Implementations§
Trait Implementations§
Source§impl<Lhs, Rhs, Scalar: Clone + Float, State: Clone + SdfState<Scalar, DIM>, const DIM: usize> Clone for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Clone + Float, State: Clone + SdfState<Scalar, DIM>, const DIM: usize> Clone for Union<Lhs, Rhs, Scalar, State, DIM>
Source§impl<Lhs, Rhs, Scalar: Debug + Float, State: Debug + SdfState<Scalar, DIM>, const DIM: usize> Debug for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Debug + Float, State: Debug + SdfState<Scalar, DIM>, const DIM: usize> Debug for Union<Lhs, Rhs, Scalar, State, DIM>
Source§impl<Lhs, Rhs, Scalar: Default + Float, State: Default + SdfState<Scalar, DIM>, const DIM: usize> Default for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Default + Float, State: Default + SdfState<Scalar, DIM>, const DIM: usize> Default for Union<Lhs, Rhs, Scalar, State, DIM>
Source§impl<Lhs, Rhs, Scalar: Hash + Float, State: Hash + SdfState<Scalar, DIM>, const DIM: usize> Hash for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Hash + Float, State: Hash + SdfState<Scalar, DIM>, const DIM: usize> Hash for Union<Lhs, Rhs, Scalar, State, DIM>
Source§impl<Lhs, Rhs, Scalar: PartialEq + Float, State: PartialEq + SdfState<Scalar, DIM>, const DIM: usize> PartialEq for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: PartialEq + Float, State: PartialEq + SdfState<Scalar, DIM>, const DIM: usize> PartialEq for Union<Lhs, Rhs, Scalar, State, DIM>
Source§impl<Lhs, Rhs, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> Sdf<Scalar, DIM> for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> Sdf<Scalar, DIM> for Union<Lhs, Rhs, Scalar, State, DIM>
Source§fn distance(&self, position: [Scalar; DIM]) -> Scalar
fn distance(&self, position: [Scalar; DIM]) -> Scalar
Evaluates the SDF at some point
Source§fn state(&self, position: [Scalar; DIM]) -> Self::State
fn state(&self, position: [Scalar; DIM]) -> Self::State
Evaluates the state of the SDF at some point. See
SdfState for more information.Source§fn distance_and_state(&self, position: [Scalar; DIM]) -> (Scalar, Self::State)
fn distance_and_state(&self, position: [Scalar; DIM]) -> (Scalar, Self::State)
Evaluates both the distance and the state of the SDF, hopefully a little bit
faster than if you called both
Sdf::distance and Sdf::state separately.Source§fn gradient(&self, position: [Scalar; DIM], epsilon: Scalar) -> [Scalar; DIM]
fn gradient(&self, position: [Scalar; DIM], epsilon: Scalar) -> [Scalar; DIM]
Calculates the gradient of the SDF at some point in space. Some SDF have analytical
expressions of the gradient, some don’t. If a SDF doesn’t have an implementation, it
will instead approximate it using epsilon. Read more
Source§fn state_sample(
&self,
position: [Scalar; DIM],
) -> <Self::State as SdfState<Scalar, DIM>>::Sample
fn state_sample( &self, position: [Scalar; DIM], ) -> <Self::State as SdfState<Scalar, DIM>>::Sample
Evaluates, then samples the state of the SDF at some point. See
SdfState
for more information.Source§fn distance_and_state_sample(
&self,
position: [Scalar; DIM],
) -> (Scalar, <Self::State as SdfState<Scalar, DIM>>::Sample)
fn distance_and_state_sample( &self, position: [Scalar; DIM], ) -> (Scalar, <Self::State as SdfState<Scalar, DIM>>::Sample)
Evaluates both the distance and the sample of the state of the SDF, hopefully a little
bit faster than if you called both
Sdf::distance and Sdf::state_sample separately.Source§fn normal(&self, position: [Scalar; DIM], epsilon: Scalar) -> [Scalar; DIM]
fn normal(&self, position: [Scalar; DIM], epsilon: Scalar) -> [Scalar; DIM]
Calculates the gradient, then normalizes it. The gradient typically is already normalized
if the SDF is well formed and if we aren’t on some edge case, but we never know. Smooth
combinations and the empty SDF are good counter examples.
Source§fn normal_or_zero(
&self,
position: [Scalar; DIM],
epsilon: Scalar,
) -> [Scalar; DIM]
fn normal_or_zero( &self, position: [Scalar; DIM], epsilon: Scalar, ) -> [Scalar; DIM]
Calculates the gradient, then normalizes it. If the norm is 0, then [0; DIM] is returned.
The gradient typically is already normalized, but sometimes this isn’t the case, for example
with the empty SDF.
Source§fn gradient_approx(
&self,
position: [Scalar; DIM],
epsilon: Scalar,
) -> [Scalar; DIM]
fn gradient_approx( &self, position: [Scalar; DIM], epsilon: Scalar, ) -> [Scalar; DIM]
Calculates the gradient of the SDF at some point in space. It will approximate it using
epsilon.
Source§fn normal_approx(
&self,
position: [Scalar; DIM],
epsilon: Scalar,
) -> [Scalar; DIM]
fn normal_approx( &self, position: [Scalar; DIM], epsilon: Scalar, ) -> [Scalar; DIM]
Calculates the normal of the SDF at some point in space. It will approximate the
gradient using epsilon.
Source§fn normal_or_zero_approx(
&self,
position: [Scalar; DIM],
epsilon: Scalar,
) -> [Scalar; DIM]
fn normal_or_zero_approx( &self, position: [Scalar; DIM], epsilon: Scalar, ) -> [Scalar; DIM]
Calculates the normal of the SDF at some point in space, and if the norm is 0, it will
simply return [0; DIM]. It will approximate the gradient using epsilon.
impl<Lhs, Rhs, Scalar: Copy + Float, State: Copy + SdfState<Scalar, DIM>, const DIM: usize> Copy for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Eq + Float, State: Eq + SdfState<Scalar, DIM>, const DIM: usize> Eq for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> StructuralPartialEq for Union<Lhs, Rhs, Scalar, State, DIM>
Auto Trait Implementations§
impl<Lhs, Rhs, Scalar, State, const DIM: usize> Freeze for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar, State, const DIM: usize> RefUnwindSafe for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar, State, const DIM: usize> Send for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar, State, const DIM: usize> Sync for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar, State, const DIM: usize> Unpin for Union<Lhs, Rhs, Scalar, State, DIM>
impl<Lhs, Rhs, Scalar, State, const DIM: usize> UnwindSafe for Union<Lhs, Rhs, Scalar, State, DIM>
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