IntersectionContainer

Struct IntersectionContainer 

Source
pub struct IntersectionContainer<T, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,
{ /* private fields */ }
Expand description

Hard intersection of N SDFs stored in some container, like a Vec for example.

See SdfContainerCombinationOperators for more information on how to use this.

Trait Implementations§

Source§

impl<T: Clone, Scalar: Clone + Float, State: Clone + SdfState<Scalar, DIM>, const DIM: usize> Clone for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn clone(&self) -> IntersectionContainer<T, Scalar, State, DIM>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, Scalar: Debug + Float, State: Debug + SdfState<Scalar, DIM>, const DIM: usize> Debug for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default, Scalar: Default + Float, State: Default + SdfState<Scalar, DIM>, const DIM: usize> Default for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn default() -> IntersectionContainer<T, Scalar, State, DIM>

Returns the “default value” for a type. Read more
Source§

impl<T, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> From<T> for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash, Scalar: Hash + Float, State: Hash + SdfState<Scalar, DIM>, const DIM: usize> Hash for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq, Scalar: PartialEq + Float, State: PartialEq + SdfState<Scalar, DIM>, const DIM: usize> PartialEq for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

fn eq(&self, other: &IntersectionContainer<T, Scalar, State, DIM>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> Sdf<Scalar, DIM> for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

type State = State

The state that is bound to this SDF. See SdfState for more information.
Source§

fn distance(&self, position: [Scalar; DIM]) -> Scalar

Evaluates the SDF at some point
Source§

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)

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]

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

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)

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]

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]

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]

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]

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]

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.
Source§

impl<T: Copy, Scalar: Copy + Float, State: Copy + SdfState<Scalar, DIM>, const DIM: usize> Copy for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

impl<T: Eq, Scalar: Eq + Float, State: Eq + SdfState<Scalar, DIM>, const DIM: usize> Eq for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Source§

impl<T, Scalar: Float, State: SdfState<Scalar, DIM>, const DIM: usize> StructuralPartialEq for IntersectionContainer<T, Scalar, State, DIM>
where for<'a> &'a T: IntoIterator, for<'a> <&'a T as IntoIterator>::Item: Sdf<Scalar, DIM, State = State>,

Auto Trait Implementations§

§

impl<T, Scalar, State, const DIM: usize> Freeze for IntersectionContainer<T, Scalar, State, DIM>
where T: Freeze,

§

impl<T, Scalar, State, const DIM: usize> RefUnwindSafe for IntersectionContainer<T, Scalar, State, DIM>
where T: RefUnwindSafe, Scalar: RefUnwindSafe, State: RefUnwindSafe,

§

impl<T, Scalar, State, const DIM: usize> Send for IntersectionContainer<T, Scalar, State, DIM>
where T: Send, Scalar: Send, State: Send,

§

impl<T, Scalar, State, const DIM: usize> Sync for IntersectionContainer<T, Scalar, State, DIM>
where T: Sync, Scalar: Sync, State: Sync,

§

impl<T, Scalar, State, const DIM: usize> Unpin for IntersectionContainer<T, Scalar, State, DIM>
where T: Unpin, Scalar: Unpin, State: Unpin,

§

impl<T, Scalar, State, const DIM: usize> UnwindSafe for IntersectionContainer<T, Scalar, State, DIM>
where T: UnwindSafe, Scalar: UnwindSafe, State: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, Scalar, const DIM: usize> SdfBindTrait<Scalar, DIM> for T
where Scalar: Float, T: Sdf<Scalar, DIM>,

Source§

fn bind<State: SdfState<Scalar, DIM>>( self, state: State, ) -> Bound<Self, Scalar, State, DIM>

Source§

impl<T, Scalar, State, const DIM: usize> SdfCombinationOperations<Scalar, State, DIM> for T
where Scalar: Float + 'static, State: SdfState<Scalar, DIM>, T: Sdf<Scalar, DIM, State = State>,

Source§

fn add<Rhs>(self, rhs: Rhs) -> Union<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn mul<Rhs>(self, rhs: Rhs) -> Intersection<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn sub<Rhs>(self, rhs: Rhs) -> Difference<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn add_smooth_sigmoid<Rhs>( self, rhs: Rhs, factor: Scalar, ) -> SUnionSigmoid<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn add_smooth_exp<Rhs>( self, rhs: Rhs, factor: Scalar, ) -> SUnionExponential<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn mul_smooth_exp<Rhs>( self, rhs: Rhs, factor: Scalar, ) -> SIntersectionExponential<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

fn sub_smooth_exp<Rhs>( self, rhs: Rhs, factor: Scalar, ) -> SDifferenceExponential<Self, Rhs, Scalar, State, DIM>
where Rhs: Sdf<Scalar, DIM, State = State>,

Source§

impl<State, S> SdfRotationOperations<State> for S
where State: SdfState<f32, 3>, S: Sdf<f32, 3, State = State>,

Source§

fn rotate(self, rotation: Quat) -> Rotated<State, Self>

Source§

impl<Scalar, State, const DIM: usize, S> SdfTransformOperations<Scalar, State, DIM> for S
where Scalar: Float + 'static, State: SdfState<Scalar, DIM>, S: Sdf<Scalar, DIM, State = State>,

Source§

fn translate( self, translation: impl Into<[Scalar; DIM]>, ) -> Translated<Scalar, State, Self, DIM>

Source§

fn scale(self, scale: Scalar) -> Scaled<Scalar, State, Self, DIM>

Source§

fn invert(self) -> Inverted<Scalar, State, Self, DIM>

Source§

fn iso(self, iso: Scalar) -> IsoSurface<Scalar, State, Self, DIM>

Source§

fn thicken(self, thickness: Scalar) -> Thicken<Scalar, State, Self, DIM>

Source§

fn approx(self, radius: Scalar) -> Approximated<Scalar, State, Self, DIM>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.