ADF

Struct ADF 

Source
pub struct ADF<Float> {
    pub tree: Quadtree<Vec<Arc<dyn Fn(P2<Float>) -> Float>>, Float>,
    /* private fields */
}

Fields§

§tree: Quadtree<Vec<Arc<dyn Fn(P2<Float>) -> Float>>, Float>

Implementations§

Source§

impl<_Float: Float + Signed + Sync> ADF<_Float>

Source

pub fn new(max_depth: u8, init: Vec<Arc<dyn Fn(P2<_Float>) -> _Float>>) -> Self

Create a new ADF instance. max_depth specifies maximum number of quadtree subdivisions; init specifies initial sdf primitives.

Source

pub fn with_gd_lattice_density(self, density: u32) -> Self

Controls precision of primitive pruning in a bucket.

Source

pub fn with_ipm_line_config(self, line_config: LineSearch<_Float>) -> Self

Underlying GD settings for the interior point method (a part of primitive pruning).

Source

pub fn insert_sdf_domain( &mut self, domain: Rect<_Float, WorldSpace>, f: Arc<dyn Fn(P2<_Float>) -> _Float + Send + Sync>, ) -> bool

Add a new sdf primitive function.

Source

pub unsafe fn as_mut(&self) -> &mut Self

§Safety

Nobody is safe

Source§

impl<_Float: Float + Signed + AsPrimitive<f64>> ADF<_Float>

Source

pub fn display_sdf(&self, image: &mut RgbaImage, brightness: f64) -> &Self

Available on crate feature drawing only.
Source

pub fn draw_bucket_weights(&self, image: &mut RgbaImage) -> &Self

Available on crate feature drawing only.

Trait Implementations§

Source§

impl<_Float: Float> BoundingBox<_Float> for ADF<_Float>

Source§

fn bounding_box(&self) -> Box2D<_Float, WorldSpace>

Source§

impl<Float: Clone> Clone for ADF<Float>

Source§

fn clone(&self) -> ADF<Float>

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<_Float: Float> Debug for ADF<_Float>

Source§

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

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

impl<_Float: Float> SDF<_Float> for ADF<_Float>

Source§

fn sdf(&self, pixel: P2<_Float>) -> _Float

Source§

impl<Float> Send for ADF<Float>

Source§

impl<Float> Sync for ADF<Float>

Auto Trait Implementations§

§

impl<Float> Freeze for ADF<Float>
where Float: Freeze,

§

impl<Float> !RefUnwindSafe for ADF<Float>

§

impl<Float> Unpin for ADF<Float>
where Float: Unpin,

§

impl<Float> !UnwindSafe for ADF<Float>

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, Sh> Shape<T> for Sh
where Sh: SDF<T> + BoundingBox<T>,

Source§

fn translate(self, offset: V2<T, WorldSpace>) -> Translation<Self, T>
where Self: Sized,

Source§

fn rotate(self, angle: Angle<T>) -> Rotation<Self, T>
where Self: Sized,

Rotate around the center of shape’s bounding box
Source§

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

Scale around the center of shape’s bounding box
Source§

fn union<U>(self, other: U) -> Union<Self, U>
where Self: Sized,

Union of two SDFs.
Source§

fn subtraction<U>(self, other: U) -> Subtraction<Self, U>
where Self: Sized,

Subtracion of two SDFs. Note that this operation is not commutative, i.e. Subtraction {a, b} =/= Subtraction {b, a}.
Source§

fn intersection<U>(self, other: U) -> Intersection<Self, U>
where Self: Sized,

Intersection of two SDFs.
Source§

fn smooth_min<U>(self, other: U, k: T) -> SmoothMin<T, Self, U>
where Self: Sized,

Takes the minimum of two SDFs, smoothing between them when they are close. Read more
Source§

fn texture<Tex>(self, texture: Tex) -> Texture<Self, Tex>
where Self: Sized,

Available on crate feature drawing only.
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.