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.
Sourcepub fn new_without_noise_offset<R: Random>(random: &mut R) -> Self
pub fn new_without_noise_offset<R: Random>(random: &mut R) -> Self
Creates a simplex sampler whose random offsets are discarded.
Vanilla still consumes the three offset samples when the scale is zero.
fn with_noise_offset_scale<R: Random>( random: &mut R, noise_offset_scale: f64, ) -> Self
const fn p(&self, x: i32) -> i32
Sourcepub fn get_value_2d(&self, xin: f64, yin: f64) -> f32
pub fn get_value_2d(&self, xin: f64, yin: f64) -> f32
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
Auto 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
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> ⓘ
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> ⓘ
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 moreArc<SyncMutex<>>