pub struct SimplexNoise {
p: [i32; 512],
pub xo: f64,
pub yo: f64,
pub zo: f64,
}Expand description
Simplex noise generator matching vanilla’s SimplexNoise.java.
Unlike ImprovedNoise which uses 256-byte permutation tables, this uses a
512-entry i32 permutation table (first 256 entries shuffled, mirrored to second half).
Fields§
§p: [i32; 512]§xo: f64X offset for the noise coordinates.
yo: f64Y offset for the noise coordinates.
zo: f64Z offset for the noise coordinates.
Implementations§
Source§impl SimplexNoise
impl SimplexNoise
Sourcepub fn new<R: Random>(random: &mut R) -> Self
pub fn new<R: Random>(random: &mut R) -> Self
Create a new simplex noise generator from a random source.
Matches vanilla’s SimplexNoise(RandomSource) constructor:
consumes 3 doubles for offsets, then shuffles a 256-entry permutation table.
const fn p(&self, x: i32) -> i32
Sourcepub fn get_value_2d(&self, xin: f64, yin: f64) -> f64
pub fn get_value_2d(&self, xin: f64, yin: f64) -> f64
Sample 2D simplex noise at the given coordinates.
Returns a value typically in the range [-1, 1] (scaled by 70).
Trait Implementations§
Source§impl Clone for SimplexNoise
impl Clone for SimplexNoise
Source§fn clone(&self) -> SimplexNoise
fn clone(&self) -> SimplexNoise
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SimplexNoise
impl RefUnwindSafe for SimplexNoise
impl Send for SimplexNoise
impl Sync for SimplexNoise
impl Unpin for SimplexNoise
impl UnsafeUnpin for SimplexNoise
impl UnwindSafe for SimplexNoise
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>