Skip to main content

NoiseField

Struct NoiseField 

Source
pub struct NoiseField { /* private fields */ }
Expand description

Seeded multi-octave procedural noise evaluator supporting Perlin, Simplex, Worley, fBm, Ridged, and Curl noise.

Implementations§

Source§

impl NoiseField

Seeded Perlin, Simplex, Worley, fBm, Ridged Multifractal, and Curl noise evaluation for NoiseField.

Source

pub fn new(seed: u64) -> Self

Builds a deterministic NoiseField from seed.

§Arguments
  • u64 - Deterministic seed controlling the permutation table and cellular hashes.
§Returns
  • Self - Seeded noise evaluator.
Source

pub fn perlin_2d(&self, x: f32, y: f32) -> f32

Evaluates classic improved 2D Perlin gradient noise in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
§Returns
  • f32 - Smooth deterministic Perlin value bounded in [-1.0, 1.0].
Source

pub fn perlin_3d(&self, x: f32, y: f32, z: f32) -> f32

Evaluates classic improved 3D Perlin gradient noise in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
§Returns
  • f32 - Smooth deterministic 3D Perlin value bounded in [-1.0, 1.0].
Source

pub fn simplex_2d(&self, x: f32, y: f32) -> f32

Evaluates 2D Simplex gradient noise in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
§Returns
  • f32 - Isotropic 2D Simplex value bounded in [-1.0, 1.0].
Source

pub fn simplex_3d(&self, x: f32, y: f32, z: f32) -> f32

Evaluates 3D Simplex gradient noise in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
§Returns
  • f32 - Isotropic 3D Simplex value bounded in [-1.0, 1.0].
Source

pub fn worley_2d( &self, x: f32, y: f32, metric: WorleyMetric, output: WorleyOutput, ) -> f32

Evaluates 2D Worley / cellular noise returning F1, F2, or F2 - F1.

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • WorleyMetric - Distance norm (Euclidean, Manhattan, or Chebyshev).
  • WorleyOutput - Feature distance selector (F1, F2, or F2MinusF1).
§Returns
  • f32 - Non-negative cellular distance value.
Source

pub fn worley_3d( &self, x: f32, y: f32, z: f32, metric: WorleyMetric, output: WorleyOutput, ) -> f32

Evaluates 3D Worley / cellular noise returning F1, F2, or F2 - F1.

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
  • WorleyMetric - Distance norm.
  • WorleyOutput - Feature distance selector.
§Returns
  • f32 - Non-negative cellular distance value.
Source

pub fn fbm_2d( &self, x: f32, y: f32, octaves: u32, lacunarity: f32, gain: f32, ) -> f32

Evaluates normalized 2D Fractional Brownian Motion (fBm) bounded in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • u32 - Number of octaves (clamped to [1, 12]).
  • f32 - Frequency multiplier per octave (e.g. 2.0).
  • f32 - Amplitude persistence per octave (e.g. 0.5).
§Returns
  • f32 - Normalized fBm scalar in [-1.0, 1.0].
Source

pub fn fbm_3d( &self, x: f32, y: f32, z: f32, octaves: u32, lacunarity: f32, gain: f32, ) -> f32

Evaluates normalized 3D Fractional Brownian Motion (fBm) bounded in [-1.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
  • u32 - Number of octaves (clamped to [1, 12]).
  • f32 - Frequency multiplier per octave.
  • f32 - Amplitude persistence per octave.
§Returns
  • f32 - Normalized fBm scalar in [-1.0, 1.0].
Source

pub fn ridged_2d( &self, x: f32, y: f32, octaves: u32, lacunarity: f32, gain: f32, ) -> f32

Evaluates normalized 2D Ridged Multifractal noise bounded in [0.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • u32 - Octave count (clamped to [1, 12]).
  • f32 - Frequency multiplier per octave.
  • f32 - Amplitude gain per octave.
§Returns
  • f32 - Sharp mountain-ridge scalar in [0.0, 1.0].
Source

pub fn ridged_3d( &self, x: f32, y: f32, z: f32, octaves: u32, lacunarity: f32, gain: f32, ) -> f32

Evaluates normalized 3D Ridged Multifractal noise bounded in [0.0, 1.0].

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
  • u32 - Octave count (clamped to [1, 12]).
  • f32 - Frequency multiplier per octave.
  • f32 - Amplitude gain per octave.
§Returns
  • f32 - Sharp 3D ridge scalar in [0.0, 1.0].
Source

pub fn curl_2d(&self, x: f32, y: f32, epsilon: f32) -> Vec2

Evaluates divergence-free 2D Curl Noise (dPsi/dy, -dPsi/dx) for swirling flow fields.

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - Central difference step size (defaults to 1e-3 when non-positive).
§Returns
  • Vec2 - Divergence-free 2D velocity vector.
Source

pub fn curl_3d(&self, x: f32, y: f32, z: f32, epsilon: f32) -> Vec3

Evaluates divergence-free 3D Curl Noise curl(Px, Py, Pz) for turbulent incompressible fields.

§Arguments
  • f32 - World X coordinate.
  • f32 - World Y coordinate.
  • f32 - World Z coordinate.
  • f32 - Central difference step size (defaults to 1e-3 when non-positive).
§Returns
  • Vec3 - Divergence-free 3D velocity vector.
Source§

impl NoiseField

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_seed(&self) -> u64

Source

pub fn get_mut_seed(&mut self) -> &mut u64

Source

pub fn set_seed(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for NoiseField

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 Debug for NoiseField

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.