sdfu::ops

Struct Subtraction

Source
pub struct Subtraction<S1, S2> {
    pub sdf1: S1,
    pub sdf2: S2,
}
Expand description

Get the subtracion of two SDFs. Note that this operation is not commutative, i.e. Subtraction::new(a, b) =/= Subtraction::new(b, a).

Fields§

§sdf1: S1§sdf2: S2

Implementations§

Source§

impl<S1, S2> Subtraction<S1, S2>

Source

pub fn new(sdf1: S1, sdf2: S2) -> Self

Get the subtracion of two SDFs. Note that this operation is not commutative, i.e. Subtraction::new(a, b) =/= Subtraction::new(b, a).

Trait Implementations§

Source§

impl<S1: Clone, S2: Clone> Clone for Subtraction<S1, S2>

Source§

fn clone(&self) -> Subtraction<S1, S2>

Returns a copy 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<S1: Debug, S2: Debug> Debug for Subtraction<S1, S2>

Source§

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

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

impl<T, V, S1, S2> SDF<T, V> for Subtraction<S1, S2>
where T: Copy + Neg<Output = T> + MaxMin, V: Vec<T>, S1: SDF<T, V>, S2: SDF<T, V>,

Source§

fn dist(&self, p: V) -> T

Get distance from p to this SDF.
Source§

fn normals(self, eps: T) -> EstimateNormalDefault<T, V, Self>

Estimate the normals of this SDF using the default NormalEstimator. Read more
Source§

fn normals_fast(self, eps: T) -> EstimateNormalFast<T, V, Self>

Estimate the normals of this SDF using a fast, TetrahedralEstimator. Only works for 3d SDFs. Read more
Source§

fn normals_with<E: NormalEstimator<T, V>>( self, estimator: E, ) -> EstimateNormal<T, V, Self, E>

Estimate the normals of this SDF using a provided NormalEstimator.
Source§

fn union<O: SDF<T, V>>(self, other: O) -> Union<T, Self, O, HardMin<T>>

Get the union of this SDF and another one()using a standard hard minimum, creating a sharp crease at the boundary between the two fields.
Source§

fn union_smooth<O: SDF<T, V>>( self, other: O, softness: T, ) -> Union<T, Self, O, PolySmoothMin<T>>

Get the union of this SDF and another one, blended together with a smooth minimum function. This uses a polynomial smooth min function by default, and the smoothing factor is controlled by the smoothness parameter. For even more control, see union_with.
Source§

fn union_with<O: SDF<T, V>, M: MinFunction<T>>( self, other: O, min_function: M, ) -> Union<T, Self, O, M>

Get the union of this SDF and another one()using a provided minimum function. See the documentation of MinFunction for more.
Source§

fn subtract<O: SDF<T, V>>(self, other: O) -> Subtraction<O, Self>

Get the subtracion of another SDF from this one. Note that this operation is not commutative, i.e. a.subtraction(b) =/= b.subtraction(a).
Source§

fn intersection<O: SDF<T, V>>(self, other: O) -> Intersection<Self, O>

Get the intersection of this SDF and another one.
Source§

fn round(self, radius: T) -> Round<T, Self>

Round the corners of this SDF with a radius.
Source§

fn elongate( self, axis: Axis, elongation: T, ) -> Elongate<T, Self, <V as Vec<T>>::Dimension>
where Elongate<T, Self, <V as Vec<T>>::Dimension>: SDF<T, V>,

Elongate this SDF along one()axis. The elongation is symmetrical about the origin.
Source§

fn elongate_multi_axis( self, elongation: V, ) -> ElongateMulti<V, Self, <V as Vec<T>>::Dimension>
where ElongateMulti<V, Self, <V as Vec<T>>::Dimension>: SDF<T, V>,

Elongate this SDF along one()axis. The elongation is symmetrical about the origin.
Source§

fn translate(self, translation: V) -> Translate<V, Self>

Translate the SDF by a vector.
Source§

fn rotate<R: Rotation<V>>(self, rotation: R) -> Rotate<R, Self>

Rotate the SDF by a rotation.
Source§

fn scale(self, scaling: T) -> Scale<T, Self>

Scale the SDF by a uniform scaling factor.
Source§

impl<S1: Copy, S2: Copy> Copy for Subtraction<S1, S2>

Auto Trait Implementations§

§

impl<S1, S2> Freeze for Subtraction<S1, S2>
where S1: Freeze, S2: Freeze,

§

impl<S1, S2> RefUnwindSafe for Subtraction<S1, S2>

§

impl<S1, S2> Send for Subtraction<S1, S2>
where S1: Send, S2: Send,

§

impl<S1, S2> Sync for Subtraction<S1, S2>
where S1: Sync, S2: Sync,

§

impl<S1, S2> Unpin for Subtraction<S1, S2>
where S1: Unpin, S2: Unpin,

§

impl<S1, S2> UnwindSafe for Subtraction<S1, S2>
where S1: UnwindSafe, S2: 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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.