Skip to main content

Grid

Struct Grid 

Source
pub struct Grid<const D: usize, A: Arch = StaticArch> { /* private fields */ }
Expand description

An interface struct for creating grid noise.

§Type Parameters

  • D: NoiseDimension - Determines how many dimensions the grid has.

§Example

use quick_noise::Grid;

// Subject to change.
let grid = Grid::<2>::new(32, 32)
    .grid_position(0.0, 0.0)
    .seed(1);

Implementations§

Source§

impl<const D: usize, A: Arch> Grid<D, A>

Source

pub fn seed(self, seed: i64) -> Self

Determines the psuedo-random values used in noise generation called on this grid. Different seeds produce different noise.

Source§

impl<A: Arch> Grid<2, A>

Source

pub fn new(x: usize, y: usize) -> Self

Creates an anchor for a grid region that can be used for call noise.

§Parameters

-x: Length of the grid region along the x-axis -y: Length of the grid region along the y-axis

Source

pub fn grid_position(self, x: f64, y: f64) -> Self

Determines the position values provided to noise calls. This value represents the position of this grid region in grid units determined by its grid_size. A 32x32 grid at position { 1, 2 } covers samples in the range { 32..64, 64..96 }.

§Default:

0.0: x 0.0: y

Source

pub fn sample_position(self, x: f64, y: f64) -> Self

Determines the position values provided to noise calls. This value represents the position of first sample in each dimension. A 32x32 given the sample position { 32, 16 } covers samples in the range { 32..64, 16..48 }.

§Default:

0.0: x 0.0: y

Source

pub fn tiling(self, x: Option<u32>, y: Option<u32>) -> Self

Determines the distance the sample space has until it starts repeating noise seamlessly. When values are left as None, noise does not repeat.

§Default:
  • x: None
  • y: None
Source§

impl<A: Arch> Grid<3, A>

Source

pub fn new(x: usize, y: usize, z: usize) -> Self

Creates an anchor for a grid region that can be used for call noise.

§Parameters

-x: Length of the grid region along the x-axis -y: Length of the grid region along the y-axis -z: Length of the grid region along the z-axis

Source

pub fn grid_position(self, x: f64, y: f64, z: f64) -> Self

Determines the position values provided to noise calls. This value represents the position of this grid region in grid units determined by its grid_size. A 32x32x32 grid at position { 1, 2, 3 } covers samples in the range { 32..64, 64..96, 96..128 }.

§Default:

0.0: x 0.0: y 0.0: z

Source

pub fn sample_position(self, x: f64, y: f64, z: f64) -> Self

Determines the position values provided to noise calls. This value represents the position of first sample in each dimension. A 32x32x32 given the sample position { 32, 16, 0 } covers samples in the range { 32..64, 16..48, 0..32 }.

§Default:

0.0: x 0.0: y 0.0: z

Source

pub fn tiling(self, x: Option<u32>, y: Option<u32>, z: Option<u32>) -> Self

Determines the distance the sample space has until it starts repeating noise seamlessly. When values are left as None, noise does not repeat.

§Default:
  • x: None
  • y: None
  • z: None
Source§

impl<const D: usize, A: Arch> Grid<D, A>

Source

pub fn from_config(config: GridConfig<D>) -> Self

Loads a config a config to create a grid.

Source

pub fn builder<C: Combiner, G: GridGenerator<D>>( &self, ) -> GridNoiseBuilder<D, C, G, A>

Creates a new builder to easily configure a grid region of noise.

§Type Parameters
  • C: The algorithm to combine separate noise passes (octaves) together.
  • G: The algorithm to sample noise with.
Source

pub fn builder_with_octaves<'a, C: Combiner, G: GridGenerator<D>>( &self, octave_list: &'a [Octave<D>], ) -> OctaveGridNoiseBuilder<'a, D, C, G, A>

Creates a new builder using a custom octave list to configure a grid region of noise.

§Type Parameters
  • C: The algorithm to combine separate noise passes (octaves) together.
  • G: The algorithm to sample noise with.
Source§

impl<A: Arch> Grid<2, A>

Source

pub fn x_iter(&self) -> RowIter<A> ⓘ

Creates a simd iterator of the x values when iterating through the grid sample by sample.

Source

pub fn y_iter(&self) -> SliceIter<A> ⓘ

Creates a simd iterator of the y values when iterating through the grid sample by sample.

Source§

impl<A: Arch> Grid<3, A>

Source

pub fn x_iter(&self) -> RowIter<A> ⓘ

Creates a simd iterator of the x values when iterating through the grid sample by sample.

Source

pub fn y_iter(&self) -> SliceIter<A> ⓘ

Creates a simd iterator of the y values when iterating through the grid sample by sample.

Source

pub fn z_iter(&self) -> SliceIter<A> ⓘ

Creates a simd iterator of the z values when iterating through the grid sample by sample.

Source§

impl<A: Arch> Grid<2, A>

Creates a builder struct for warping noise.

§Type Parameters

  • C: The combiner algorithm to use across octaves.
  • G: The generator algorithm to sample from.

§Parameters

  • warp_strength: How strongly the warp is applied.
  • x_iter: An iterator of warp values to distort each sample’s x input.
  • y_iter: An iterator of warp values to distort each sample’s y input.
Source

pub fn warp_builder<C: Combiner, G: BatchGenerator<2>>( &self, warp_strength: f32, x_iter: impl Iterator<Item = Simd<f32, A>>, y_iter: impl Iterator<Item = Simd<f32, A>>, ) -> BatchNoiseBuilder<2, C, G, A, impl DimIter<A, 2>>

Source§

impl<A: Arch> Grid<3, A>

Creates a builder struct for warping noise.

§Type Parameters

  • C: The combiner algorithm to use across octaves.
  • G: The generator algorithm to sample from.

§Parameters

  • warp_strength: How strongly the warp is applied.
  • x_iter: An iterator of warp values to distort each sample’s x input.
  • y_iter: An iterator of warp values to distort each sample’s y input.
  • z_iter: An iterator of warp values to distort each sample’s z input.
Source

pub fn warp_builder<C: Combiner, G: BatchGenerator<3>>( &self, warp_strength: f32, x_iter: impl Iterator<Item = Simd<f32, A>>, y_iter: impl Iterator<Item = Simd<f32, A>>, z_iter: impl Iterator<Item = Simd<f32, A>>, ) -> BatchNoiseBuilder<3, C, G, A, impl DimIter<A, 3>>

Trait Implementations§

Source§

impl<const D: usize, A: Clone + Arch> Clone for Grid<D, A>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const D: usize, A: Copy + Arch> Copy for Grid<D, A>

Source§

impl<const D: usize, A: Debug + Arch> Debug for Grid<D, A>

Source§

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

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

impl<const D: usize, A: Default + Arch> Default for Grid<D, A>

Source§

fn default() -> Self

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

impl<const D: usize, A: PartialEq + Arch> PartialEq for Grid<D, A>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<const D: usize, A: PartialEq + Arch> StructuralPartialEq for Grid<D, A>

Auto Trait Implementations§

§

impl<const D: usize, A> Freeze for Grid<D, A>

§

impl<const D: usize, A> RefUnwindSafe for Grid<D, A>

§

impl<const D: usize, A> Send for Grid<D, A>

§

impl<const D: usize, A> Sync for Grid<D, A>

§

impl<const D: usize, A> Unpin for Grid<D, A>

§

impl<const D: usize, A> UnsafeUnpin for Grid<D, A>

§

impl<const D: usize, A> UnwindSafe for Grid<D, A>

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.