diff --git a/.gitignore b/.gitignore index eb5de605a..80903600c 100644 --- a/.gitignore +++ b/.gitignore @@ -124,4 +124,10 @@ docs/.vitepress/dist docs/.vitepress/cache node_modules +<<<<<<< HEAD +# Benchmarking +*perf.data* +*flamegraph.svg +======= run/ +>>>>>>> master diff --git a/Cargo.toml b/Cargo.toml index c735af257..5d49ab403 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,9 @@ edition = "2021" lto = true codegen-units = 1 +[profile.bench] +debug = true + [profile.profiling] inherits = "release" debug = true diff --git a/pumpkin-core/Cargo.toml b/pumpkin-core/Cargo.toml index bb386ba16..a5c8bfd52 100644 --- a/pumpkin-core/Cargo.toml +++ b/pumpkin-core/Cargo.toml @@ -13,3 +13,4 @@ fastnbt = { git = "https://github.com/owengage/fastnbt.git" } colored = "2" md5 = "0.7.0" +enum_dispatch = "0.3.13" diff --git a/pumpkin-core/src/math/mod.rs b/pumpkin-core/src/math/mod.rs index e1f7149f0..777bf987f 100644 --- a/pumpkin-core/src/math/mod.rs +++ b/pumpkin-core/src/math/mod.rs @@ -1,3 +1,5 @@ +use num_traits::PrimInt; + pub mod boundingbox; pub mod position; pub mod vector2; @@ -30,3 +32,60 @@ pub fn magnitude(a: f64, b: f64, c: f64) -> f64 { pub const fn get_section_cord(coord: i32) -> i32 { coord >> 4 } + +const MULTIPLY_DE_BRUIJN_BIT_POSITION: [u8; 32] = [ + 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, + 12, 18, 6, 11, 5, 10, 9, +]; + +/// Maximum return value: 31 +pub const fn ceil_log2(value: u32) -> u8 { + let value = if value.is_power_of_two() { + value + } else { + smallest_encompassing_power_of_two(value) + }; + + MULTIPLY_DE_BRUIJN_BIT_POSITION[(((value as usize) * 125613361) >> 27) & 31] +} + +/// Maximum return value: 30 +pub const fn floor_log2(value: u32) -> u8 { + ceil_log2(value) - if value.is_power_of_two() { 0 } else { 1 } +} + +pub const fn smallest_encompassing_power_of_two(value: u32) -> u32 { + let mut i = value - 1; + i |= i >> 1; + i |= i >> 2; + i |= i >> 4; + i |= i >> 8; + i |= i >> 16; + i + 1 +} + +#[inline] +pub fn floor_div(x: T, y: T) -> T +where + T: PrimInt + From, +{ + let div = x / y; + if (x ^ y) < 0.into() && div * y != x { + div - 1.into() + } else { + div + } +} + +#[inline] +pub fn floor_mod(x: T, y: T) -> T +where + T: PrimInt + From, +{ + let rem = x % y; + if (x ^ y) < 0.into() && rem != 0.into() { + rem + y + } else { + rem + } +} diff --git a/pumpkin-core/src/math/vector2.rs b/pumpkin-core/src/math/vector2.rs index 3c3728ba5..1d1e0f7f2 100644 --- a/pumpkin-core/src/math/vector2.rs +++ b/pumpkin-core/src/math/vector2.rs @@ -2,14 +2,14 @@ use std::ops::{Add, Div, Mul, Neg, Sub}; use num_traits::Float; -#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq, Default)] pub struct Vector2 { pub x: T, pub z: T, } impl Vector2 { - pub fn new(x: T, z: T) -> Self { + pub const fn new(x: T, z: T) -> Self { Vector2 { x, z } } @@ -103,3 +103,4 @@ impl Math for f64 {} impl Math for f32 {} impl Math for i32 {} impl Math for i64 {} +impl Math for i8 {} diff --git a/pumpkin-core/src/math/vector3.rs b/pumpkin-core/src/math/vector3.rs index 04b9d4092..1f2bf0032 100644 --- a/pumpkin-core/src/math/vector3.rs +++ b/pumpkin-core/src/math/vector3.rs @@ -1,8 +1,8 @@ -use std::ops::{Add, Div, Mul, Neg, Sub}; +use std::ops::{Add, Div, Mul, Sub}; use num_traits::Float; -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq, Default)] pub struct Vector3 { pub x: T, pub y: T, @@ -80,6 +80,7 @@ impl Add for Vector3 { } } +/* impl Neg for Vector3 { type Output = Self; @@ -91,6 +92,7 @@ impl Neg for Vector3 { } } } +*/ impl From<(T, T, T)> for Vector3 { #[inline(always)] @@ -108,7 +110,7 @@ impl From> for (T, T, T) { pub trait Math: Mul - + Neg + //+ Neg + Add + Div + Sub @@ -119,3 +121,4 @@ impl Math for f64 {} impl Math for f32 {} impl Math for i32 {} impl Math for i64 {} +impl Math for u8 {} diff --git a/pumpkin-core/src/random/legacy_rand.rs b/pumpkin-core/src/random/legacy_rand.rs index 4a2cb1b98..3574bb0de 100644 --- a/pumpkin-core/src/random/legacy_rand.rs +++ b/pumpkin-core/src/random/legacy_rand.rs @@ -8,12 +8,16 @@ pub struct LegacyRand { } impl LegacyRand { - fn next_random(&mut self) -> u64 { - let l = self.seed; + fn next_random(&mut self) -> i64 { + let l = self.seed as i64; let m = l.wrapping_mul(0x5DEECE66D).wrapping_add(11) & 0xFFFFFFFFFFFF; - self.seed = m; + self.seed = m as u64; m } + + fn next(&mut self, bits: u64) -> i32 { + (self.next_random() >> (48 - bits)) as i32 + } } impl GaussianGenerator for LegacyRand { @@ -34,16 +38,12 @@ impl RandomImpl for LegacyRand { } } - fn next(&mut self, bits: u64) -> u64 { - self.next_random() >> (48 - bits) - } - fn split(&mut self) -> Self { LegacyRand::from_seed(self.next_i64() as u64) } fn next_i32(&mut self) -> i32 { - self.next(32) as i32 + self.next(32) } fn next_i64(&mut self) -> i64 { @@ -59,7 +59,7 @@ impl RandomImpl for LegacyRand { fn next_f64(&mut self) -> f64 { let i = self.next(26); let j = self.next(27); - let l = (i << 27).wrapping_add(j); + let l = ((i as i64) << 27).wrapping_add(j as i64); l as f64 * 1.110223E-16f32 as f64 } @@ -78,10 +78,10 @@ impl RandomImpl for LegacyRand { fn next_bounded_i32(&mut self, bound: i32) -> i32 { if (bound & bound.wrapping_sub(1)) == 0 { - ((bound as u64).wrapping_mul(self.next(31)) >> 31) as i32 + ((bound as i64).wrapping_mul(self.next(31) as i64) >> 31) as i32 } else { loop { - let i = self.next(31) as i32; + let i = self.next(31); let j = i % bound; if (i.wrapping_sub(j).wrapping_add(bound.wrapping_sub(1))) >= 0 { return j; @@ -91,6 +91,7 @@ impl RandomImpl for LegacyRand { } } +#[derive(Clone)] pub struct LegacySplitter { seed: u64, } @@ -120,7 +121,7 @@ impl RandomDeriverImpl for LegacySplitter { #[cfg(test)] mod test { - use crate::random::{RandomDeriverImpl, RandomImpl}; + use crate::random::{legacy_rand::LegacySplitter, RandomDeriverImpl, RandomImpl}; use super::LegacyRand; @@ -308,8 +309,19 @@ mod test { #[test] fn test_split() { let mut original_rand = LegacyRand::from_seed(0); - let mut new_rand = original_rand.split(); + assert_eq!(original_rand.next_i64(), -4962768465676381896i64); + + let mut original_rand = LegacyRand::from_seed(0); + { + let splitter: LegacySplitter = original_rand.next_splitter(); + assert_eq!(splitter.seed, (-4962768465676381896i64) as u64); + + let mut rand = splitter.split_string("minecraft:offset"); + assert_eq!(rand.next_i32(), 103436829); + } + let mut original_rand = LegacyRand::from_seed(0); + let mut new_rand = original_rand.split(); { let splitter = new_rand.next_splitter(); diff --git a/pumpkin-core/src/random/mod.rs b/pumpkin-core/src/random/mod.rs index 2c3d41125..546e082ef 100644 --- a/pumpkin-core/src/random/mod.rs +++ b/pumpkin-core/src/random/mod.rs @@ -8,7 +8,6 @@ pub mod xoroshiro128; pub enum RandomGenerator { Xoroshiro(Xoroshiro), Legacy(LegacyRand), - LegacyXoroshiro(Xoroshiro), } impl RandomGenerator { @@ -16,7 +15,6 @@ impl RandomGenerator { pub fn split(&mut self) -> Self { match self { Self::Xoroshiro(rand) => Self::Xoroshiro(rand.split()), - Self::LegacyXoroshiro(rand) => Self::LegacyXoroshiro(rand.split()), Self::Legacy(rand) => Self::Legacy(rand.split()), } } @@ -25,25 +23,14 @@ impl RandomGenerator { pub fn next_splitter(&mut self) -> RandomDeriver { match self { Self::Xoroshiro(rand) => RandomDeriver::Xoroshiro(rand.next_splitter()), - Self::LegacyXoroshiro(rand) => RandomDeriver::Xoroshiro(rand.next_splitter()), Self::Legacy(rand) => RandomDeriver::Legacy(rand.next_splitter()), } } - #[inline] - pub fn next(&mut self, bits: u64) -> u64 { - match self { - Self::Xoroshiro(rand) => rand.next(bits), - Self::LegacyXoroshiro(rand) => rand.next(bits), - Self::Legacy(rand) => rand.next(bits), - } - } - #[inline] pub fn next_i32(&mut self) -> i32 { match self { Self::Xoroshiro(rand) => rand.next_i32(), - Self::LegacyXoroshiro(rand) => rand.next_i32(), Self::Legacy(rand) => rand.next_i32(), } } @@ -52,7 +39,6 @@ impl RandomGenerator { pub fn next_bounded_i32(&mut self, bound: i32) -> i32 { match self { Self::Xoroshiro(rand) => rand.next_bounded_i32(bound), - Self::LegacyXoroshiro(rand) => rand.next_bounded_i32(bound), Self::Legacy(rand) => rand.next_bounded_i32(bound), } } @@ -66,7 +52,6 @@ impl RandomGenerator { pub fn next_i64(&mut self) -> i64 { match self { Self::Xoroshiro(rand) => rand.next_i64(), - Self::LegacyXoroshiro(rand) => rand.next_i64(), Self::Legacy(rand) => rand.next_i64(), } } @@ -75,7 +60,6 @@ impl RandomGenerator { pub fn next_bool(&mut self) -> bool { match self { Self::Xoroshiro(rand) => rand.next_bool(), - Self::LegacyXoroshiro(rand) => rand.next_bool(), Self::Legacy(rand) => rand.next_bool(), } } @@ -84,7 +68,6 @@ impl RandomGenerator { pub fn next_f32(&mut self) -> f32 { match self { Self::Xoroshiro(rand) => rand.next_f32(), - Self::LegacyXoroshiro(rand) => rand.next_f32(), Self::Legacy(rand) => rand.next_f32(), } } @@ -93,7 +76,6 @@ impl RandomGenerator { pub fn next_f64(&mut self) -> f64 { match self { Self::Xoroshiro(rand) => rand.next_f64(), - Self::LegacyXoroshiro(rand) => rand.next_f64(), Self::Legacy(rand) => rand.next_f64(), } } @@ -102,7 +84,6 @@ impl RandomGenerator { pub fn next_gaussian(&mut self) -> f64 { match self { Self::Xoroshiro(rand) => rand.next_gaussian(), - Self::LegacyXoroshiro(rand) => rand.next_gaussian(), Self::Legacy(rand) => rand.next_gaussian(), } } @@ -125,6 +106,7 @@ impl RandomGenerator { } } +#[derive(Clone)] pub enum RandomDeriver { Xoroshiro(XoroshiroSplitter), Legacy(LegacySplitter), @@ -163,8 +145,6 @@ pub trait RandomImpl { fn next_splitter(&mut self) -> impl RandomDeriverImpl; - fn next(&mut self, bits: u64) -> u64; - fn next_i32(&mut self) -> i32; fn next_bounded_i32(&mut self, bound: i32) -> i32; @@ -215,17 +195,17 @@ fn hash_block_pos(x: i32, y: i32, z: i32) -> i64 { l >> 16 } -fn java_string_hash(string: &str) -> u32 { +fn java_string_hash(string: &str) -> i32 { // All byte values of latin1 align with // the values of U+0000 - U+00FF making this code // equivalent to both java hash implementations - let mut result = 0u32; + let mut result = 0i32; for char_encoding in string.encode_utf16() { - result = 31u32 + result = 31i32 .wrapping_mul(result) - .wrapping_add(char_encoding as u32); + .wrapping_add(char_encoding as i32); } result } @@ -271,12 +251,13 @@ mod tests { ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄ\ ÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ\ ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ", - (-1992287231i32) as u32, + -1992287231i32, ), ("求同存异", 847053876), // This might look wierd because hebrew is text is right to left ("אבְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ:", 1372570871), ("संस्कृत-", 1748614838), + ("minecraft:offset", -920384768i32), ]; for (string, value) in values { diff --git a/pumpkin-core/src/random/xoroshiro128.rs b/pumpkin-core/src/random/xoroshiro128.rs index a82fcf75c..65d92533c 100644 --- a/pumpkin-core/src/random/xoroshiro128.rs +++ b/pumpkin-core/src/random/xoroshiro128.rs @@ -31,6 +31,10 @@ impl Xoroshiro { Self::new(lo, hi) } + fn next(&mut self, bits: u64) -> u64 { + self.next_random() >> (64 - bits) + } + fn next_random(&mut self) -> u64 { let l = self.lo; let m = self.hi; @@ -70,10 +74,6 @@ impl RandomImpl for Xoroshiro { Self::new(self.next_random(), self.next_random()) } - fn next(&mut self, bits: u64) -> u64 { - self.next_random() >> (64 - bits) - } - #[allow(refining_impl_trait)] fn next_splitter(&mut self) -> XoroshiroSplitter { XoroshiroSplitter { @@ -123,6 +123,7 @@ impl RandomImpl for Xoroshiro { } } +#[derive(Clone)] pub struct XoroshiroSplitter { lo: u64, hi: u64, diff --git a/pumpkin-world/Cargo.toml b/pumpkin-world/Cargo.toml index 85537ec3e..36f798e61 100644 --- a/pumpkin-world/Cargo.toml +++ b/pumpkin-world/Cargo.toml @@ -22,6 +22,7 @@ num-traits.workspace = true num-derive.workspace = true futures = "0.3" dashmap = "6.1.0" +lazy_static = "1.5.0" # Compression flate2 = "1.0" @@ -35,3 +36,15 @@ fastnbt = { git = "https://github.com/owengage/fastnbt.git" } noise = "0.9.0" rand = "0.8.5" + +[dev-dependencies] +criterion = { version = "0.5.1", features = ["html_reports"] } + + +[[bench]] +name = "chunk_noise" +harness = false + +[[bench]] +name = "chunk_noise_populate" +harness = false diff --git a/pumpkin-world/benches/chunk_noise.rs b/pumpkin-world/benches/chunk_noise.rs new file mode 100644 index 000000000..d726257a8 --- /dev/null +++ b/pumpkin-world/benches/chunk_noise.rs @@ -0,0 +1,11 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use pumpkin_world::bench_create_chunk_noise_overworld; + +fn criterion_benchmark(c: &mut Criterion) { + c.bench_function("overworld convert", |b| { + b.iter(bench_create_chunk_noise_overworld) + }); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/pumpkin-world/benches/chunk_noise_populate.rs b/pumpkin-world/benches/chunk_noise_populate.rs new file mode 100644 index 000000000..88c3d484f --- /dev/null +++ b/pumpkin-world/benches/chunk_noise_populate.rs @@ -0,0 +1,11 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use pumpkin_world::bench_create_and_populate_noise; + +fn criterion_benchmark(c: &mut Criterion) { + c.bench_function("overworld convert + noise", |b| { + b.iter(bench_create_and_populate_noise) + }); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches); diff --git a/pumpkin-world/src/block/block_state.rs b/pumpkin-world/src/block/block_state.rs index 95151959b..a23001200 100644 --- a/pumpkin-world/src/block/block_state.rs +++ b/pumpkin-world/src/block/block_state.rs @@ -1,24 +1,39 @@ -use super::block_registry::get_block; +use super::block_registry::{get_block, get_state_by_state_id}; -#[derive(Clone)] +#[derive(Clone, Copy, Debug)] pub struct BlockState { pub state_id: u16, + pub block_id: u16, } impl BlockState { - pub const AIR: BlockState = BlockState { state_id: 0 }; + pub const AIR: BlockState = BlockState { + state_id: 0, + block_id: 0, + }; /// Get a Block from the Vanilla Block registry at Runtime pub fn new(registry_id: &str) -> Option { let block = get_block(registry_id); block.map(|block| Self { state_id: block.default_state_id, + block_id: block.id, }) } pub fn get_id(&self) -> u16 { self.state_id } + + #[inline] + pub fn is_air(&self) -> bool { + get_state_by_state_id(self.state_id).unwrap().air + } + + #[inline] + pub fn of_block(&self, block_id: u16) -> bool { + self.block_id == block_id + } } #[cfg(test)] diff --git a/pumpkin-world/src/lib.rs b/pumpkin-world/src/lib.rs index 6e30ee9ab..03f13e53a 100644 --- a/pumpkin-world/src/lib.rs +++ b/pumpkin-world/src/lib.rs @@ -1,3 +1,12 @@ +use block::BlockState; +use world_gen::{ + chunk_noise::{ChunkNoiseGenerator, LAVA_BLOCK, WATER_BLOCK}, + generation_shapes::GenerationShape, + noise::{config::NoiseConfig, router::OVERWORLD_NOISE_ROUTER}, + proto_chunk::StandardChunkFluidLevelSampler, + sampler::{FluidLevel, FluidLevelSampler}, +}; + pub mod biome; pub mod block; pub mod chunk; @@ -12,3 +21,98 @@ pub const WORLD_HEIGHT: usize = 384; pub const WORLD_LOWEST_Y: i16 = -64; pub const WORLD_MAX_Y: i16 = WORLD_HEIGHT as i16 - WORLD_LOWEST_Y.abs(); pub const DIRECT_PALETTE_BITS: u32 = 15; + +// TODO: is there a way to do in-file benches? +pub fn bench_create_chunk_noise_overworld() { + let config = NoiseConfig::new(0, &OVERWORLD_NOISE_ROUTER); + let generation_shape = GenerationShape::SURFACE; + let sampler = FluidLevelSampler::Chunk(StandardChunkFluidLevelSampler { + bottom_fluid: FluidLevel::new(-54, *LAVA_BLOCK), + top_fluid: FluidLevel::new(62, *WATER_BLOCK), + }); + + ChunkNoiseGenerator::new( + 16 / generation_shape.horizontal_cell_block_count(), + 0, + 0, + generation_shape, + &config, + sampler, + true, + true, + ); +} + +pub fn bench_create_and_populate_noise() { + let config = NoiseConfig::new(0, &OVERWORLD_NOISE_ROUTER); + let fluid_sampler = FluidLevelSampler::Chunk(StandardChunkFluidLevelSampler { + bottom_fluid: FluidLevel::new(-54, *LAVA_BLOCK), + top_fluid: FluidLevel::new(62, *WATER_BLOCK), + }); + let generation_shape = GenerationShape::SURFACE; + + let mut sampler = ChunkNoiseGenerator::new( + 16 / generation_shape.horizontal_cell_block_count(), + 0, + 0, + generation_shape, + &config, + fluid_sampler, + true, + true, + ); + + let horizontal_cell_block_count = sampler.horizontal_cell_block_count(); + let vertical_cell_block_count = sampler.vertical_cell_block_count(); + + let horizonal_cells = 16 / horizontal_cell_block_count; + + let min_y = sampler.min_y(); + let minimum_cell_y = min_y / vertical_cell_block_count as i8; + let cell_height = sampler.height() / vertical_cell_block_count as u16; + + sampler.sample_start_density(); + for cell_x in 0..horizonal_cells { + sampler.sample_end_density(cell_x); + + for cell_z in 0..horizonal_cells { + for cell_y in (0..cell_height).rev() { + sampler.on_sampled_cell_corners(cell_y, cell_z); + for local_y in (0..vertical_cell_block_count).rev() { + let block_y = (minimum_cell_y as i32 + cell_y as i32) + * vertical_cell_block_count as i32 + + local_y as i32; + let delta_y = local_y as f64 / vertical_cell_block_count as f64; + sampler.interpolate_y(block_y, delta_y); + + for local_x in 0..horizontal_cell_block_count { + let block_x = + cell_x as i32 * horizontal_cell_block_count as i32 + local_x as i32; + let delta_x = local_x as f64 / horizontal_cell_block_count as f64; + sampler.interpolate_x(block_x, delta_x); + + for local_z in 0..horizontal_cell_block_count { + let block_z = + cell_z as i32 * horizontal_cell_block_count as i32 + local_z as i32; + let delta_z = local_z as f64 / horizontal_cell_block_count as f64; + sampler.interpolate_z(block_z, delta_z); + + // TODO: Change default block + let _block_state = sampler + .sample_block_state() + .unwrap_or(BlockState::new("minecraft:stone").unwrap()); + //log::debug!("Sampled block state in {:?}", inst.elapsed()); + + //println!("Putting {:?}: {:?}", local_pos, block_state); + //self.block_map.insert(local_pos, block_state); + } + } + } + } + } + + sampler.swap_buffers(); + } + + sampler.stop_interpolation(); +} diff --git a/pumpkin-world/src/world_gen/blender/mod.rs b/pumpkin-world/src/world_gen/blender/mod.rs index eb1e0ec43..881e8968d 100644 --- a/pumpkin-world/src/world_gen/blender/mod.rs +++ b/pumpkin-world/src/world_gen/blender/mod.rs @@ -1,11 +1,46 @@ +use enum_dispatch::enum_dispatch; + use super::noise::density::NoisePos; -pub struct Blender { - // TODO +pub struct BlendResult { + alpha: f64, + offset: f64, +} + +impl BlendResult { + pub fn new(alpha: f64, offset: f64) -> Self { + Self { alpha, offset } + } +} + +#[enum_dispatch(BlenderImpl)] +pub enum Blender { + NoBlend(NoBlendBlender), } impl Blender { - pub fn apply_blend_density(&self, _pos: &NoisePos, _density: f64) -> f64 { + pub const NO_BLEND: Self = Self::NoBlend(NoBlendBlender {}); +} + +#[enum_dispatch] +pub trait BlenderImpl { + fn calculate(&self, block_x: i32, block_z: i32) -> BlendResult; + + fn apply_blend_density(&self, pos: &NoisePos, density: f64) -> f64; + + fn get_biome_supplier(&self) { todo!() } } + +pub struct NoBlendBlender {} + +impl BlenderImpl for NoBlendBlender { + fn calculate(&self, _block_x: i32, _block_z: i32) -> BlendResult { + BlendResult::new(1f64, 1f64) + } + + fn apply_blend_density(&self, _pos: &NoisePos, density: f64) -> f64 { + density + } +} diff --git a/pumpkin-world/src/world_gen/chunk_noise.rs b/pumpkin-world/src/world_gen/chunk_noise.rs new file mode 100644 index 000000000..06f30f3cb --- /dev/null +++ b/pumpkin-world/src/world_gen/chunk_noise.rs @@ -0,0 +1,1326 @@ +use std::{collections::HashMap, hash::Hash, mem, num::Wrapping, ops::AddAssign, sync::Arc}; + +use lazy_static::lazy_static; +use num_traits::Zero; +use parking_lot::Mutex; +use pumpkin_core::math::{floor_div, vector2::Vector2, vector3::Vector3}; + +use crate::{ + block::BlockState, + match_ref_implementations, + world_gen::{ + noise::{density::basic::WrapperType, lerp3}, + section_coords, + }, +}; + +use super::{ + biome_coords, + blender::Blender, + generation_shapes::GenerationShape, + noise::{ + config::NoiseConfig, + density::{ + basic::{BeardifierFunction, WrapperFunction}, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, + ComponentReferenceImplementation, ConversionResultPre, ConverterEnvironment, + ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, + MutableComponentReference, OwnedConverterEnvironment, SharedComponentReference, + }, + noise::InternalNoise, + NoisePos, NoisePosImpl, UnblendedNoisePos, + }, + lerp, + }, + positions::chunk_pos, + sampler::{ + AquiferSampler, BlockStateSampler, ChainedBlockStateSampler, FluidLevelSampler, + OreVeinSampler, SeaLevelAquiferSampler, WorldAquiferSampler, + }, +}; + +lazy_static! { + pub static ref STONE_BLOCK: BlockState = BlockState::new("minecraft:stone").unwrap(); + pub static ref LAVA_BLOCK: BlockState = BlockState::new("minecraft:lava").unwrap(); + pub static ref WATER_BLOCK: BlockState = BlockState::new("minecraft:water").unwrap(); +} + +pub struct ChunkCacheOnceFunction> { + delegate: R, + sample_unique_index: u64, + cache_once_unique_index: u64, + last_sample_result: f64, + cache: Option>, +} + +impl> ChunkCacheOnceFunction { + fn new(delegate: R) -> Self { + Self { + delegate, + sample_unique_index: 0, + cache_once_unique_index: 0, + last_sample_result: 0f64, + cache: None, + } + } +} + +impl> ComponentFunctionImpl for ChunkCacheOnceFunction {} + +impl> MutableComponentFunctionImpl + for ChunkCacheOnceFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + if let NoisePos::Chunk(_chunk_pos) = pos { + if let Some(cache) = &mut self.cache { + if self.cache_once_unique_index == env.cache_once_unique_index.0 { + return cache[env.index]; + } + } + + if self.sample_unique_index == env.sample_unique_index.0 { + return self.last_sample_result; + } + + self.sample_unique_index = env.sample_unique_index.0; + self.last_sample_result = self.delegate.sample_mut(pos, env); + return self.last_sample_result; + } + self.delegate.sample_mut(pos, env) + } + + fn fill_mut( + &mut self, + densities: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + if let Some(cache) = &mut self.cache { + let env = applier.env(); + if self.cache_once_unique_index == env.cache_once_unique_index.0 { + densities.iter_mut().enumerate().for_each(|(index, val)| { + *val = cache[index]; + }); + return; + } + } + + self.delegate.fill_mut(densities, applier); + + let env = applier.env(); + self.cache_once_unique_index = env.cache_once_unique_index.0; + + if let Some(cache) = &mut self.cache { + if densities.len() == cache.len() { + cache.iter_mut().enumerate().for_each(|(index, val)| { + *val = densities[index]; + }); + return; + } + } + + self.cache = Some(densities.to_vec().into()); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + match_ref_implementations!( + (delegate, self.delegate.clone_to_new_ref()); + { + MutableComponentReference(Box::new( + ChunkCacheOnceFunction { + delegate, + sample_unique_index: self.sample_unique_index, + cache_once_unique_index: self.cache_once_unique_index, + last_sample_result: self.last_sample_result, + cache: self.cache.clone(), + } + )).into() + } + ) + } +} + +pub struct ChunkFlatCacheFunction> { + delegate: R, + cache: Box<[f64]>, +} + +impl> ChunkFlatCacheFunction { + fn new(delegate: R, sample: bool, state: &ChunkNoiseState) -> Self { + let mut cache = vec![ + 0f64; + (state.horizontal_biome_end as usize + 1) + * (state.horizontal_biome_end as usize + 1) + ]; + let mut delegate = delegate; + + if sample { + for biome_x in 0..=state.horizontal_biome_end { + let true_biome_x = state.start_biome_pos.x + biome_x as i32; + let block_x = biome_coords::to_block(true_biome_x); + + for biome_z in 0..=state.horizontal_biome_end { + let true_biome_z = state.start_biome_pos.z + biome_z as i32; + let block_z = biome_coords::to_block(true_biome_z); + + let index = + Self::xz_to_index_const(state.horizontal_biome_end, biome_x, biome_z); + + cache[index] = delegate.sample_mut( + &NoisePos::Unblended(UnblendedNoisePos::new(block_x, 0, block_z)), + state, + ); + } + } + } + + Self { + delegate, + cache: cache.into(), + } + } + + const fn xz_to_index_const(horizontal_biome_end: u8, x: u8, z: u8) -> usize { + x as usize * (horizontal_biome_end as usize + 1) + z as usize + } +} + +impl> ComponentFunctionImpl for ChunkFlatCacheFunction {} + +impl> MutableComponentFunctionImpl + for ChunkFlatCacheFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + let biome_x = biome_coords::from_block(pos.x()); + let biome_z = biome_coords::from_block(pos.z()); + + let rel_biome_x = biome_x - env.start_biome_pos.x; + let rel_biome_z = biome_z - env.start_biome_pos.z; + + if rel_biome_x >= 0 + && rel_biome_z >= 0 + && rel_biome_x <= env.horizontal_biome_end as i32 + && rel_biome_z <= env.horizontal_biome_end as i32 + { + let index = Self::xz_to_index_const( + env.horizontal_biome_end, + rel_biome_x as u8, + rel_biome_z as u8, + ); + self.cache[index] + } else { + self.delegate.sample_mut(pos, env) + } + } + + fn fill_mut( + &mut self, + arr: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + applier.fill_mut(arr, self); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + match_ref_implementations!( + (delegate, self.delegate.clone_to_new_ref()); + { + MutableComponentReference(Box::new( + ChunkFlatCacheFunction { + delegate, + cache: self.cache.clone(), + } + )).into() + } + ) + } +} + +pub struct ChunkCellCacheFunction { + delegate: Box>, + cache: Box<[f64]>, +} + +impl ChunkCellCacheFunction { + fn new( + delegate: Box>, + state: &ChunkNoiseState, + ) -> Self { + Self { + delegate, + cache: Self::create_cache(state).into(), + } + } + + fn create_cache(state: &ChunkNoiseState) -> Vec { + vec![ + 0f64; + state.horizontal_cell_block_count as usize + * state.horizontal_cell_block_count as usize + * state.vertical_cell_block_count as usize + ] + } +} + +impl ComponentFunctionImpl for ChunkCellCacheFunction {} + +impl MutableComponentFunctionImpl for ChunkCellCacheFunction { + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + if let NoisePos::Chunk(_chunk_pos) = pos { + #[cfg(debug_assertions)] + assert!(env.is_interpolating); + + let cell_block_x = env.cell_block_pos.x; + let cell_block_y = env.cell_block_pos.y; + let cell_block_z = env.cell_block_pos.z; + + if cell_block_x < env.horizontal_cell_block_count + && cell_block_y < env.vertical_cell_block_count + && cell_block_z < env.horizontal_cell_block_count + { + return self.cache[((env.vertical_cell_block_count as usize + - 1 + - cell_block_y as usize) + * env.horizontal_cell_block_count as usize + + cell_block_x as usize) + * env.horizontal_cell_block_count as usize + + cell_block_z as usize]; + } + } + self.delegate.sample_mut(pos, env) + } + + fn fill_mut( + &mut self, + arr: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + applier.fill_mut(arr, self); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + unreachable!() + } +} + +pub struct Chunk2DCacheFunction> { + delegate: R, + last_sampled_column: u64, + last_result: f64, +} + +impl> Chunk2DCacheFunction { + fn new(delegate: R) -> Self { + Self { + delegate, + last_sampled_column: chunk_pos::MARKER, + last_result: 0f64, + } + } +} + +impl> ComponentFunctionImpl for Chunk2DCacheFunction {} + +impl> MutableComponentFunctionImpl + for Chunk2DCacheFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + let block_x = pos.x(); + let block_z = pos.z(); + + // This is the chunk packing function, but we use it for block positions here + let hash = chunk_pos::packed(&Vector2::new(block_x, block_z)); + + if hash == self.last_sampled_column { + self.last_result + } else { + self.last_sampled_column = hash; + self.last_result = self.delegate.sample_mut(pos, env); + self.last_result + } + } + + fn fill_mut( + &mut self, + arr: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + self.delegate.fill_mut(arr, applier); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + match_ref_implementations!( + (delegate, self.delegate.clone_to_new_ref()); + { + MutableComponentReference(Box::new( + Chunk2DCacheFunction { + delegate, + last_sampled_column: self.last_sampled_column, + last_result: self.last_result, + } + )).into() + } + ) + } +} + +pub struct ChunkInterpolatorFunction { + delegate: Box>, + + start_buf: Box<[f64]>, + end_buf: Box<[f64]>, + + first_pass: [f64; 8], + second_pass: [f64; 4], + third_pass: [f64; 2], + result: f64, +} + +impl ChunkInterpolatorFunction { + fn new( + delegate: Box>, + state: &ChunkNoiseState, + ) -> Self { + Self { + delegate, + start_buf: vec![ + 0f64; + (state.vertical_cell_count as usize + 1) + * (state.horizontal_cell_count as usize + 1) + ] + .into(), + + end_buf: vec![ + 0f64; + (state.vertical_cell_count as usize + 1) + * (state.horizontal_cell_count as usize + 1) + ] + .into(), + + first_pass: [0f64; 8], + second_pass: [0f64; 4], + third_pass: [0f64; 2], + result: 0f64, + } + } + + fn yz_to_buf_index(cell_y: u16, cell_z: u8, state: &ChunkNoiseState) -> usize { + cell_z as usize * (state.vertical_cell_count as usize + 1) + cell_y as usize + } + + fn on_sampled_cell_corners(&mut self, cell_y: u16, cell_z: u8, state: &ChunkNoiseState) { + self.first_pass[0] = self.start_buf[Self::yz_to_buf_index(cell_y, cell_z, state)]; + self.first_pass[1] = self.start_buf[Self::yz_to_buf_index(cell_y, cell_z + 1, state)]; + self.first_pass[4] = self.end_buf[Self::yz_to_buf_index(cell_y, cell_z, state)]; + self.first_pass[5] = self.end_buf[Self::yz_to_buf_index(cell_y, cell_z + 1, state)]; + self.first_pass[2] = self.start_buf[Self::yz_to_buf_index(cell_y + 1, cell_z, state)]; + self.first_pass[3] = self.start_buf[Self::yz_to_buf_index(cell_y + 1, cell_z + 1, state)]; + self.first_pass[6] = self.end_buf[Self::yz_to_buf_index(cell_y + 1, cell_z, state)]; + self.first_pass[7] = self.end_buf[Self::yz_to_buf_index(cell_y + 1, cell_z + 1, state)]; + + //log::debug!("{} First pass: {:?}", self.shared.unique_id, first_pass); + } + + fn interpolate_y(&mut self, delta: f64) { + self.second_pass[0] = lerp(delta, self.first_pass[0], self.first_pass[2]); + self.second_pass[2] = lerp(delta, self.first_pass[4], self.first_pass[6]); + self.second_pass[1] = lerp(delta, self.first_pass[1], self.first_pass[3]); + self.second_pass[3] = lerp(delta, self.first_pass[5], self.first_pass[7]); + + //log::debug!("{} Second pass: {:?}", self.shared.unique_id, second_pass); + } + + fn interpolate_x(&mut self, delta: f64) { + self.third_pass[0] = lerp(delta, self.second_pass[0], self.second_pass[2]); + self.third_pass[1] = lerp(delta, self.second_pass[1], self.second_pass[3]); + + //log::debug!("{} Third pass: {:?}", self.shared.unique_id, third_pass); + } + + fn interpolate_z(&mut self, delta: f64) { + self.result = lerp(delta, self.third_pass[0], self.third_pass[1]); + + //log::debug!("{} Result: {:?}", self.shared.unique_id, *result); + } + + fn swap_buffers(&mut self) { + #[cfg(debug_assertions)] + let temp1 = self.start_buf.clone(); + #[cfg(debug_assertions)] + let temp2 = self.end_buf.clone(); + + mem::swap(&mut self.start_buf, &mut self.end_buf); + + #[cfg(debug_assertions)] + assert!(temp1.iter().eq(self.end_buf.iter())); + #[cfg(debug_assertions)] + assert!(temp2.iter().eq(self.start_buf.iter())); + } +} + +impl ComponentFunctionImpl for ChunkInterpolatorFunction {} + +impl MutableComponentFunctionImpl for ChunkInterpolatorFunction { + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + if let NoisePos::Chunk(_chunk_pos) = pos { + #[cfg(debug_assertions)] + assert!(env.is_interpolating); + + if env.is_sampling_for_caches { + lerp3( + env.cell_block_pos.x as f64 / env.horizontal_cell_block_count as f64, + env.cell_block_pos.y as f64 / env.vertical_cell_block_count as f64, + env.cell_block_pos.z as f64 / env.horizontal_cell_block_count as f64, + self.first_pass[0], + self.first_pass[4], + self.first_pass[2], + self.first_pass[6], + self.first_pass[1], + self.first_pass[5], + self.first_pass[3], + self.first_pass[7], + ) + } else { + self.result + } + } else { + self.delegate.sample_mut(pos, env) + } + } + + fn fill_mut( + &mut self, + arr: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + let env = applier.env(); + if env.is_sampling_for_caches { + applier.fill_mut(arr, self); + } else { + self.delegate.fill_mut(arr, applier); + } + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + unreachable!() + } +} + +// TODO: Can we do this without mutexes? +struct CachedFunctions { + interpolators: Vec>>, + caches: Vec>>, + cached_results: + HashMap>, +} + +pub struct ChunkNoiseWrappedFunctionConverter<'a> { + shared_data: &'a ChunkNoiseState, + functions: CachedFunctions, +} + +impl<'a> ChunkNoiseWrappedFunctionConverter<'a> { + fn new(shared_data: &'a ChunkNoiseState, functions: CachedFunctions) -> Self { + Self { + shared_data, + functions, + } + } + + fn consume(self) -> CachedFunctions { + self.functions + } +} + +struct WrappedMutexFunction { + wrapped: Arc>>, +} + +impl ComponentFunctionImpl for WrappedMutexFunction {} + +impl MutableComponentFunctionImpl for WrappedMutexFunction { + fn sample_mut(&mut self, pos: &NoisePos, env: &ChunkNoiseState) -> f64 { + let mut wrapped = self.wrapped.lock(); + + wrapped.sample_mut(pos, env) + } + + fn fill_mut( + &mut self, + arr: &mut [f64], + applier: &mut dyn EnvironmentApplierImpl, + ) { + let mut wrapped = self.wrapped.lock(); + + wrapped.fill_mut(arr, applier); + } + + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + unreachable!() + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ChunkNoise + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + MutableComponentReference(Box::new(WrappedMutexFunction { + wrapped: self.wrapped.clone(), + })) + .into() + } +} + +impl<'a> ConverterImpl for ChunkNoiseWrappedFunctionConverter<'a> { + fn convert_noise(&mut self, _noise: &Arc) -> Option> { + None + } + + fn convert_env_pre_internal( + &mut self, + component: ConverterEnvironment, + ) -> ConversionResultPre { + match component { + ConverterEnvironment::ChunkNoise => ConversionResultPre::NoChange, + _ => ConversionResultPre::Default, + } + } + + fn converts_post_internal(&mut self, component: ConverterEnvironment) -> bool { + matches!(component, ConverterEnvironment::Wrapper(_, _)) + } + + fn convert_env_post_internal( + &mut self, + component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation { + match component { + OwnedConverterEnvironment::Wrapper(wrapped, action) => match action { + WrapperType::Cache2D => { + let new_ref = match_ref_implementations!( + (wrapped, wrapped); + { + MutableComponentReference(Box::new(Chunk2DCacheFunction::new( + wrapped + ))) + } + ); + new_ref.into() + } + WrapperType::FlatCache => { + let new_ref = match_ref_implementations!( + (wrapped, wrapped); + { + MutableComponentReference(Box::new(ChunkFlatCacheFunction::new( + wrapped, + true, + self.shared_data, + ))) + } + ); + new_ref.into() + } + WrapperType::OnceCache => { + let new_ref = match_ref_implementations!( + (wrapped, wrapped); + { + MutableComponentReference(Box::new(ChunkCacheOnceFunction::new( + wrapped + ))) + } + ); + new_ref.into() + } + WrapperType::CellCache => { + let function = Arc::new(Mutex::new(ChunkCellCacheFunction::new( + wrapped.boxed(), + self.shared_data, + ))); + self.functions.caches.push(function.clone()); + + MutableComponentReference(Box::new(WrappedMutexFunction { wrapped: function })) + .into() + } + WrapperType::Interpolated => { + let function = Arc::new(Mutex::new(ChunkInterpolatorFunction::new( + wrapped.boxed(), + self.shared_data, + ))); + self.functions.interpolators.push(function.clone()); + MutableComponentReference(Box::new(WrappedMutexFunction { wrapped: function })) + .into() + } + }, + _ => unreachable!(), + } + } +} + +#[derive(Debug)] +pub struct ChunkNoisePos { + x: i32, + y: i32, + z: i32, + //unique_id: UniqueChunkNoiseId, +} + +impl NoisePosImpl for ChunkNoisePos { + fn x(&self) -> i32 { + self.x + } + + fn y(&self) -> i32 { + self.y + } + + fn z(&self) -> i32 { + self.z + } + + // TODO: implement blender + fn get_blender(&self) -> Blender { + Blender::NO_BLEND + } +} + +pub struct ChunkNoiseInterpolationApplier<'a> { + shared: &'a mut ChunkNoiseState, +} + +impl<'a> ChunkNoiseInterpolationApplier<'a> { + fn new(shared: &'a mut ChunkNoiseState) -> Self { + Self { shared } + } +} + +impl<'a> EnvironmentApplierImpl for ChunkNoiseInterpolationApplier<'a> { + type Env = ChunkNoiseState; + + fn fill_mut( + &mut self, + densities: &mut [f64], + function: &mut dyn MutableComponentFunctionImpl, + ) { + for cell_y in 0..=self.shared.vertical_cell_count { + self.shared.start_block_pos.y = (cell_y as i32 + self.shared.minimum_cell_y as i32) + * self.shared.vertical_cell_block_count as i32; + self.shared.sample_unique_index.add_assign(1); + self.shared.cell_block_pos.y = 0; + self.shared.index = cell_y as usize; + let pos = self.shared.create_noise_pos(); + let sample = function.sample_mut(&pos, self.env()); + + //log::debug!("{} for {:?}", sample, pos); + densities[cell_y as usize] = sample; + } + } + + fn env(&mut self) -> &Self::Env { + self.shared + } + + fn cast_up(&mut self) -> &mut dyn ApplierImpl { + self + } +} + +impl<'a> ApplierImpl for ChunkNoiseInterpolationApplier<'a> { + fn at(&mut self, index: usize) -> NoisePos { + self.shared.start_block_pos.y = (index as i32 + self.shared.minimum_cell_y as i32) + * self.shared.vertical_cell_block_count as i32; + self.shared.sample_unique_index.add_assign(1); + self.shared.cell_block_pos.y = 0; + self.shared.index = index; + self.shared.create_noise_pos() + } + + fn fill(&mut self, densities: &mut [f64], function: &dyn ImmutableComponentFunctionImpl) { + for cell_y in 0..=self.shared.vertical_cell_count { + self.shared.start_block_pos.y = (cell_y as i32 + self.shared.minimum_cell_y as i32) + * self.shared.vertical_cell_block_count as i32; + self.shared.sample_unique_index.add_assign(1); + self.shared.cell_block_pos.y = 0; + self.shared.index = cell_y as usize; + let pos = self.shared.create_noise_pos(); + let sample = function.sample(&pos); + + //log::debug!("{} for {:?}", sample, pos); + densities[cell_y as usize] = sample; + } + } +} + +pub struct ChunkNoiseApplier<'a> { + shared: &'a mut ChunkNoiseState, +} + +impl<'a> ChunkNoiseApplier<'a> { + fn new(shared: &'a mut ChunkNoiseState) -> Self { + Self { shared } + } +} + +impl<'a> EnvironmentApplierImpl for ChunkNoiseApplier<'a> { + type Env = ChunkNoiseState; + + fn fill_mut( + &mut self, + densities: &mut [f64], + function: &mut dyn MutableComponentFunctionImpl, + ) { + self.shared.index = 0; + for cell_y in (0..self.shared.vertical_cell_block_count).rev() { + self.shared.cell_block_pos.y = cell_y; + + for cell_x in 0..self.shared.horizontal_cell_block_count { + self.shared.cell_block_pos.x = cell_x; + + for cell_z in 0..self.shared.horizontal_cell_block_count { + self.shared.cell_block_pos.z = cell_z; + + densities[self.shared.index] = + function.sample_mut(&self.shared.create_noise_pos(), self.env()); + self.shared.index.add_assign(1); + } + } + } + } + + fn env(&mut self) -> &Self::Env { + self.shared + } + + fn cast_up(&mut self) -> &mut dyn ApplierImpl { + self + } +} + +impl<'a> ApplierImpl for ChunkNoiseApplier<'a> { + fn at(&mut self, index: usize) -> NoisePos { + let cell_block_z = index % self.shared.horizontal_cell_block_count as usize; + let xy_chunk = index / self.shared.horizontal_cell_block_count as usize; + let cell_block_x = xy_chunk % self.shared.horizontal_cell_block_count as usize; + let cell_block_y = self.shared.vertical_cell_block_count as usize + - 1 + - (xy_chunk / self.shared.horizontal_cell_block_count as usize); + + self.shared.cell_block_pos.x = cell_block_x as u8; + self.shared.cell_block_pos.y = cell_block_y as u8; + self.shared.cell_block_pos.z = cell_block_z as u8; + self.shared.index = index; + self.shared.create_noise_pos() + } + + fn fill(&mut self, densities: &mut [f64], function: &dyn ImmutableComponentFunctionImpl) { + self.shared.index = 0; + for cell_y in (0..self.shared.vertical_cell_block_count).rev() { + self.shared.cell_block_pos.y = cell_y; + + for cell_x in 0..self.shared.horizontal_cell_block_count { + self.shared.cell_block_pos.x = cell_x; + + for cell_z in 0..self.shared.horizontal_cell_block_count { + self.shared.cell_block_pos.z = cell_z; + + densities[self.shared.index] = function.sample(&self.shared.create_noise_pos()); + self.shared.index.add_assign(1); + } + } + } + } +} + +pub const CHUNK_DIM: u8 = 16; + +#[derive(PartialEq, Eq, Clone, Hash, Default)] +pub struct ChunkNoiseState { + cell_block_pos: Vector3, + start_cell_pos: Vector2, + start_block_pos: Vector3, + start_biome_pos: Vector2, + + height: u16, + vertical_cell_count: u16, + horizontal_cell_count: u8, + horizontal_cell_block_count: u8, + vertical_cell_block_count: u8, + horizontal_biome_end: u8, + minimum_cell_y: i8, + minimum_y: i8, + + is_interpolating: bool, + is_sampling_for_caches: bool, + + index: usize, + cache_once_unique_index: Wrapping, + sample_unique_index: Wrapping, +} + +impl DensityFunctionEnvironment for ChunkNoiseState {} + +impl ChunkNoiseState { + pub fn create_noise_pos(&self) -> NoisePos { + let cell_block_x = self.cell_block_pos.x; + let cell_block_y = self.cell_block_pos.y; + let cell_block_z = self.cell_block_pos.z; + + let start_block_x = self.start_block_pos.x; + let start_block_y = self.start_block_pos.y; + let start_block_z = self.start_block_pos.z; + + let x = start_block_x + cell_block_x as i32; + let y = start_block_y + cell_block_y as i32; + let z = start_block_z + cell_block_z as i32; + + //log::debug!("Sampling pos {} {} {}", x, y, z); + // TODO: Add blender + NoisePos::Chunk(ChunkNoisePos { + x, + y, + z, + //unique_id: self.unique_id, + }) + } +} + +pub struct ChunkNoiseDensityFunctions { + initial_density: Box>, + surface_height_estimate: HashMap, +} + +impl ChunkNoiseDensityFunctions { + pub fn estimate_surface_height( + &mut self, + shared: &ChunkNoiseState, + block_x: i32, + block_z: i32, + ) -> i32 { + let biome_aligned_x = biome_coords::to_block(biome_coords::from_block(block_x)); + let biome_aligned_z = biome_coords::to_block(biome_coords::from_block(block_z)); + let packed = chunk_pos::packed(&Vector2::new(biome_aligned_x, biome_aligned_z)); + + if let Some(estimate) = self.surface_height_estimate.get(&packed) { + *estimate + } else { + let estimate = self.calculate_height_estimate(shared, packed); + self.surface_height_estimate.insert(packed, estimate); + estimate + } + } + + fn calculate_height_estimate(&mut self, shared: &ChunkNoiseState, packed_pos: u64) -> i32 { + let x = chunk_pos::unpack_x(packed_pos); + let z = chunk_pos::unpack_z(packed_pos); + + for y in ((shared.minimum_y as i32)..=(shared.minimum_y as i32 + shared.height as i32)) + .rev() + .step_by(shared.vertical_cell_block_count as usize) + { + if self.initial_density.sample_mut( + &NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)), + shared, + ) > 0.390625f64 + { + return y; + } + } + + i32::MAX + } +} + +pub struct ChunkNoiseGenerator { + state_sampler: BlockStateSampler, + generation_shape: GenerationShape, + + shared: ChunkNoiseState, + //TODO: Handle without mutexs somehow + cell_caches: Box<[Arc>]>, + interpolators: Box<[Arc>]>, + density_functions: ChunkNoiseDensityFunctions, +} + +impl ChunkNoiseGenerator { + #[allow(clippy::too_many_arguments)] + pub fn new( + horizontal_cell_count: u8, + start_block_x: i32, + start_block_z: i32, + generation_shape: GenerationShape, + config: &NoiseConfig, + level_sampler: FluidLevelSampler, + aquifers: bool, + ore_veins: bool, + ) -> Self { + let start_cell_pos = Vector2::new( + floor_div( + start_block_x, + generation_shape.horizontal_cell_block_count() as i32, + ), + floor_div( + start_block_z, + generation_shape.horizontal_cell_block_count() as i32, + ), + ); + + let start_block_pos = Vector3::new(0, 0, 0); + let cell_block_pos = Vector3::new(0, 0, 0); + let biome_pos = Vector2::new( + biome_coords::from_block(start_block_x), + biome_coords::from_block(start_block_z), + ); + let is_interpolating = false; + let is_sampling = false; + let cache_once_unique_index = Wrapping(0); + let sample_unique_index = Wrapping(0); + let index = 0; + let horizontal_biome_end = biome_coords::from_block( + horizontal_cell_count * generation_shape.horizontal_cell_block_count(), + ); + + let vertical_cell_count = + generation_shape.height() / generation_shape.vertical_cell_block_count() as u16; + let minimum_cell_y = floor_div( + generation_shape.min_y(), + generation_shape.vertical_cell_block_count() as i8, + ); + let vertical_cell_block_count = generation_shape.vertical_cell_block_count(); + let horizontal_cell_block_count = generation_shape.horizontal_cell_block_count(); + + let shared = ChunkNoiseState { + cell_block_pos, + start_cell_pos, + start_block_pos, + start_biome_pos: biome_pos, + height: generation_shape.height(), + vertical_cell_block_count, + horizontal_cell_block_count, + vertical_cell_count, + horizontal_cell_count, + horizontal_biome_end, + minimum_cell_y, + minimum_y: generation_shape.min_y(), + is_interpolating, + is_sampling_for_caches: is_sampling, + index, + cache_once_unique_index, + sample_unique_index, + }; + + let functions = CachedFunctions { + caches: Vec::new(), + interpolators: Vec::new(), + cached_results: HashMap::new(), + }; + + // Convert router for this chunk + let original_router = config.router(); + + let mut converter = ChunkNoiseWrappedFunctionConverter::new(&shared, functions); + let router = original_router.convert(&mut converter); + + let final_density = router.final_density; + let vein_toggle = router.vein_toggle; + let vein_ridged = router.vein_ridged; + let vein_gap = router.vein_gap; + + // Create and convert aquifer density function + let converted_aquifer_density = match final_density + .wrapped_ref_from_box() + .add(BeardifierFunction::INSTANCE.into()) + { + ComponentReferenceImplementation::Mutable(owned) => MutableComponentReference( + Box::new(WrapperFunction::new(owned, WrapperType::CellCache)), + ) + .convert(&mut converter), + ComponentReferenceImplementation::Shared(shared) => { + SharedComponentReference(Arc::new(WrapperFunction::< + ChunkNoiseState, + SharedComponentReference, + >::new( + shared, WrapperType::CellCache + ))) + .convert(&mut converter) + } + }; + + let functions = converter.consume(); + + let aquifer_sampler = if aquifers { + let section_x = section_coords::block_to_section(start_block_x); + let section_z = section_coords::block_to_section(start_block_z); + AquiferSampler::Aquifier(WorldAquiferSampler::new( + Vector2::new(section_x, section_z), + router.barrier, + router.fluid_level_floodedness, + router.fluid_level_spread, + router.lava, + router.erosion, + router.depth, + converted_aquifer_density.boxed(), + config.aquifer_deriver(), + generation_shape.min_y(), + generation_shape.height(), + level_sampler, + )) + } else { + AquiferSampler::SeaLevel(SeaLevelAquiferSampler::new( + level_sampler, + converted_aquifer_density.boxed(), + )) + }; + + let mut samplers = vec![BlockStateSampler::Aquifer(aquifer_sampler)]; + + if ore_veins { + let ore_sampler = + OreVeinSampler::new(vein_toggle, vein_ridged, vein_gap, config.ore_deriver()); + samplers.push(BlockStateSampler::Ore(ore_sampler)); + }; + + let state_sampler = BlockStateSampler::Chained(ChainedBlockStateSampler::new(samplers)); + + let density_functions = ChunkNoiseDensityFunctions { + initial_density: router.internal_density, + surface_height_estimate: HashMap::new(), + }; + + Self { + state_sampler, + generation_shape, + shared, + cell_caches: functions.caches.into(), + interpolators: functions.interpolators.into(), + density_functions, + } + } + + pub fn stop_interpolation(&mut self) { + assert!(self.shared.is_interpolating); + self.shared.is_interpolating = false; + } + + pub fn sample_start_density(&mut self) { + assert!(!self.shared.is_interpolating); + self.shared.is_interpolating = true; + self.shared.sample_unique_index.set_zero(); + self.sample_density(true, self.shared.start_cell_pos.x); + } + + pub fn sample_end_density(&mut self, cell_x: u8) { + self.sample_density(false, self.shared.start_cell_pos.x + cell_x as i32 + 1); + self.shared.start_block_pos.x = (self.shared.start_cell_pos.x + cell_x as i32) + * self.horizontal_cell_block_count() as i32; + } + + fn sample_density(&mut self, start: bool, current_x: i32) { + self.shared.start_block_pos.x = current_x * self.horizontal_cell_block_count() as i32; + self.shared.cell_block_pos.x = 0; + + for cell_z in 0..=self.horizontal_cell_block_count() { + let current_z = self.shared.start_cell_pos.z + cell_z as i32; + self.shared.start_block_pos.z = current_z * self.horizontal_cell_block_count() as i32; + self.shared.cell_block_pos.z = 0; + + self.shared.cache_once_unique_index.add_assign(1); + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + + let mut y_buf = vec![0f64; self.shared.vertical_cell_count as usize + 1]; + + let mut applier = ChunkNoiseInterpolationApplier::new(&mut self.shared); + interpolator.fill_mut(&mut y_buf, &mut applier); + + let interp_buf = if start { + let start_index = + ChunkInterpolatorFunction::yz_to_buf_index(0, cell_z, &self.shared); + &mut interpolator.start_buf + [start_index..=start_index + self.shared.vertical_cell_count as usize] + } else { + let start_index = + ChunkInterpolatorFunction::yz_to_buf_index(0, cell_z, &self.shared); + &mut interpolator.end_buf + [start_index..=start_index + self.shared.vertical_cell_count as usize] + }; + + interp_buf.copy_from_slice(&y_buf); + } + } + self.shared.cache_once_unique_index.add_assign(1); + } + + pub fn interpolate_y(&mut self, block_y: i32, delta: f64) { + self.shared.cell_block_pos.y = (block_y - self.shared.start_block_pos.y) as u8; + + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + interpolator.interpolate_y(delta); + } + } + + pub fn interpolate_x(&mut self, block_x: i32, delta: f64) { + self.shared.cell_block_pos.x = (block_x - self.shared.start_block_pos.x) as u8; + + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + + interpolator.interpolate_x(delta); + } + } + + pub fn interpolate_z(&mut self, block_z: i32, delta: f64) { + self.shared.cell_block_pos.z = (block_z - self.shared.start_block_pos.z) as u8; + self.shared.sample_unique_index.add_assign(1); + + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + + interpolator.interpolate_z(delta); + } + } + + pub fn swap_buffers(&self) { + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + + interpolator.swap_buffers(); + } + } + + pub fn on_sampled_cell_corners(&mut self, cell_y: u16, cell_z: u8) { + for interpolator in &self.interpolators { + let mut interpolator = interpolator.lock(); + + interpolator.on_sampled_cell_corners(cell_y, cell_z, &self.shared); + } + + self.shared.is_sampling_for_caches = true; + self.shared.start_block_pos.y = (cell_y as i32 + self.minimum_cell_y() as i32) + * self.vertical_cell_block_count() as i32; + self.shared.start_block_pos.z = (cell_z as i32 + self.shared.start_cell_pos.z) + * self.horizontal_cell_block_count() as i32; + self.shared.cache_once_unique_index.add_assign(1); + + for cell_cache in &self.cell_caches { + let mut cell_cache = cell_cache.lock(); + + let mut new_cache = ChunkCellCacheFunction::create_cache(&self.shared); + let mut applier = ChunkNoiseApplier::new(&mut self.shared); + cell_cache.delegate.fill_mut(&mut new_cache, &mut applier); + cell_cache.cache = new_cache.into(); + } + + self.shared.cache_once_unique_index.add_assign(1); + self.shared.is_sampling_for_caches = false; + } + + pub fn sample_block_state(&mut self) -> Option { + self.state_sampler.sample( + &self.shared.create_noise_pos(), + &self.shared, + &mut self.density_functions, + ) + } + + pub fn horizontal_cell_block_count(&self) -> u8 { + self.generation_shape.horizontal_cell_block_count() + } + + pub fn vertical_cell_block_count(&self) -> u8 { + self.generation_shape.vertical_cell_block_count() + } + + pub fn min_y(&self) -> i8 { + self.generation_shape.min_y() + } + + pub fn minimum_cell_y(&self) -> i8 { + self.generation_shape.min_y() / self.generation_shape.vertical_cell_block_count() as i8 + } + + pub fn height(&self) -> u16 { + self.generation_shape.height() + } +} diff --git a/pumpkin-world/src/world_gen/generation_shapes.rs b/pumpkin-world/src/world_gen/generation_shapes.rs new file mode 100644 index 000000000..e0562609a --- /dev/null +++ b/pumpkin-world/src/world_gen/generation_shapes.rs @@ -0,0 +1,92 @@ +use super::{biome_coords::to_block, height_limit::HeightLimitViewImpl}; + +pub struct GenerationShape { + min_y: i8, + height: u16, + /// Max: 4 + horizontal_size: u8, + /// Max: 4 + vertical_size: u8, +} + +impl GenerationShape { + pub const SURFACE: Self = Self { + min_y: -64, + height: 384, + horizontal_size: 1, + vertical_size: 2, + }; + pub const NETHER: Self = Self { + min_y: 0, + height: 128, + horizontal_size: 1, + vertical_size: 2, + }; + pub const END: Self = Self { + min_y: 0, + height: 128, + horizontal_size: 2, + vertical_size: 1, + }; + pub const CAVES: Self = Self { + min_y: -64, + height: 192, + horizontal_size: 1, + vertical_size: 2, + }; + pub const FLOATING_ISLANDS: Self = Self { + min_y: 0, + height: 256, + horizontal_size: 2, + vertical_size: 1, + }; + + pub fn vertical_cell_block_count(&self) -> u8 { + to_block(self.vertical_size) + } + + pub fn horizontal_cell_block_count(&self) -> u8 { + to_block(self.horizontal_size) + } + + pub fn min_y(&self) -> i8 { + self.min_y + } + + pub fn height(&self) -> u16 { + self.height + } + + pub fn max_y(&self) -> u16 { + if self.min_y >= 0 { + self.height + self.min_y as u16 + } else { + self.height - self.min_y.unsigned_abs() as u16 + } + } + + pub fn trim_height(&self, limit: &dyn HeightLimitViewImpl) -> Self { + let new_min = self.min_y.max(limit.bottom_y()); + + let this_top = if self.min_y >= 0 { + self.height + self.min_y as u16 + } else { + self.height - self.min_y.unsigned_abs() as u16 + }; + + let new_top = this_top.min(limit.top_y()); + + let new_height = if new_min >= 0 { + new_top - new_min as u16 + } else { + new_top + new_min.unsigned_abs() as u16 + }; + + Self { + min_y: new_min, + height: new_height, + horizontal_size: self.horizontal_size, + vertical_size: self.vertical_size, + } + } +} diff --git a/pumpkin-world/src/world_gen/generator.rs b/pumpkin-world/src/world_gen/generator.rs index d035842aa..8a0120c78 100644 --- a/pumpkin-world/src/world_gen/generator.rs +++ b/pumpkin-world/src/world_gen/generator.rs @@ -1,5 +1,6 @@ use noise::Perlin; use pumpkin_core::math::vector2::Vector2; +use pumpkin_core::math::vector3::Vector3; use crate::biome::Biome; use crate::block::block_state::BlockState; @@ -19,12 +20,18 @@ pub(crate) trait BiomeGenerator: Sync + Send { fn generate_biome(&self, at: XZBlockCoordinates) -> Biome; } -#[expect(dead_code)] pub(crate) trait TerrainGenerator: Sync + Send { fn prepare_chunk(&self, at: &Vector2); + fn clean_chunk(&self, at: &Vector2); + /// Is static - fn generate_block(&self, at: BlockCoordinates, biome: Biome) -> BlockState; + fn generate_block( + &self, + chunk_pos: &Vector2, + at: Vector3, + biome: Biome, + ) -> BlockState; } pub(crate) trait PerlinTerrainGenerator: Sync + Send { diff --git a/pumpkin-world/src/world_gen/height_limit.rs b/pumpkin-world/src/world_gen/height_limit.rs index beb4dd043..7b223101f 100644 --- a/pumpkin-world/src/world_gen/height_limit.rs +++ b/pumpkin-world/src/world_gen/height_limit.rs @@ -1,5 +1,7 @@ use enum_dispatch::enum_dispatch; +use super::section_coords; + #[enum_dispatch] pub enum HeightLimitView { Standard(StandardHeightLimitView), @@ -7,60 +9,69 @@ pub enum HeightLimitView { #[enum_dispatch(HeightLimitView)] pub trait HeightLimitViewImpl { - fn height(&self) -> i32; + fn height(&self) -> u16; - fn bottom_y(&self) -> i32; + fn bottom_y(&self) -> i8; - fn top_y(&self) -> i32 { - self.bottom_y() + self.height() + fn top_y(&self) -> u16 { + if self.bottom_y() >= 0 { + self.height() + self.bottom_y() as u16 + } else { + self.height() - self.bottom_y().unsigned_abs() as u16 + } } - fn vertical_section_count(&self) -> i32 { - self.top_section_coord() - self.bottom_section_coord() + fn vertical_section_count(&self) -> u16 { + let bottom_section = self.bottom_section_coord(); + if bottom_section >= 0 { + self.top_section_coord() - self.bottom_section_coord() as u16 + } else { + self.top_section_coord() + self.bottom_section_coord().unsigned_abs() as u16 + } } - fn bottom_section_coord(&self) -> i32 { - self.bottom_y() >> 4 + fn bottom_section_coord(&self) -> i8 { + section_coords::block_to_section(self.bottom_y()) } - fn top_section_coord(&self) -> i32 { - ((self.top_y() - 1) >> 4) + 1 + fn top_section_coord(&self) -> u16 { + section_coords::block_to_section(self.top_y() - 1) + 1 } - fn out_of_height(&self, height: i32) -> bool { - height < self.bottom_y() || height >= self.top_y() + fn out_of_height(&self, height: i16) -> bool { + height < self.bottom_y() as i16 || height as i32 >= self.top_y() as i32 } - fn section_index(&self, y: i32) -> i32 { - self.section_coord_to_index(y >> 4) + fn section_index(&self, y: i32) -> usize { + self.section_coord_to_index(section_coords::block_to_section(y)) } - fn section_coord_to_index(&self, coord: i32) -> i32 { - coord - self.bottom_section_coord() + fn section_coord_to_index(&self, coord: i32) -> usize { + (coord - self.bottom_section_coord() as i32) as usize } - fn section_index_to_coord(&self, index: i32) -> i32 { - index + self.bottom_section_coord() + fn section_index_to_coord(&self, index: usize) -> i32 { + index as i32 + self.bottom_section_coord() as i32 } } pub struct StandardHeightLimitView { - height: i32, - bottom_y: i32, + height: u16, + bottom_y: i8, } impl StandardHeightLimitView { - pub fn new(height: i32, bottom_y: i32) -> Self { + pub fn new(height: u16, bottom_y: i8) -> Self { Self { height, bottom_y } } } impl HeightLimitViewImpl for StandardHeightLimitView { - fn height(&self) -> i32 { + fn height(&self) -> u16 { self.height } - fn bottom_y(&self) -> i32 { + fn bottom_y(&self) -> i8 { self.bottom_y } } diff --git a/pumpkin-world/src/world_gen/implementation/mod.rs b/pumpkin-world/src/world_gen/implementation/mod.rs index 7aa11a83b..840f531b6 100644 --- a/pumpkin-world/src/world_gen/implementation/mod.rs +++ b/pumpkin-world/src/world_gen/implementation/mod.rs @@ -1,2 +1,3 @@ pub mod overworld; pub mod superflat; +pub mod test; diff --git a/pumpkin-world/src/world_gen/implementation/superflat.rs b/pumpkin-world/src/world_gen/implementation/superflat.rs index eb773f3a7..44fc8aece 100644 --- a/pumpkin-world/src/world_gen/implementation/superflat.rs +++ b/pumpkin-world/src/world_gen/implementation/superflat.rs @@ -3,7 +3,7 @@ use pumpkin_core::math::vector2::Vector2; use crate::{ biome::Biome, block::block_state::BlockState, - coordinates::{BlockCoordinates, XZBlockCoordinates}, + coordinates::XZBlockCoordinates, world_gen::{ generator::{BiomeGenerator, GeneratorInit, TerrainGenerator}, generic_generator::GenericGenerator, @@ -39,7 +39,19 @@ impl GeneratorInit for SuperflatTerrainGenerator { impl TerrainGenerator for SuperflatTerrainGenerator { fn prepare_chunk(&self, _at: &Vector2) {} + fn clean_chunk(&self, _at: &Vector2) {} + // TODO allow specifying which blocks should be at which height in the config. + fn generate_block( + &self, + _chunk_pos: &Vector2, + _at: pumpkin_core::math::vector3::Vector3, + _biome: Biome, + ) -> BlockState { + todo!() + } + + /* fn generate_block(&self, at: BlockCoordinates, _: Biome) -> BlockState { match *at.y { -64 => BlockState::new("minecraft:bedrock").unwrap(), @@ -48,4 +60,5 @@ impl TerrainGenerator for SuperflatTerrainGenerator { _ => BlockState::AIR, } } + */ } diff --git a/pumpkin-world/src/world_gen/implementation/test.rs b/pumpkin-world/src/world_gen/implementation/test.rs new file mode 100644 index 000000000..5be92446a --- /dev/null +++ b/pumpkin-world/src/world_gen/implementation/test.rs @@ -0,0 +1,145 @@ +use std::{num::Wrapping, ops::SubAssign}; + +use dashmap::{DashMap, Entry}; +use num_traits::Zero; +use pumpkin_core::math::{vector2::Vector2, vector3::Vector3}; + +use crate::{ + biome::Biome, + block::block_state::BlockState, + chunk::{ChunkBlocks, ChunkData}, + coordinates::{ + ChunkRelativeBlockCoordinates, ChunkRelativeXZBlockCoordinates, XZBlockCoordinates, + }, + world_gen::{ + generator::{BiomeGenerator, GeneratorInit, TerrainGenerator}, + proto_chunk::ProtoChunk, + Seed, WorldGenerator, + }, + WORLD_LOWEST_Y, WORLD_MAX_Y, +}; + +pub struct TestGenerator { + biome_generator: B, + terrain_generator: T, +} + +impl GeneratorInit + for TestGenerator +{ + fn new(seed: Seed) -> Self { + Self { + biome_generator: B::new(seed), + terrain_generator: T::new(seed), + } + } +} + +impl WorldGenerator for TestGenerator { + fn generate_chunk(&self, at: Vector2) -> ChunkData { + let mut blocks = ChunkBlocks::default(); + self.terrain_generator.prepare_chunk(&at); + + for x in 0..16u8 { + for z in 0..16u8 { + let biome = self.biome_generator.generate_biome( + ChunkRelativeXZBlockCoordinates { + x: x.into(), + z: z.into(), + } + .with_chunk_coordinates(at), + ); + + // TODO: This can be chunk specific + for y in (WORLD_LOWEST_Y..WORLD_MAX_Y).rev() { + let coordinates = ChunkRelativeBlockCoordinates { + x: x.into(), + y: y.into(), + z: z.into(), + }; + + let block = self.terrain_generator.generate_block( + &at, + Vector3::new(x.into(), y.into(), z.into()), + biome, + ); + + //println!("{:?}: {:?}", coordinates, block); + blocks.set_block(coordinates, block.state_id); + } + } + } + + self.terrain_generator.clean_chunk(&at); + ChunkData { + blocks, + position: at, + } + } +} + +pub(crate) struct TestBiomeGenerator {} + +impl GeneratorInit for TestBiomeGenerator { + fn new(_: Seed) -> Self { + Self {} + } +} + +impl BiomeGenerator for TestBiomeGenerator { + // TODO make generic over Biome and allow changing the Biome in the config. + fn generate_biome(&self, _: XZBlockCoordinates) -> Biome { + Biome::Plains + } +} + +pub(crate) struct TestTerrainGenerator { + chunks: DashMap, (ProtoChunk, Wrapping)>, +} + +impl GeneratorInit for TestTerrainGenerator { + fn new(_: Seed) -> Self { + Self { + chunks: DashMap::new(), + } + } +} + +impl TerrainGenerator for TestTerrainGenerator { + fn prepare_chunk(&self, at: &Vector2) { + let entry = self.chunks.entry(*at); + if let Entry::Vacant(entry) = entry { + let mut proto_chunk = ProtoChunk::new(*at); + //let inst = std::time::Instant::now(); + //println!("Populating chunk: {:?}", at); + proto_chunk.populate_noise(); + //println!("Done populating chunk: {:?} ({:?})", at, inst.elapsed()); + entry.insert((proto_chunk, Wrapping(1))); + } + } + + fn clean_chunk(&self, at: &Vector2) { + let entry = self.chunks.entry(*at); + if let Entry::Occupied(mut entry) = entry { + let (_, count) = entry.get_mut(); + count.sub_assign(1); + if count.is_zero() { + entry.remove(); + } + } + } + + // TODO allow specifying which blocks should be at which height in the config. + fn generate_block( + &self, + chunk_pos: &Vector2, + local_pos: Vector3, + _: Biome, + ) -> BlockState { + if let Some(entry) = self.chunks.get(chunk_pos) { + entry.0.get_block_state(&local_pos) + } else { + panic!("Chunk needs to exist") + } + } +} diff --git a/pumpkin-world/src/world_gen/mod.rs b/pumpkin-world/src/world_gen/mod.rs index fbf0490ac..5c2ff4e37 100644 --- a/pumpkin-world/src/world_gen/mod.rs +++ b/pumpkin-world/src/world_gen/mod.rs @@ -1,25 +1,51 @@ #![allow(dead_code)] mod blender; +pub mod chunk_noise; +pub mod generation_shapes; mod generator; mod generic_generator; pub mod height_limit; mod implementation; -mod noise; +pub mod noise; mod positions; -mod proto_chunk; -mod sampler; +pub mod proto_chunk; +pub mod sampler; mod seed; pub use generator::WorldGenerator; -use implementation::overworld::biome::plains::PlainsGenerator; +use implementation::{ + //overworld::biome::plains::PlainsGenerator, + test::{TestBiomeGenerator, TestGenerator, TestTerrainGenerator}, +}; pub use seed::Seed; use generator::GeneratorInit; pub fn get_world_gen(seed: Seed) -> Box { // TODO decide which WorldGenerator to pick based on config. - Box::new(PlainsGenerator::new(seed)) + //Box::new(PlainsGenerator::new(seed)) + Box::new(TestGenerator::::new(seed)) +} + +pub mod section_coords { + use num_traits::PrimInt; + + #[inline] + pub fn block_to_section(coord: T) -> T + where + T: PrimInt, + { + coord >> 4 + } + + #[inline] + pub fn section_to_block(coord: T) -> T + where + T: PrimInt, + { + coord << 4 + } } pub mod biome_coords { diff --git a/pumpkin-world/src/world_gen/noise/config.rs b/pumpkin-world/src/world_gen/noise/config.rs new file mode 100644 index 000000000..c3dc3c18f --- /dev/null +++ b/pumpkin-world/src/world_gen/noise/config.rs @@ -0,0 +1,573 @@ +use std::{collections::HashMap, sync::Arc}; + +use pumpkin_core::random::{ + legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomDeriver, RandomGenerator, RandomImpl, +}; + +use super::{ + density::{ + component_functions::{ + ComponentReferenceImplementation, ConversionResultPre, ConverterEnvironment, + ConverterImpl, NoEnvironment, OwnedConverterEnvironment, + }, + end::EndIslandFunction, + noise::InternalNoise, + }, + perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler}, + router::BaseRouter, +}; + +struct LegacyChunkNoiseVisitor { + random_deriver: RandomDeriver, + seed: u64, + + noise_map: HashMap>, +} + +impl LegacyChunkNoiseVisitor { + fn new(random_deriver: RandomDeriver, seed: u64) -> Self { + Self { + random_deriver, + seed, + noise_map: HashMap::new(), + } + } + + fn consume(self) -> HashMap> { + self.noise_map + } + + fn create_random(seed: u64) -> RandomGenerator { + RandomGenerator::Legacy(LegacyRand::from_seed(seed.wrapping_add(seed))) + } + + fn create_or_get_noise_sampler( + &mut self, + params: &'static DoublePerlinNoiseParameters, + ) -> Arc { + //TODO: Handle legacy noise case + + let id = params.id(); + if let Some(cached) = self.noise_map.get(id) { + cached.clone() + } else { + let mut rand = self.random_deriver.split_string(id); + let sampler = DoublePerlinNoiseSampler::new(&mut rand, params, false); + let key = id.to_string(); + let internal_noise = Arc::new(InternalNoise::new(params, Some(sampler))); + self.noise_map.insert(key, internal_noise.clone()); + internal_noise + } + } +} + +impl ConverterImpl for LegacyChunkNoiseVisitor { + fn convert_noise(&mut self, noise: &Arc) -> Option> { + Some(self.create_or_get_noise_sampler(noise.parameters)) + } + + fn convert_env_pre_internal( + &mut self, + component: ConverterEnvironment, + ) -> ConversionResultPre { + match component { + ConverterEnvironment::End => { + ConversionResultPre::New(EndIslandFunction::new(self.seed).into()) + } + ConverterEnvironment::InterpolatedNoise(func) => { + let mut random = self.random_deriver.split_string("minecraft:terrain"); + ConversionResultPre::New(func.copy_with_random(&mut random).into()) + } + _ => ConversionResultPre::Default, + } + } + + fn converts_post_internal(&mut self, _component: ConverterEnvironment) -> bool { + false + } + + fn convert_env_post_internal( + &mut self, + _component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation { + unreachable!() + } +} + +pub struct NoiseConfig { + random_deriver: RandomDeriver, + aquifer_deriver: RandomDeriver, + ore_deriver: RandomDeriver, + router: BaseRouter, + noise_map: HashMap>, +} + +impl NoiseConfig { + pub fn new(seed: u64, base_router: &BaseRouter) -> Self { + // TODO: Use other random providers? + let random_deriver = RandomDeriver::Xoroshiro(Xoroshiro::from_seed(seed).next_splitter()); + let aquifer_deriver = random_deriver + .split_string("minecraft:aquifer") + .next_splitter(); + let ore_deriver = random_deriver.split_string("minecraft:ore").next_splitter(); + + // TODO: Yuck + let (router, noise_map) = { + let deriver = random_deriver.clone(); + let mut visitor = LegacyChunkNoiseVisitor::new(deriver, seed); + let router = base_router.convert_assert_shared(&mut visitor); + (router, visitor.consume()) + }; + + Self { + random_deriver, + aquifer_deriver, + ore_deriver, + router, + noise_map, + } + } + + pub fn router(&self) -> &BaseRouter { + &self.router + } + + pub fn ore_deriver(&self) -> RandomDeriver { + self.ore_deriver.clone() + } + + pub fn aquifer_deriver(&self) -> RandomDeriver { + self.aquifer_deriver.clone() + } +} + +#[cfg(test)] +mod test { + use crate::world_gen::noise::{ + config::NoiseConfig, + density::{NoisePos, UnblendedNoisePos}, + router::OVERWORLD_NOISE_ROUTER, + }; + + #[test] + fn test_normal_surface_noisified() { + let config = NoiseConfig::new(0, &OVERWORLD_NOISE_ROUTER); + let router = config.router; + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 0, 0)); + assert_eq!(router.barrier.sample(pos), -0.5400227274000677f64); + assert_eq!( + router.fluid_level_floodedness.sample(pos), + -0.4709571987777473f64 + ); + assert_eq!( + router.fluid_level_spread.sample(pos), + -0.057269139961514365f64 + ); + assert_eq!(router.lava.sample(pos), -0.16423603877333556f64); + assert_eq!(router.temperature.sample(pos), 0.1182379898645608f64); + assert_eq!(router.vegetation.sample(pos), -0.0013601677416915584f64); + assert_eq!(router.continents.sample(pos), -0.008171952121206487f64); + assert_eq!(router.erosion.sample(pos), -0.10391073889243099f64); + assert_eq!(router.depth.sample(pos), 0.411882147192955f64); + assert_eq!(router.ridges.sample(pos), 0.011110323612534296f64); + assert_eq!(router.internal_density.sample(pos), 7.668311608489972f64); + assert_eq!(router.final_density.sample(pos), 0.15719144891255343f64); + + let values = [ + ((-100, -200, -100), 0.0f64), + ((-100, -200, -50), 0.0f64), + ((-100, -200, 0), 0.0f64), + ((-100, -200, 50), 0.0f64), + ((-100, -200, 100), 0.0f64), + ((-100, -100, -100), 0.0f64), + ((-100, -100, -50), 0.0f64), + ((-100, -100, 0), 0.0f64), + ((-100, -100, 50), 0.0f64), + ((-100, -100, 100), 0.0f64), + ((-100, 0, -100), 0.3462291472930333f64), + ((-100, 0, -50), 0.2340445906392791f64), + ((-100, 0, 0), -0.028825983399710407f64), + ((-100, 0, 50), -0.16684760357850822f64), + ((-100, 0, 100), -0.1843465939249143f64), + ((-100, 100, -100), 0.0f64), + ((-100, 100, -50), 0.0f64), + ((-100, 100, 0), 0.0f64), + ((-100, 100, 50), 0.0f64), + ((-100, 100, 100), 0.0f64), + ((-100, 200, -100), 0.0f64), + ((-100, 200, -50), 0.0f64), + ((-100, 200, 0), 0.0f64), + ((-100, 200, 50), 0.0f64), + ((-100, 200, 100), 0.0f64), + ((-50, -200, -100), 0.0f64), + ((-50, -200, -50), 0.0f64), + ((-50, -200, 0), 0.0f64), + ((-50, -200, 50), 0.0f64), + ((-50, -200, 100), 0.0f64), + ((-50, -100, -100), 0.0f64), + ((-50, -100, -50), 0.0f64), + ((-50, -100, 0), 0.0f64), + ((-50, -100, 50), 0.0f64), + ((-50, -100, 100), 0.0f64), + ((-50, 0, -100), 0.05757810206373369f64), + ((-50, 0, -50), 0.0014520730707135465f64), + ((-50, 0, 0), -0.024149735708339466f64), + ((-50, 0, 50), 0.1287619466526521f64), + ((-50, 0, 100), 0.25507593901831094f64), + ((-50, 100, -100), 0.0f64), + ((-50, 100, -50), 0.0f64), + ((-50, 100, 0), 0.0f64), + ((-50, 100, 50), 0.0f64), + ((-50, 100, 100), 0.0f64), + ((-50, 200, -100), 0.0f64), + ((-50, 200, -50), 0.0f64), + ((-50, 200, 0), 0.0f64), + ((-50, 200, 50), 0.0f64), + ((-50, 200, 100), 0.0f64), + ((0, -200, -100), 0.0f64), + ((0, -200, -50), 0.0f64), + ((0, -200, 0), 0.0f64), + ((0, -200, 50), 0.0f64), + ((0, -200, 100), 0.0f64), + ((0, -100, -100), 0.0f64), + ((0, -100, -50), 0.0f64), + ((0, -100, 0), 0.0f64), + ((0, -100, 50), 0.0f64), + ((0, -100, 100), 0.0f64), + ((0, 0, -100), -0.24030906682975775f64), + ((0, 0, -50), -0.24705110006127165f64), + ((0, 0, 0), -0.06643453056181631f64), + ((0, 0, 50), 0.25318680526509063f64), + ((0, 0, 100), 0.48257536249146743f64), + ((0, 100, -100), 0.0f64), + ((0, 100, -50), 0.0f64), + ((0, 100, 0), 0.0f64), + ((0, 100, 50), 0.0f64), + ((0, 100, 100), 0.0f64), + ((0, 200, -100), 0.0f64), + ((0, 200, -50), 0.0f64), + ((0, 200, 0), 0.0f64), + ((0, 200, 50), 0.0f64), + ((0, 200, 100), 0.0f64), + ((50, -200, -100), 0.0f64), + ((50, -200, -50), 0.0f64), + ((50, -200, 0), 0.0f64), + ((50, -200, 50), 0.0f64), + ((50, -200, 100), 0.0f64), + ((50, -100, -100), 0.0f64), + ((50, -100, -50), 0.0f64), + ((50, -100, 0), 0.0f64), + ((50, -100, 50), 0.0f64), + ((50, -100, 100), 0.0f64), + ((50, 0, -100), 0.035583298926324954f64), + ((50, 0, -50), -0.07225351839505538f64), + ((50, 0, 0), -0.03474107481998612f64), + ((50, 0, 50), 0.12616421777330467f64), + ((50, 0, 100), 0.35414843965758613f64), + ((50, 100, -100), 0.0f64), + ((50, 100, -50), 0.0f64), + ((50, 100, 0), 0.0f64), + ((50, 100, 50), 0.0f64), + ((50, 100, 100), 0.0f64), + ((50, 200, -100), 0.0f64), + ((50, 200, -50), 0.0f64), + ((50, 200, 0), 0.0f64), + ((50, 200, 50), 0.0f64), + ((50, 200, 100), 0.0f64), + ((100, -200, -100), 0.0f64), + ((100, -200, -50), 0.0f64), + ((100, -200, 0), 0.0f64), + ((100, -200, 50), 0.0f64), + ((100, -200, 100), 0.0f64), + ((100, -100, -100), 0.0f64), + ((100, -100, -50), 0.0f64), + ((100, -100, 0), 0.0f64), + ((100, -100, 50), 0.0f64), + ((100, -100, 100), 0.0f64), + ((100, 0, -100), 0.4151489417623382f64), + ((100, 0, -50), 0.2092632456905039f64), + ((100, 0, 0), -0.009920164828456044f64), + ((100, 0, 50), -0.14997295538707048f64), + ((100, 0, 100), -0.05777616780034325f64), + ((100, 100, -100), 0.0f64), + ((100, 100, -50), 0.0f64), + ((100, 100, 0), 0.0f64), + ((100, 100, 50), 0.0f64), + ((100, 100, 100), 0.0f64), + ((100, 200, -100), 0.0f64), + ((100, 200, -50), 0.0f64), + ((100, 200, 0), 0.0f64), + ((100, 200, 50), 0.0f64), + ((100, 200, 100), 0.0f64), + ]; + for ((x, y, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)); + assert_eq!(router.vein_toggle.sample(pos), value); + } + + let values = [ + ((-100, -200, -100), -0.07999999821186066f64), + ((-100, -200, -50), -0.07999999821186066f64), + ((-100, -200, 0), -0.07999999821186066f64), + ((-100, -200, 50), -0.07999999821186066f64), + ((-100, -200, 100), -0.07999999821186066f64), + ((-100, -100, -100), -0.07999999821186066f64), + ((-100, -100, -50), -0.07999999821186066f64), + ((-100, -100, 0), -0.07999999821186066f64), + ((-100, -100, 50), -0.07999999821186066f64), + ((-100, -100, 100), -0.07999999821186066f64), + ((-100, 0, -100), 0.20661121715107683f64), + ((-100, 0, -50), 0.13701288573667827f64), + ((-100, 0, 0), 0.7331011623931737f64), + ((-100, 0, 50), 0.5887875159446838f64), + ((-100, 0, 100), 0.022846022407350147f64), + ((-100, 100, -100), -0.07999999821186066f64), + ((-100, 100, -50), -0.07999999821186066f64), + ((-100, 100, 0), -0.07999999821186066f64), + ((-100, 100, 50), -0.07999999821186066f64), + ((-100, 100, 100), -0.07999999821186066f64), + ((-100, 200, -100), -0.07999999821186066f64), + ((-100, 200, -50), -0.07999999821186066f64), + ((-100, 200, 0), -0.07999999821186066f64), + ((-100, 200, 50), -0.07999999821186066f64), + ((-100, 200, 100), -0.07999999821186066f64), + ((-50, -200, -100), -0.07999999821186066f64), + ((-50, -200, -50), -0.07999999821186066f64), + ((-50, -200, 0), -0.07999999821186066f64), + ((-50, -200, 50), -0.07999999821186066f64), + ((-50, -200, 100), -0.07999999821186066f64), + ((-50, -100, -100), -0.07999999821186066f64), + ((-50, -100, -50), -0.07999999821186066f64), + ((-50, -100, 0), -0.07999999821186066f64), + ((-50, -100, 50), -0.07999999821186066f64), + ((-50, -100, 100), -0.07999999821186066f64), + ((-50, 0, -100), 0.35588447391786027f64), + ((-50, 0, -50), 0.1829719810187267f64), + ((-50, 0, 0), 0.08704696157012648f64), + ((-50, 0, 50), 0.1044941912836557f64), + ((-50, 0, 100), 0.5929743688753312f64), + ((-50, 100, -100), -0.07999999821186066f64), + ((-50, 100, -50), -0.07999999821186066f64), + ((-50, 100, 0), -0.07999999821186066f64), + ((-50, 100, 50), -0.07999999821186066f64), + ((-50, 100, 100), -0.07999999821186066f64), + ((-50, 200, -100), -0.07999999821186066f64), + ((-50, 200, -50), -0.07999999821186066f64), + ((-50, 200, 0), -0.07999999821186066f64), + ((-50, 200, 50), -0.07999999821186066f64), + ((-50, 200, 100), -0.07999999821186066f64), + ((0, -200, -100), -0.07999999821186066f64), + ((0, -200, -50), -0.07999999821186066f64), + ((0, -200, 0), -0.07999999821186066f64), + ((0, -200, 50), -0.07999999821186066f64), + ((0, -200, 100), -0.07999999821186066f64), + ((0, -100, -100), -0.07999999821186066f64), + ((0, -100, -50), -0.07999999821186066f64), + ((0, -100, 0), -0.07999999821186066f64), + ((0, -100, 50), -0.07999999821186066f64), + ((0, -100, 100), -0.07999999821186066f64), + ((0, 0, -100), 0.3531476519454157f64), + ((0, 0, -50), 0.15649178293218172f64), + ((0, 0, 0), 0.5716365265208109f64), + ((0, 0, 50), 0.28359279788952346f64), + ((0, 0, 100), 0.37225938767638495f64), + ((0, 100, -100), -0.07999999821186066f64), + ((0, 100, -50), -0.07999999821186066f64), + ((0, 100, 0), -0.07999999821186066f64), + ((0, 100, 50), -0.07999999821186066f64), + ((0, 100, 100), -0.07999999821186066f64), + ((0, 200, -100), -0.07999999821186066f64), + ((0, 200, -50), -0.07999999821186066f64), + ((0, 200, 0), -0.07999999821186066f64), + ((0, 200, 50), -0.07999999821186066f64), + ((0, 200, 100), -0.07999999821186066f64), + ((50, -200, -100), -0.07999999821186066f64), + ((50, -200, -50), -0.07999999821186066f64), + ((50, -200, 0), -0.07999999821186066f64), + ((50, -200, 50), -0.07999999821186066f64), + ((50, -200, 100), -0.07999999821186066f64), + ((50, -100, -100), -0.07999999821186066f64), + ((50, -100, -50), -0.07999999821186066f64), + ((50, -100, 0), -0.07999999821186066f64), + ((50, -100, 50), -0.07999999821186066f64), + ((50, -100, 100), -0.07999999821186066f64), + ((50, 0, -100), 0.1733462217252416f64), + ((50, 0, -50), 0.33464400306517067f64), + ((50, 0, 0), 0.2621039147343691f64), + ((50, 0, 50), 0.15279071012957127f64), + ((50, 0, 100), 0.4107100561510984f64), + ((50, 100, -100), -0.07999999821186066f64), + ((50, 100, -50), -0.07999999821186066f64), + ((50, 100, 0), -0.07999999821186066f64), + ((50, 100, 50), -0.07999999821186066f64), + ((50, 100, 100), -0.07999999821186066f64), + ((50, 200, -100), -0.07999999821186066f64), + ((50, 200, -50), -0.07999999821186066f64), + ((50, 200, 0), -0.07999999821186066f64), + ((50, 200, 50), -0.07999999821186066f64), + ((50, 200, 100), -0.07999999821186066f64), + ((100, -200, -100), -0.07999999821186066f64), + ((100, -200, -50), -0.07999999821186066f64), + ((100, -200, 0), -0.07999999821186066f64), + ((100, -200, 50), -0.07999999821186066f64), + ((100, -200, 100), -0.07999999821186066f64), + ((100, -100, -100), -0.07999999821186066f64), + ((100, -100, -50), -0.07999999821186066f64), + ((100, -100, 0), -0.07999999821186066f64), + ((100, -100, 50), -0.07999999821186066f64), + ((100, -100, 100), -0.07999999821186066f64), + ((100, 0, -100), 0.5633547588776332f64), + ((100, 0, -50), 0.09284281739909031f64), + ((100, 0, 0), 0.36438508670444847f64), + ((100, 0, 50), 0.20350630763687888f64), + ((100, 0, 100), 0.342069979071766f64), + ((100, 100, -100), -0.07999999821186066f64), + ((100, 100, -50), -0.07999999821186066f64), + ((100, 100, 0), -0.07999999821186066f64), + ((100, 100, 50), -0.07999999821186066f64), + ((100, 100, 100), -0.07999999821186066f64), + ((100, 200, -100), -0.07999999821186066f64), + ((100, 200, -50), -0.07999999821186066f64), + ((100, 200, 0), -0.07999999821186066f64), + ((100, 200, 50), -0.07999999821186066f64), + ((100, 200, 100), -0.07999999821186066f64), + ]; + for ((x, y, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)); + assert_eq!(router.vein_ridged.sample(pos), value); + } + + let values = [ + ((-100, -200, -100), 0.3211141881942152f64), + ((-100, -200, -50), 0.09648864932704422f64), + ((-100, -200, 0), -0.4361477376844327f64), + ((-100, -200, 50), -0.13040066209600742f64), + ((-100, -200, 100), 0.023388060633724863f64), + ((-100, -100, -100), -0.4936024322458776f64), + ((-100, -100, -50), 0.2524223066605673f64), + ((-100, -100, 0), 0.2798189678966397f64), + ((-100, -100, 50), -0.3791120273954761f64), + ((-100, -100, 100), 0.39137760850669906f64), + ((-100, 0, -100), 0.05179888245498191f64), + ((-100, 0, -50), -0.06839110450348797f64), + ((-100, 0, 0), 0.4146206374440951f64), + ((-100, 0, 50), -0.1880820750707125f64), + ((-100, 0, 100), 0.2018368254585623f64), + ((-100, 100, -100), -0.32001039415713683f64), + ((-100, 100, -50), -0.13817558469021005f64), + ((-100, 100, 0), -0.48101070627664044f64), + ((-100, 100, 50), -0.2402297366726863f64), + ((-100, 100, 100), 0.08239761934306493f64), + ((-100, 200, -100), 0.018224734015781025f64), + ((-100, 200, -50), 0.08691443377020788f64), + ((-100, 200, 0), 0.16208094523788294f64), + ((-100, 200, 50), -0.15691048604152458f64), + ((-100, 200, 100), 0.06628267159017102f64), + ((-50, -200, -100), 0.2944496267342102f64), + ((-50, -200, -50), -0.2782278816662622f64), + ((-50, -200, 0), 0.15536071363878953f64), + ((-50, -200, 50), 0.43610007125172995f64), + ((-50, -200, 100), 0.010906558300465366f64), + ((-50, -100, -100), -0.08205269591250534f64), + ((-50, -100, -50), -0.28370450958612364f64), + ((-50, -100, 0), 0.0885151647444476f64), + ((-50, -100, 50), 0.21999190041491667f64), + ((-50, -100, 100), -0.41613490183445756f64), + ((-50, 0, -100), 0.21384346251180444f64), + ((-50, 0, -50), -0.2824765568109107f64), + ((-50, 0, 0), -0.4954177161809242f64), + ((-50, 0, 50), -0.10463968465592202f64), + ((-50, 0, 100), 0.04434135773500206f64), + ((-50, 100, -100), 0.37770507600173986f64), + ((-50, 100, -50), 0.1371189219046899f64), + ((-50, 100, 0), -0.22638449889692794f64), + ((-50, 100, 50), -0.10557246185638242f64), + ((-50, 100, 100), -0.18984119304391683f64), + ((-50, 200, -100), 0.20939108846156035f64), + ((-50, 200, -50), -0.08776116132181612f64), + ((-50, 200, 0), 0.20843954771862513f64), + ((-50, 200, 50), -0.5814807800404631f64), + ((-50, 200, 100), -0.3797565621876845f64), + ((0, -200, -100), 0.27179855614165527f64), + ((0, -200, -50), 0.16521252240290915f64), + ((0, -200, 0), 0.18324386151568745f64), + ((0, -200, 50), -0.28715960497818555f64), + ((0, -200, 100), -0.18100038230278442f64), + ((0, -100, -100), -0.09765150029624575f64), + ((0, -100, -50), -0.17785462076301697f64), + ((0, -100, 0), 0.10598123320261281f64), + ((0, -100, 50), 0.40507433937683573f64), + ((0, -100, 100), -0.5101670875276502f64), + ((0, 0, -100), -0.12690301253734718f64), + ((0, 0, -50), -0.2843473512745877f64), + ((0, 0, 0), 0.4566468364551488f64), + ((0, 0, 50), -0.1868822216899071f64), + ((0, 0, 100), -0.06167756316828358f64), + ((0, 100, -100), 0.03280421216425878f64), + ((0, 100, -50), 0.1828693088708832f64), + ((0, 100, 0), -0.10761184293214024f64), + ((0, 100, 50), -0.2056948693640283f64), + ((0, 100, 100), -0.6641494135898256f64), + ((0, 200, -100), -0.2916257499829836f64), + ((0, 200, -50), 0.3089200762221871f64), + ((0, 200, 0), -0.10862123905585815f64), + ((0, 200, 50), -0.5314274903477223f64), + ((0, 200, 100), -0.18423922562669878f64), + ((50, -200, -100), -0.19441584981913765f64), + ((50, -200, -50), -0.23224532903196352f64), + ((50, -200, 0), -0.06741680955178693f64), + ((50, -200, 50), -0.11174106180027958f64), + ((50, -200, 100), -0.19402793406584085f64), + ((50, -100, -100), -0.3729509731834053f64), + ((50, -100, -50), -0.5992505452241598f64), + ((50, -100, 0), -0.3641193668713385f64), + ((50, -100, 50), -0.0780880308385808f64), + ((50, -100, 100), 0.20539004653798706f64), + ((50, 0, -100), 0.5068819044426225f64), + ((50, 0, -50), 0.2012696212123102f64), + ((50, 0, 0), 0.578511778875036f64), + ((50, 0, 50), 0.9255794468686466f64), + ((50, 0, 100), -0.30412588794463624f64), + ((50, 100, -100), 0.4128697472440939f64), + ((50, 100, -50), -0.2169521808135427f64), + ((50, 100, 0), 0.22551879656869442f64), + ((50, 100, 50), -0.15185632978888303f64), + ((50, 100, 100), -0.33800073097192557f64), + ((50, 200, -100), -0.1262053025774186f64), + ((50, 200, -50), -0.18678102576752423f64), + ((50, 200, 0), -0.04298915312937759f64), + ((50, 200, 50), -0.35937135281916827f64), + ((50, 200, 100), -0.09675303361528802f64), + ((100, -200, -100), 0.016944564179341898f64), + ((100, -200, -50), -0.21449082979744338f64), + ((100, -200, 0), -0.4864973070953402f64), + ((100, -200, 50), -0.12082732785556784f64), + ((100, -200, 100), 0.15105512670391716f64), + ((100, -100, -100), -0.42014790810555663f64), + ((100, -100, -50), 0.25043337086794476f64), + ((100, -100, 0), 0.4836407742236192f64), + ((100, -100, 50), -0.09839641176754102f64), + ((100, -100, 100), -0.7118185993515945f64), + ((100, 0, -100), -0.452981644351176f64), + ((100, 0, -50), 0.3195442816621561f64), + ((100, 0, 0), -0.316964588789998f64), + ((100, 0, 50), -0.09085595379884051f64), + ((100, 0, 100), -0.18535799255754892f64), + ((100, 100, -100), 0.21432773343101275f64), + ((100, 100, -50), -0.31712332334064697f64), + ((100, 100, 0), -0.2560240287841878f64), + ((100, 100, 50), -0.09580536400123087f64), + ((100, 100, 100), -0.0992129190886302f64), + ((100, 200, -100), 0.41460868389055017f64), + ((100, 200, -50), 0.4415181826498342f64), + ((100, 200, 0), 0.1205037616719153f64), + ((100, 200, 50), -0.7214410961887224f64), + ((100, 200, 100), 0.3867496985743827f64), + ]; + for ((x, y, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)); + assert_eq!(router.vein_gap.sample(pos), value); + } + } +} diff --git a/pumpkin-world/src/world_gen/noise/density/basic.rs b/pumpkin-world/src/world_gen/noise/density/basic.rs new file mode 100644 index 000000000..ff7c62070 --- /dev/null +++ b/pumpkin-world/src/world_gen/noise/density/basic.rs @@ -0,0 +1,414 @@ +use std::{hash::Hash, marker::PhantomData}; + +use crate::{match_ref_implementations, world_gen::noise::clamped_map}; + +use super::{ + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + NoEnvironment, OwnedConverterEnvironment, SharedComponentReference, + SharedConverterEnvironment, + }, + NoisePos, NoisePosImpl, +}; + +/// A density function that always returns the same value +pub struct ConstantFunction { + value: f64, +} + +impl ConstantFunction { + pub fn new(value: f64) -> Self { + Self { value } + } +} + +impl ComponentFunctionImpl for ConstantFunction {} + +impl ImmutableComponentFunctionImpl for ConstantFunction { + #[inline] + fn sample(&self, _pos: &NoisePos) -> f64 { + self.value + } + + #[inline] + fn fill(&self, arr: &mut [f64], _applier: &mut dyn ApplierImpl) { + arr.fill(self.value); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Constant(self.value) + } +} + +/// A density function that wraps another density function. +/// Primarily used to mark functions that should be modified by a converter +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub(crate) enum WrapperType { + Cache2D, + FlatCache, + OnceCache, + Interpolated, + CellCache, +} + +pub struct WrapperFunction> { + pub(crate) wrapped: R, + pub(crate) wrapper_type: WrapperType, + _dummy: PhantomData, +} + +impl> From> + for MutableComponentReference +{ + fn from(value: WrapperFunction) -> Self { + Self(Box::new(value)) + } +} + +impl> WrapperFunction { + pub fn new(wrapped: R, wrapper_type: WrapperType) -> Self { + Self { + wrapped, + wrapper_type, + _dummy: PhantomData:: {}, + } + } + + pub fn create_new_ref( + wrapped: ComponentReferenceImplementation, + wrapper_type: WrapperType, + ) -> ComponentReferenceImplementation { + match wrapped { + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + WrapperFunction::::new( + shared, + wrapper_type, + ) + .into(), + ) + } + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable( + WrapperFunction::new(owned, wrapper_type).into(), + ) + } + } + } +} + +impl> ComponentFunctionImpl + for WrapperFunction +{ +} + +impl ImmutableComponentFunctionImpl + for WrapperFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + self.wrapped.sample(pos) + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.wrapped.fill(arr, applier); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Wrapper(&self.wrapped, self.wrapper_type) + } +} + +impl> MutableComponentFunctionImpl + for WrapperFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + self.wrapped.sample_mut(pos, env) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.wrapped.fill_mut(arr, applier); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Wrapper(&self.wrapped, self.wrapper_type) + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Wrapper(self.wrapped.wrapped_ref(), self.wrapper_type) + } + + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.wrapped.convert(converter), self.wrapper_type) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.wrapped.clone_to_new_ref(), self.wrapper_type) + } +} + +pub struct YClampedFunction { + from: i32, + to: i32, + from_val: f64, + to_val: f64, +} + +impl YClampedFunction { + pub fn new(from: i32, to: i32, from_val: f64, to_val: f64) -> Self { + Self { + from, + to, + from_val, + to_val, + } + } +} + +impl ComponentFunctionImpl for YClampedFunction {} + +impl ImmutableComponentFunctionImpl for YClampedFunction { + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + clamped_map( + pos.y() as f64, + self.from as f64, + self.to as f64, + self.from_val, + self.to_val, + ) + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::YClamped(self) + } +} + +pub struct BeardifierFunction {} + +impl BeardifierFunction { + pub const INSTANCE: Self = Self {}; +} + +impl ComponentFunctionImpl for BeardifierFunction {} + +impl ImmutableComponentFunctionImpl for BeardifierFunction { + fn sample(&self, _pos: &NoisePos) -> f64 { + 0f64 + } + + fn fill(&self, arr: &mut [f64], _applier: &mut dyn ApplierImpl) { + arr.fill(0f64); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Beardifier + } +} + +#[derive(Clone)] +pub(crate) struct RangeUntypedData { + pub(crate) min: f64, + pub(crate) max: f64, +} + +pub struct RangeFunction< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, +> { + pub(crate) input: R1, + pub(crate) in_range: R2, + pub(crate) out_range: R3, + pub(crate) data: RangeUntypedData, + _dummy: PhantomData, +} + +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > RangeFunction +{ + pub fn new(input: R1, min: f64, max: f64, in_range: R2, out_range: R3) -> Self { + Self { + input, + in_range, + out_range, + data: RangeUntypedData { min, max }, + _dummy: PhantomData:: {}, + } + } + + pub fn create_new_ref( + input: ComponentReferenceImplementation, + in_sampler: ComponentReferenceImplementation, + out_sampler: ComponentReferenceImplementation, + data: &RangeUntypedData, + ) -> ComponentReferenceImplementation { + match (input, in_sampler, out_sampler) { + ( + ComponentReferenceImplementation::Shared(shared_input), + ComponentReferenceImplementation::Shared(shared_in), + ComponentReferenceImplementation::Shared(shared_out), + ) => RangeFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new(shared_input, data.min, data.max, shared_in, shared_out) + .into(), + (input, in_sampler, out_sampler) => { + match_ref_implementations!( + (input_ref, input), + (in_ref, in_sampler), + (out_ref, out_sampler); + { + ComponentReferenceImplementation::Mutable( + MutableComponentReference(Box::new( + RangeFunction::new( + input_ref, + data.min, + data.max, + in_ref, + out_ref + ) + )) + ) + } + ) + } + } + } +} + +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > From> for MutableComponentReference +{ + fn from(value: RangeFunction) -> Self { + Self(Box::new(value)) + } +} + +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > ComponentFunctionImpl for RangeFunction +{ +} + +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > MutableComponentFunctionImpl for RangeFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let sampled_density = self.input.sample_mut(pos, env); + if sampled_density >= self.data.min && sampled_density < self.data.max { + self.in_range.sample_mut(pos, env) + } else { + self.out_range.sample_mut(pos, env) + } + } + + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.input.fill_mut(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, val)| { + if *val >= self.data.min && *val < self.data.max { + *val = self.in_range.sample_mut(&applier.at(i), applier.env()); + } else { + *val = self.out_range.sample_mut(&applier.at(i), applier.env()); + } + }); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Range(&self.input, &self.in_range, &self.out_range, &self.data) + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Range( + self.input.wrapped_ref(), + self.in_range.wrapped_ref(), + self.out_range.wrapped_ref(), + self.data, + ) + } + + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.input.convert(converter), + self.in_range.convert(converter), + self.out_range.convert(converter), + &self.data, + ) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.input.clone_to_new_ref(), + self.in_range.clone_to_new_ref(), + self.out_range.clone_to_new_ref(), + &self.data, + ) + } +} + +impl ImmutableComponentFunctionImpl + for RangeFunction< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + > +{ + fn sample(&self, pos: &NoisePos) -> f64 { + let sampled_density = self.input.sample(pos); + if sampled_density >= self.data.min && sampled_density < self.data.max { + self.in_range.sample(pos) + } else { + self.out_range.sample(pos) + } + } + + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.input.fill(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, val)| { + if *val >= self.data.min && *val < self.data.max { + *val = self.in_range.sample(&applier.at(i)); + } else { + *val = self.out_range.sample(&applier.at(i)); + } + }); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Range(&self.input, &self.in_range, &self.out_range, &self.data) + } +} diff --git a/pumpkin-world/src/world_gen/noise/density/blend.rs b/pumpkin-world/src/world_gen/noise/density/blend.rs index 952efc818..309fa345e 100644 --- a/pumpkin-world/src/world_gen/noise/density/blend.rs +++ b/pumpkin-world/src/world_gen/noise/density/blend.rs @@ -1,101 +1,168 @@ -use std::sync::Arc; +use std::marker::PhantomData; + +use crate::world_gen::blender::BlenderImpl; use super::{ - Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, NoisePosImpl, Visitor, - VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + NoEnvironment, OwnedConverterEnvironment, SharedComponentReference, + SharedConverterEnvironment, + }, + NoisePos, NoisePosImpl, }; -#[derive(Clone)] pub struct BlendOffsetFunction {} -impl<'a> DensityFunctionImpl<'a> for BlendOffsetFunction { - fn sample(&self, _pos: &NoisePos) -> f64 { - 0f64 - } +impl BlendOffsetFunction { + pub const INSTANCE: Self = Self {}; +} - fn fill(&self, densities: &mut [f64], _applier: &Applier) { - densities.fill(0f64) - } +impl ComponentFunctionImpl for BlendOffsetFunction {} - fn min(&self) -> f64 { +impl ImmutableComponentFunctionImpl for BlendOffsetFunction { + #[inline] + fn sample(&self, _pos: &NoisePos) -> f64 { 0f64 } - fn max(&self) -> f64 { - 0f64 + #[inline] + fn fill(&self, arr: &mut [f64], _applier: &mut dyn ApplierImpl) { + arr.fill(0f64); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::BlendOffset(self.clone()))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::BlendOffset } } -#[derive(Clone)] pub struct BlendAlphaFunction {} -impl<'a> DensityFunctionImpl<'a> for BlendAlphaFunction { - fn sample(&self, _pos: &NoisePos) -> f64 { - 1f64 - } +impl BlendAlphaFunction { + pub const INSTANCE: Self = Self {}; +} - fn fill(&self, densities: &mut [f64], _applier: &Applier) { - densities.fill(1f64); - } +impl ComponentFunctionImpl for BlendAlphaFunction {} - fn max(&self) -> f64 { +impl ImmutableComponentFunctionImpl for BlendAlphaFunction { + #[inline] + fn sample(&self, _pos: &NoisePos) -> f64 { 1f64 } - fn min(&self) -> f64 { - 1f64 + #[inline] + fn fill(&self, arr: &mut [f64], _applier: &mut dyn ApplierImpl) { + arr.fill(1f64); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::BlendAlpha(self.clone()))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::BlendAlpha } } -#[derive(Clone)] -pub struct BlendDensityFunction<'a> { - function: Arc>, +pub struct BlendDensityFunction> { + pub(crate) function: R, + _dummy: PhantomData, } -impl<'a> BlendDensityFunction<'a> { - pub fn new(density: Arc>) -> Self { - Self { function: density } +impl> From> + for MutableComponentReference +{ + fn from(value: BlendDensityFunction) -> Self { + Self(Box::new(value)) } } -impl<'a> BlendDensityFunction<'a> { +impl> BlendDensityFunction { + pub fn new(function: R) -> Self { + Self { + function, + _dummy: PhantomData:: {}, + } + } + + #[inline] fn apply_density(&self, pos: &NoisePos, density: f64) -> f64 { pos.get_blender().apply_blend_density(pos, density) } + + pub fn create_new_ref( + function: ComponentReferenceImplementation, + ) -> ComponentReferenceImplementation { + match function { + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + BlendDensityFunction::::new(shared) + .into(), + ) + } + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable(BlendDensityFunction::new(owned).into()) + } + } + } +} +impl> ComponentFunctionImpl + for BlendDensityFunction +{ } -impl<'a> DensityFunctionImpl<'a> for BlendDensityFunction<'a> { +impl ImmutableComponentFunctionImpl + for BlendDensityFunction +{ + #[inline] fn sample(&self, pos: &NoisePos) -> f64 { - self.apply_density(pos, self.function.sample(pos)) + let density = self.function.sample(pos); + self.apply_density(pos, density) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.function.fill(densities, applier); - densities.iter_mut().enumerate().for_each(|(i, x)| { + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.function.fill(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, x)| { *x = self.apply_density(&applier.at(i), *x); }); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - let new_function = BlendDensityFunction { - function: self.function.apply(visitor), - }; - visitor.apply(Arc::new(DensityFunction::BlendDensity(new_function))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::BlendDensity(&self.function) + } +} + +impl> MutableComponentFunctionImpl + for BlendDensityFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density = self.function.sample_mut(pos, env); + self.apply_density(pos, density) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.function.fill_mut(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, x)| { + *x = self.apply_density(&applier.at(i), *x); + }); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::BlendDensity(&self.function) + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::BlendDensity(self.function.wrapped_ref()) } - fn min(&self) -> f64 { - f64::NEG_INFINITY + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.function.convert(converter)) } - fn max(&self) -> f64 { - f64::INFINITY + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.function.clone_to_new_ref()) } } diff --git a/pumpkin-world/src/world_gen/noise/density/component_functions.rs b/pumpkin-world/src/world_gen/noise/density/component_functions.rs new file mode 100644 index 000000000..6c47665ec --- /dev/null +++ b/pumpkin-world/src/world_gen/noise/density/component_functions.rs @@ -0,0 +1,1082 @@ +use std::{ + hash::{Hash, Hasher}, + sync::Arc, +}; + +use super::{ + basic::{RangeFunction, RangeUntypedData, WrapperFunction, WrapperType, YClampedFunction}, + blend::BlendDensityFunction, + math::{BinaryFunction, BinaryType, LinearFunction, LinearType, LinearUntypedData}, + noise::{ + InternalNoise, InterpolatedNoiseFunction, NoiseFunction, ShiftedNoiseFunction, + ShiftedNoiseUntypedData, + }, + offset::{ShiftAFunction, ShiftBFunction}, + spline::{ImmutableSplineRef, SplineFunction, SplineRef, SplineRefImpl}, + unary::{ClampFunction, ClampUntypedData, UnaryFunction, UnaryType}, + weird::{RarityMapper, WierdScaledFunction}, + NoisePos, +}; + +/// An environment for a mutable density function to reference. Supplied by the `EnvironmentApplierImpl` +pub trait DensityFunctionEnvironment: Send + Sync + 'static {} + +/// A placeholder struct to mark a density function as having no environment. +pub struct NoEnvironment {} +impl DensityFunctionEnvironment for NoEnvironment {} + +pub(crate) enum MutableComponentWrapper { + Wrapper(ComponentReferenceImplementation, WrapperType), + BlendDensity(ComponentReferenceImplementation), + Linear(ComponentReferenceImplementation), + Binary( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ), + ShiftedNoise( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ), + Spline(SplineRef), + Clamp(ComponentReferenceImplementation), + Unary(ComponentReferenceImplementation), + Range( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ), + Wierd(ComponentReferenceImplementation), +} + +#[macro_export] +macro_rules! match_ref_implementations { + (($name:ident, $value:expr); $builder:expr) => { + match $value { + ComponentReferenceImplementation::Shared($name) => {$builder}, + ComponentReferenceImplementation::Mutable($name) => {$builder}, + } + }; + (($name:ident, $value:expr), $(($name2:ident, $value2:expr)),+; $builder:expr) => { + match $value { + ComponentReferenceImplementation::Shared($name) => { + match_ref_implementations!($(($name2, $value2)),+;$builder) + } + ComponentReferenceImplementation::Mutable($name) => { + match_ref_implementations!($(($name2, $value2)),+;$builder) + } + } + }; +} + +pub(crate) enum SharedConverterEnvironment<'a> { + Constant(f64), + Wrapper(&'a SharedComponentReference, WrapperType), + YClamped(&'a YClampedFunction), + Beardifier, + Range( + &'a SharedComponentReference, + &'a SharedComponentReference, + &'a SharedComponentReference, + &'a RangeUntypedData, + ), + BlendOffset, + BlendAlpha, + BlendDensity(&'a SharedComponentReference), + End, + Linear(&'a SharedComponentReference, &'a LinearUntypedData), + Binary( + &'a SharedComponentReference, + &'a SharedComponentReference, + BinaryType, + ), + Noise(&'a NoiseFunction), + ShiftedNoise( + &'a SharedComponentReference, + &'a SharedComponentReference, + &'a SharedComponentReference, + &'a Arc, + &'a ShiftedNoiseUntypedData, + ), + InterpolatedNoise(&'a InterpolatedNoiseFunction), + ShiftA(&'a Arc), + ShiftB(&'a Arc), + Spline(&'a ImmutableSplineRef), + Clamp(&'a SharedComponentReference, &'a ClampUntypedData), + Unary(&'a SharedComponentReference, UnaryType), + Wierd( + &'a SharedComponentReference, + &'a Arc, + RarityMapper, + ), +} + +impl<'a> SharedConverterEnvironment<'a> { + fn as_env(&self) -> ConverterEnvironment<'a, E> { + match self { + Self::Constant(val) => ConverterEnvironment::Constant(*val), + Self::Wrapper(reference, action) => ConverterEnvironment::Wrapper(*reference, *action), + Self::YClamped(func) => ConverterEnvironment::YClamped(func), + Self::Beardifier => ConverterEnvironment::Beardifier, + Self::Range(f1, f2, f3, data) => ConverterEnvironment::Range(*f1, *f2, *f3, data), + Self::BlendOffset => ConverterEnvironment::BlendOffset, + Self::BlendAlpha => ConverterEnvironment::BlendAlpha, + Self::BlendDensity(f) => ConverterEnvironment::BlendDensity(*f), + Self::End => ConverterEnvironment::End, + Self::Linear(f, data) => ConverterEnvironment::Linear(*f, data), + Self::Binary(f1, f2, data) => ConverterEnvironment::Binary(*f1, *f2, *data), + Self::Noise(n) => ConverterEnvironment::Noise(n), + Self::ShiftedNoise(x, y, z, noise, data) => { + ConverterEnvironment::ShiftedNoise(*x, *y, *z, noise, data) + } + Self::InterpolatedNoise(func) => ConverterEnvironment::InterpolatedNoise(func), + Self::ShiftA(noise) => ConverterEnvironment::ShiftA(noise), + Self::ShiftB(noise) => ConverterEnvironment::ShiftB(noise), + Self::Spline(spline) => ConverterEnvironment::Spline(*spline), + Self::Clamp(f, data) => ConverterEnvironment::Clamp(*f, data), + Self::Unary(f, action) => ConverterEnvironment::Unary(*f, *action), + Self::Wierd(f, noise, rarity) => ConverterEnvironment::Wierd(*f, noise, *rarity), + } + } + + fn maybe_into_env(self) -> Option> { + Some(match self { + Self::Wrapper(reference, action) => { + OwnedConverterEnvironment::Wrapper(reference.clone_to_new_ref(), action) + } + Self::Range(f1, f2, f3, data) => OwnedConverterEnvironment::Range( + f1.clone_to_new_ref(), + f2.clone_to_new_ref(), + f3.clone_to_new_ref(), + data.clone(), + ), + Self::BlendDensity(f) => OwnedConverterEnvironment::BlendDensity(f.clone_to_new_ref()), + Self::Linear(f, data) => { + OwnedConverterEnvironment::Linear(f.clone_to_new_ref(), data.clone()) + } + Self::Binary(f1, f2, data) => OwnedConverterEnvironment::Binary( + f1.clone_to_new_ref(), + f2.clone_to_new_ref(), + data, + ), + Self::ShiftedNoise(x, y, z, noise, data) => OwnedConverterEnvironment::ShiftedNoise( + x.clone_to_new_ref(), + y.clone_to_new_ref(), + z.clone_to_new_ref(), + noise.clone(), + data.clone(), + ), + Self::Spline(spline) => { + OwnedConverterEnvironment::Spline(SplineRef::Immutable(spline.clone())) + } + Self::Clamp(f, data) => { + OwnedConverterEnvironment::Clamp(f.clone_to_new_ref(), data.clone()) + } + Self::Unary(f, action) => { + OwnedConverterEnvironment::Unary(f.clone_to_new_ref(), action) + } + Self::Wierd(f, noise, rarity) => { + OwnedConverterEnvironment::Wierd(f.clone_to_new_ref(), noise.clone(), rarity) + } + _ => { + return None; + } + }) + } + + fn internal_conversion( + &self, + converter: &mut dyn ConverterImpl, + ) -> Option> { + match self { + Self::Wrapper(reference, action) => reference.maybe_convert(converter).map(|new_ref| { + WrapperFunction::::create_new_ref(new_ref, *action) + }), + Self::Range(input, in_range, out_range, data) => { + let conv_input = input.maybe_convert(converter); + let conv_in = in_range.maybe_convert(converter); + let conv_out = out_range.maybe_convert(converter); + match (conv_input, conv_in, conv_out) { + (None, None, None) => None, + (f1, f2, f3) => { + let input = f1.unwrap_or_else(|| (*input).clone().into()); + let in_sampler = f2.unwrap_or_else(|| (*in_range).clone().into()); + let out_sampler = f3.unwrap_or_else(|| (*out_range).clone().into()); + Some(RangeFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref( + input, in_sampler, out_sampler, data + )) + } + } + } + Self::BlendDensity(reference) => reference.maybe_convert(converter).map(|new_ref| { + BlendDensityFunction::::create_new_ref(new_ref) + }), + Self::Linear(reference, data) => reference.maybe_convert(converter).map(|new_ref| { + LinearFunction::::create_new_ref(new_ref, data) + }), + Self::Binary(arg1, arg2, action) => { + let conv_arg1 = arg1.maybe_convert(converter); + let conv_arg2 = arg2.maybe_convert(converter); + match (conv_arg1, conv_arg2) { + (None, None) => None, + (f1, f2) => { + let arg1 = f1.unwrap_or_else(|| (*arg1).clone().into()); + let arg2 = f2.unwrap_or_else(|| (*arg2).clone().into()); + + Some(BinaryFunction::< + E, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref( + arg1, arg2, *action + )) + } + } + } + Self::Noise(noise) => converter.convert_noise(&noise.noise).map(|new_noise| { + NoiseFunction::new(new_noise, noise.xz_scale, noise.y_scale).into() + }), + Self::ShiftedNoise(x, y, z, noise, data) => { + let conv_x = x.maybe_convert(converter); + let conv_y = y.maybe_convert(converter); + let conv_z = z.maybe_convert(converter); + let conv_noise = converter.convert_noise(noise); + + match (conv_x, conv_y, conv_z, conv_noise) { + (None, None, None, None) => None, + (f1, f2, f3, maybe_noise) => { + let x = f1.unwrap_or_else(|| (*x).clone().into()); + let y = f2.unwrap_or_else(|| (*y).clone().into()); + let z = f3.unwrap_or_else(|| (*z).clone().into()); + let noise = maybe_noise.unwrap_or_else(|| (*noise).clone()); + + Some(ShiftedNoiseFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref( + x, y, z, noise, data + )) + } + } + } + Self::ShiftA(noise) => converter + .convert_noise(noise) + .map(|new_noise| ShiftAFunction::new(new_noise).into()), + Self::ShiftB(noise) => converter + .convert_noise(noise) + .map(|new_noise| ShiftBFunction::new(new_noise).into()), + Self::Spline(spline) => spline.maybe_convert(converter).map(|new_spline| { + SplineFunction::::create_new_ref(new_spline) + }), + Self::Clamp(f, data) => f.maybe_convert(converter).map(|new_ref| { + ClampFunction::::create_new_ref(new_ref, data) + }), + Self::Unary(f, action) => f.maybe_convert(converter).map(|new_ref| { + UnaryFunction::::create_new_ref(new_ref, *action) + }), + Self::Wierd(f, noise, rarity) => { + let conv_f = f.maybe_convert(converter); + let conv_noise = converter.convert_noise(noise); + match (conv_f, conv_noise) { + (None, None) => None, + (maybe_f, maybe_noise) => { + let f = maybe_f.unwrap_or_else(|| (*f).clone().into()); + let noise = maybe_noise.unwrap_or_else(|| (*noise).clone()); + Some( + WierdScaledFunction::::create_new_ref( + f, noise, *rarity, + ), + ) + } + } + } + _ => None, + } + } +} + +pub(crate) enum ConverterEnvironment<'a, E: DensityFunctionEnvironment> { + Constant(f64), + Wrapper(&'a dyn ComponentReference, WrapperType), + YClamped(&'a YClampedFunction), + Beardifier, + Range( + &'a dyn ComponentReference, + &'a dyn ComponentReference, + &'a dyn ComponentReference, + &'a RangeUntypedData, + ), + BlendOffset, + BlendAlpha, + BlendDensity(&'a dyn ComponentReference), + End, + Linear(&'a dyn ComponentReference, &'a LinearUntypedData), + Binary( + &'a dyn ComponentReference, + &'a dyn ComponentReference, + BinaryType, + ), + Noise(&'a NoiseFunction), + ShiftedNoise( + &'a dyn ComponentReference, + &'a dyn ComponentReference, + &'a dyn ComponentReference, + &'a Arc, + &'a ShiftedNoiseUntypedData, + ), + InterpolatedNoise(&'a InterpolatedNoiseFunction), + ShiftA(&'a Arc), + ShiftB(&'a Arc), + Spline(&'a dyn SplineRefImpl), + Clamp(&'a dyn ComponentReference, &'a ClampUntypedData), + Unary(&'a dyn ComponentReference, UnaryType), + Wierd( + &'a dyn ComponentReference, + &'a Arc, + RarityMapper, + ), + ChunkNoise, +} + +pub(crate) enum ConversionResultPre { + New(ComponentReferenceImplementation), + NoChange, + Default, +} + +/// Only for components that reference other components +pub(crate) enum OwnedConverterEnvironment { + Wrapper(ComponentReferenceImplementation, WrapperType), + Range( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ComponentReferenceImplementation, + RangeUntypedData, + ), + BlendDensity(ComponentReferenceImplementation), + Linear(ComponentReferenceImplementation, LinearUntypedData), + Binary( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + BinaryType, + ), + ShiftedNoise( + ComponentReferenceImplementation, + ComponentReferenceImplementation, + ComponentReferenceImplementation, + Arc, + ShiftedNoiseUntypedData, + ), + Spline(SplineRef), + Clamp(ComponentReferenceImplementation, ClampUntypedData), + Unary(ComponentReferenceImplementation, UnaryType), + Wierd( + ComponentReferenceImplementation, + Arc, + RarityMapper, + ), +} + +impl OwnedConverterEnvironment { + pub fn rebuild_reference(self) -> ComponentReferenceImplementation { + match self { + Self::Wrapper(f, t) => { + WrapperFunction::::create_new_ref(f, t) + } + Self::Wierd(f, n, r) => { + WierdScaledFunction::::create_new_ref(f, n, r) + } + Self::Unary(f, t) => UnaryFunction::::create_new_ref(f, t), + Self::Clamp(f, t) => { + ClampFunction::::create_new_ref(f, &t) + } + Self::Spline(s) => SplineFunction::::create_new_ref(s), + Self::ShiftedNoise(x, y, z, n, d) => ShiftedNoiseFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref(x, y, z, n, &d), + Self::Binary(x, y, t) => BinaryFunction::< + E, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref(x, y, t), + Self::Linear(x, t) => { + LinearFunction::::create_new_ref(x, &t) + } + Self::BlendDensity(f) => { + BlendDensityFunction::::create_new_ref(f) + } + Self::Range(x, y, z, d) => RangeFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::create_new_ref(x, y, z, &d), + } + } +} + +// TODO: Also just generically make this better +pub trait ConverterImpl { + /// Takes action before internal density functions are converted + fn convert_env_pre_internal( + &mut self, + component: ConverterEnvironment, + ) -> ConversionResultPre; + + fn converts_post_internal(&mut self, component: ConverterEnvironment) -> bool; + + /// Takes action after internal density functions are converted + fn convert_env_post_internal( + &mut self, + component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation; + + fn convert_noise(&mut self, noise: &Arc) -> Option>; +} + +/// Fills the `arr` given a mutable density function and environment +pub trait EnvironmentApplierImpl: ApplierImpl { + type Env: DensityFunctionEnvironment; + + fn env(&mut self) -> &Self::Env; + + fn fill_mut( + &mut self, + arr: &mut [f64], + function: &mut dyn MutableComponentFunctionImpl, + ); + + fn cast_up(&mut self) -> &mut dyn ApplierImpl; +} + +/// Fills the `arr` given a immutable density function +pub trait ApplierImpl { + fn at(&mut self, index: usize) -> NoisePos; + + fn fill(&mut self, arr: &mut [f64], function: &dyn ImmutableComponentFunctionImpl); +} + +/// Methods shared across immutable and mutable density functions +pub trait ComponentFunctionImpl: Send + Sync {} + +/// A density function that needs no environment or mutable state. Only has `ComponentReference`s. +pub trait ImmutableComponentFunctionImpl: ComponentFunctionImpl { + fn sample(&self, pos: &NoisePos) -> f64; + + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl); + + fn shared_environment(&self) -> SharedConverterEnvironment; +} + +/// A density function that needs a mutable state (and possibly an environment). May have +/// `ComponentReference`s or `MutableComponentReference`s. +pub trait MutableComponentFunctionImpl: + ComponentFunctionImpl +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64; + + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl); + + fn environment(&self) -> ConverterEnvironment; + + fn into_environment(self: Box) -> OwnedConverterEnvironment; + + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation; + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation; +} + +/// Basic functions for simple modifications to a current component +pub trait ComponentReferenceMap { + type Result: ComponentReference; + + fn clamp(self, min: f64, max: f64) -> Self::Result; + + fn abs(self) -> Self::Result; + + fn square(self) -> Self::Result; + + fn cube(self) -> Self::Result; + + fn half_negative(self) -> Self::Result; + + fn quarter_negative(self) -> Self::Result; + + fn squeeze(self) -> Self::Result; + + fn add_const(self, other: f64) -> Self::Result; + + fn mul_const(self, other: f64) -> Self::Result; +} + +pub trait ComponentReferenceMath> { + type Result: ComponentReference; + + fn add(self, other: R) -> Self::Result; + + fn mul(self, other: R) -> Self::Result; + + fn min(self, other: R) -> Self::Result; + + fn max(self, other: R) -> Self::Result; +} + +pub(crate) enum ComponentReferenceImplementation { + Shared(SharedComponentReference), + Mutable(MutableComponentReference), +} + +impl ComponentReferenceImplementation { + pub fn add( + self, + other: ComponentReferenceImplementation, + ) -> ComponentReferenceImplementation { + match (self, other) { + ( + ComponentReferenceImplementation::Shared(shared1), + ComponentReferenceImplementation::Shared(shared2), + ) => BinaryFunction::::new( + BinaryType::Add, + shared1, + shared2, + ) + .into(), + (ref1, ref2) => + BinaryFunction::::create_new_ref(ref1, ref2, BinaryType::Add), + } + } +} + +impl ComponentReferenceImplementation { + #[inline] + pub fn environment(&self) -> ConverterEnvironment { + match self { + Self::Shared(shared) => shared.environment(), + Self::Mutable(owned) => owned.environment(), + } + } + + #[inline] + pub fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + match self { + Self::Shared(shared) => shared.clone_to_new_ref(), + Self::Mutable(owned) => owned.clone_to_new_ref(), + } + } + + #[inline] + pub fn into_environment( + self, + ) -> Result, ComponentReferenceImplementation> { + match self { + Self::Shared(shared) => shared.into_environment(), + Self::Mutable(owned) => owned.into_environment(), + } + } + + #[inline] + pub fn convert(self, converter: &mut dyn ConverterImpl) -> Self { + match self { + Self::Shared(shared) => shared.convert(converter), + Self::Mutable(owned) => owned.convert(converter), + } + } + + #[inline] + pub fn assert_shared(self) -> SharedComponentReference { + match self { + Self::Shared(shared) => shared, + Self::Mutable(_) => unreachable!(), + } + } + + #[inline] + pub fn boxed(self) -> Box> { + match self { + Self::Shared(shared) => Box::new(shared), + Self::Mutable(owned) => Box::new(owned), + } + } +} + +impl From> + for ComponentReferenceImplementation +{ + fn from(value: MutableComponentReference) -> Self { + Self::Mutable(value) + } +} + +impl From + for ComponentReferenceImplementation +{ + fn from(value: SharedComponentReference) -> Self { + Self::Shared(value) + } +} + +impl From + for ComponentReferenceImplementation +{ + fn from(value: F) -> Self { + Self::Shared(value.into()) + } +} + +/// A reference to some other density function whether it be immutable or mutable +pub trait ComponentReference: 'static + Send + Sync { + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64; + + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl); + + fn convert(self, converter: &mut dyn ConverterImpl) -> ComponentReferenceImplementation; + + fn matches_ref(&self, reference: &ComponentReferenceImplementation) -> bool; + + fn environment(&self) -> ConverterEnvironment; + + /// Returns an environment if able to be converted, otherwise itself as a reference wrapper + fn into_environment( + self, + ) -> Result, ComponentReferenceImplementation>; + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation; + + fn wrapped_ref(self) -> ComponentReferenceImplementation; + + fn wrapped_ref_from_box(self: Box) -> ComponentReferenceImplementation; +} + +/// A shared reference to an immutable density function +#[derive(Clone)] +pub struct SharedComponentReference(pub(crate) Arc); + +impl PartialEq for SharedComponentReference { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.0, &other.0) + } +} + +impl Eq for SharedComponentReference {} + +impl Hash for SharedComponentReference { + fn hash(&self, state: &mut H) { + let ptr = Arc::as_ptr(&self.0); + let addr = ptr.cast::<()>() as usize; + addr.hash(state); + } +} + +impl From for SharedComponentReference { + fn from(value: F) -> Self { + Self(Arc::new(value)) + } +} + +impl SharedComponentReference { + #[inline] + pub fn sample(&self, pos: &NoisePos) -> f64 { + self.0.sample(pos) + } + + #[inline] + pub fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.0.fill(arr, applier); + } + + /// Returns None if no changes have been made + pub(crate) fn maybe_convert( + &self, + converter: &mut dyn ConverterImpl, + ) -> Option> { + let shared_env = self.0.shared_environment(); + match converter.convert_env_pre_internal(shared_env.as_env()) { + ConversionResultPre::New(reference) => Some(reference), + ConversionResultPre::NoChange => None, + ConversionResultPre::Default => { + let internal_conversion = shared_env + .internal_conversion(converter) + .unwrap_or_else(|| self.clone().into()); + + Some( + if converter.converts_post_internal(internal_conversion.environment()) { + let env = internal_conversion + .into_environment() + .unwrap_or_else(|_| panic!()); + converter.convert_env_post_internal(env) + } else { + internal_conversion + }, + ) + } + } + } +} + +impl ComponentReference for SharedComponentReference { + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, _env: &E) -> f64 { + self.sample(pos) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.fill(arr, applier.cast_up()); + } + + fn convert(self, converter: &mut dyn ConverterImpl) -> ComponentReferenceImplementation { + self.maybe_convert(converter).unwrap_or_else(|| self.into()) + } + + fn environment(&self) -> ConverterEnvironment { + self.0.shared_environment().as_env() + } + + fn into_environment( + self, + ) -> Result, ComponentReferenceImplementation> { + self.0 + .shared_environment() + .maybe_into_env() + .ok_or_else(|| self.into()) + } + + fn matches_ref(&self, reference: &ComponentReferenceImplementation) -> bool { + match reference { + ComponentReferenceImplementation::Shared(shared) => Arc::ptr_eq(&self.0, &shared.0), + ComponentReferenceImplementation::Mutable(_) => false, + } + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + self.clone().into() + } + + fn wrapped_ref(self) -> ComponentReferenceImplementation { + self.into() + } + + fn wrapped_ref_from_box(self: Box) -> ComponentReferenceImplementation { + (*self).into() + } +} + +impl> ComponentReferenceMap for I { + type Result = SharedComponentReference; + + fn abs(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::Abs, self.into()))) + } + + fn cube(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::Cube, self.into()))) + } + + fn clamp(self, min: f64, max: f64) -> Self::Result { + #[cfg(debug_assertions)] + assert!(min <= max); + SharedComponentReference(Arc::new(ClampFunction::< + NoEnvironment, + SharedComponentReference, + >::new(self.into(), min, max))) + } + + fn square(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::Square, self.into()))) + } + + fn squeeze(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::Squeeze, self.into()))) + } + + fn half_negative(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::HalfNeg, self.into()))) + } + + fn quarter_negative(self) -> Self::Result { + SharedComponentReference(Arc::new(UnaryFunction::< + NoEnvironment, + SharedComponentReference, + >::new(UnaryType::QuartNeg, self.into()))) + } + + fn add_const(self, other: f64) -> Self::Result { + SharedComponentReference(Arc::new(LinearFunction::< + NoEnvironment, + SharedComponentReference, + >::new(LinearType::Add, self.into(), other))) + } + + fn mul_const(self, other: f64) -> Self::Result { + SharedComponentReference(Arc::new(LinearFunction::< + NoEnvironment, + SharedComponentReference, + >::new(LinearType::Mul, self.into(), other))) + } +} + +impl> + ComponentReferenceMath for I +{ + type Result = SharedComponentReference; + + fn add(self, other: SharedComponentReference) -> Self::Result { + SharedComponentReference(Arc::new(BinaryFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + >::new(BinaryType::Add, self.into(), other))) + } + + fn mul(self, other: SharedComponentReference) -> Self::Result { + SharedComponentReference(Arc::new(BinaryFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + >::new(BinaryType::Mul, self.into(), other))) + } + + fn min(self, other: SharedComponentReference) -> Self::Result { + SharedComponentReference(Arc::new(BinaryFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + >::new(BinaryType::Min, self.into(), other))) + } + + fn max(self, other: SharedComponentReference) -> Self::Result { + SharedComponentReference(Arc::new(BinaryFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + >::new(BinaryType::Max, self.into(), other))) + } +} +/// A owned reference to a mutable density function +pub struct MutableComponentReference( + pub(crate) Box>, +); + +impl ComponentReference for MutableComponentReference { + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + self.0.sample_mut(pos, env) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.0.fill_mut(arr, applier); + } + + fn environment(&self) -> ConverterEnvironment { + self.0.environment() + } + + fn into_environment( + self, + ) -> Result, ComponentReferenceImplementation> { + Ok(self.0.into_environment()) + } + + fn convert(self, converter: &mut dyn ConverterImpl) -> ComponentReferenceImplementation { + let env = self.0.environment(); + match converter.convert_env_pre_internal(env) { + ConversionResultPre::New(function) => function, + ConversionResultPre::NoChange => self.into(), + ConversionResultPre::Default => { + let internal = self.0.convert(converter); + + if converter.converts_post_internal(internal.environment()) { + let env = internal.into_environment().unwrap_or_else(|_| panic!()); + converter.convert_env_post_internal(env) + } else { + internal + } + } + } + } + + fn matches_ref(&self, reference: &ComponentReferenceImplementation) -> bool { + match reference { + ComponentReferenceImplementation::Shared(_) => false, + ComponentReferenceImplementation::Mutable(_owned) => { + //TODO: A way to compare owned components (do we even need this?) + false + } + } + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + self.0.clone_to_new_ref() + } + + fn wrapped_ref(self) -> ComponentReferenceImplementation { + ComponentReferenceImplementation::Mutable(self) + } + + fn wrapped_ref_from_box(self: Box) -> ComponentReferenceImplementation { + ComponentReferenceImplementation::Mutable(*self) + } +} + +#[cfg(test)] +mod test { + use std::sync::Arc; + + use pumpkin_core::random::{legacy_rand::LegacyRand, RandomDeriver, RandomImpl}; + + use crate::world_gen::noise::{ + built_in_noise_params, + density::{ + noise::{InternalNoise, NoiseFunction}, + spline::{FloatAmplifier, ImmutableSplineRef, SplineBuilder, SplineFunction}, + test::{FakeEnvironment, OwnedConverter, TestConverter}, + NoisePos, UnblendedNoisePos, + }, + }; + + use super::{ComponentReference, NoEnvironment, SharedComponentReference}; + + #[test] + fn test_owned_minimal_conversion_spline() { + let minimal_spline = SplineBuilder::new( + NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::NETHER_WART, + None, + )), + 0.2f64, + 1.1f64, + ) + .into(), + FloatAmplifier::Identity, + ) + .add_fixed_value(0f32, 1f32) + .build(); + + let test_func: SharedComponentReference = + SplineFunction::::new(minimal_spline.into()).into(); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let standard_convert = test_func.clone().convert(&mut converter).assert_shared(); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let mut owned_convert = test_func.convert_to_dyn(&mut converter); + + for i in -10..=10 { + for j in -10..=10 { + for k in -10..=10 { + let pos = + NoisePos::Unblended(UnblendedNoisePos::new(i * 100, j * 100, k * 100)); + assert_eq!( + standard_convert.sample(&pos), + owned_convert.sample_mut(&pos, &FakeEnvironment {}) + ); + } + } + } + } + + #[test] + fn test_nested_minimal_conversion_spline() { + let minimal_spline = SplineBuilder::new( + NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::NETHER_WART, + None, + )), + 0.2f64, + 1.1f64, + ) + .into(), + FloatAmplifier::Identity, + ) + .add_spline_value( + 0f32, + SplineBuilder::new( + NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::NETHER_WART, + None, + )), + 0.2f64, + 1.1f64, + ) + .into(), + FloatAmplifier::Identity, + ) + .add_fixed_value(-1f32, -1f32) + .add_fixed_value(1f32, 1f32) + .build() + .into(), + ) + .add_fixed_value(1f32, 1f32) + .build(); + + let test_func: SharedComponentReference = + SplineFunction::::new(minimal_spline.into()).into(); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let standard_convert = test_func.clone().convert(&mut converter).assert_shared(); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let mut owned_convert = test_func.convert_to_dyn(&mut converter); + + for i in -10..=10 { + for j in -10..=10 { + for k in -10..=10 { + let pos = + NoisePos::Unblended(UnblendedNoisePos::new(i * 100, j * 100, k * 100)); + assert_eq!( + standard_convert.sample(&pos), + owned_convert.sample_mut(&pos, &FakeEnvironment {}) + ); + } + } + } + } +} diff --git a/pumpkin-world/src/world_gen/noise/density/end.rs b/pumpkin-world/src/world_gen/noise/density/end.rs index f546701a4..39ee37bc2 100644 --- a/pumpkin-world/src/world_gen/noise/density/end.rs +++ b/pumpkin-world/src/world_gen/noise/density/end.rs @@ -1,15 +1,15 @@ -use std::sync::Arc; - use pumpkin_core::random::{legacy_rand::LegacyRand, RandomImpl}; use crate::world_gen::noise::simplex::SimplexNoiseSampler; use super::{ - Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, NoisePosImpl, Visitor, - VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ImmutableComponentFunctionImpl, + SharedConverterEnvironment, + }, + NoisePosImpl, }; -#[derive(Clone)] pub struct EndIslandFunction { sampler: SimplexNoiseSampler, } @@ -56,24 +56,18 @@ impl EndIslandFunction { } } -impl<'a> DensityFunctionImpl<'a> for EndIslandFunction { - fn fill(&self, densities: &mut [f64], applier: &Applier) { - applier.fill(densities, &DensityFunction::EndIsland(self.clone())) - } +impl ComponentFunctionImpl for EndIslandFunction {} - fn sample(&self, pos: &NoisePos) -> f64 { +impl ImmutableComponentFunctionImpl for EndIslandFunction { + fn sample(&self, pos: &super::NoisePos) -> f64 { (Self::sample_2d(&self.sampler, pos.x() / 8, pos.z() / 8) as f64 - 8f64) / 128f64 } - fn min(&self) -> f64 { - -0.84375f64 - } - - fn max(&self) -> f64 { - 0.5625f64 + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::EndIsland(self.clone()))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::End } } diff --git a/pumpkin-world/src/world_gen/noise/density/math.rs b/pumpkin-world/src/world_gen/noise/density/math.rs index d20cae5f3..4efdd65f4 100644 --- a/pumpkin-world/src/world_gen/noise/density/math.rs +++ b/pumpkin-world/src/world_gen/noise/density/math.rs @@ -1,268 +1,347 @@ -use std::sync::Arc; +use std::marker::PhantomData; -use log::warn; +use crate::match_ref_implementations; use super::{ - Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, UnaryDensityFunction, - Visitor, VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + NoEnvironment, OwnedConverterEnvironment, SharedComponentReference, + SharedConverterEnvironment, + }, + NoisePos, }; -#[derive(Clone)] -pub enum LinearType { +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub(crate) enum LinearType { Mul, Add, } #[derive(Clone)] -pub struct LinearFunction<'a> { - action: LinearType, - input: Arc>, - min: f64, - max: f64, - arg: f64, +pub(crate) struct LinearUntypedData { + pub(crate) arg: f64, + pub(crate) action: LinearType, +} + +pub struct LinearFunction> { + pub(crate) input: R, + pub(crate) data: LinearUntypedData, + _dummy: PhantomData, +} + +impl> From> + for MutableComponentReference +{ + fn from(value: LinearFunction) -> Self { + Self(Box::new(value)) + } } -impl<'a> DensityFunctionImpl<'a> for LinearFunction<'a> { - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - let new_function = self.input.apply(visitor); - let d = new_function.min(); - let e = new_function.max(); - - let (f, g) = match self.action { - LinearType::Add => (d + self.arg, e + self.arg), - LinearType::Mul => { - if self.arg >= 0f64 { - (d * self.arg, e * self.arg) - } else { - (e * self.arg, d * self.arg) - } +impl> LinearFunction { + pub fn new(action: LinearType, input: R, arg: f64) -> Self { + Self { + input, + data: LinearUntypedData { action, arg }, + _dummy: PhantomData:: {}, + } + } + #[inline] + fn apply_density(&self, density: f64) -> f64 { + match self.data.action { + LinearType::Mul => density * self.data.arg, + LinearType::Add => density + self.data.arg, + } + } + + #[inline] + fn apply_fill(&self, arr: &mut [f64]) { + arr.iter_mut() + .for_each(|density| *density = self.apply_density(*density)); + } + + pub fn create_new_ref( + arg: ComponentReferenceImplementation, + data: &LinearUntypedData, + ) -> ComponentReferenceImplementation { + match arg { + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + LinearFunction::::new( + data.action, + shared, + data.arg, + ) + .into(), + ) } - }; - - Arc::new(DensityFunction::Linear(LinearFunction { - action: self.action.clone(), - input: new_function, - min: f, - max: g, - arg: self.arg, - })) + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable( + LinearFunction::new(data.action, owned, data.arg).into(), + ) + } + } } +} - fn sample(&self, pos: &NoisePos) -> f64 { - self.apply_density(self.input.sample(pos)) +impl> ComponentFunctionImpl + for LinearFunction +{ +} + +impl> MutableComponentFunctionImpl + for LinearFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density = self.input.sample_mut(pos, env); + self.apply_density(density) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.input.fill_mut(arr, applier); + self.apply_fill(arr); } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier); - densities - .iter_mut() - .for_each(|val| *val = self.apply_density(*val)) + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Linear(&self.input, &self.data) } - fn min(&self) -> f64 { - self.min + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Linear(self.input.wrapped_ref(), self.data) } - fn max(&self) -> f64 { - self.max + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.convert(converter), &self.data) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.clone_to_new_ref(), &self.data) } } -impl<'a> UnaryDensityFunction<'a> for LinearFunction<'a> { - fn apply_density(&self, density: f64) -> f64 { - match self.action { - LinearType::Mul => density * self.arg, - LinearType::Add => density + self.arg, - } +impl ImmutableComponentFunctionImpl + for LinearFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + let density = self.input.sample(pos); + self.apply_density(density) + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.input.fill(arr, applier); + self.apply_fill(arr); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Linear(&self.input, &self.data) } } -#[derive(Clone)] -pub enum BinaryType { +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub(crate) enum BinaryType { Mul, Add, Min, Max, } -#[derive(Clone)] -pub struct BinaryFunction<'a> { - action: BinaryType, - arg1: Arc>, - arg2: Arc>, - min: f64, - max: f64, +pub struct BinaryFunction< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, +> { + pub(crate) binary_type: BinaryType, + pub(crate) arg1: R1, + pub(crate) arg2: R2, + _dummy: PhantomData, } -impl<'a> BinaryFunction<'a> { - pub fn create( - action: BinaryType, - arg1: Arc>, - arg2: Arc>, - ) -> DensityFunction<'a> { - let d = arg1.min(); - let e = arg2.min(); - let f = arg1.max(); - let g = arg2.max(); - - match action { - BinaryType::Min | BinaryType::Max => { - if d >= e || e >= f { - warn!("Density function does not overlap"); - } - } - _ => {} +impl, R2: ComponentReference> + From> for MutableComponentReference +{ + fn from(value: BinaryFunction) -> Self { + Self(Box::new(value)) + } +} + +impl, R2: ComponentReference> + BinaryFunction +{ + pub fn new(binary_type: BinaryType, arg1: R1, arg2: R2) -> Self { + Self { + binary_type, + arg1, + arg2, + _dummy: PhantomData:: {}, } + } - let h = match action { - BinaryType::Add => d + e, - BinaryType::Mul => { - if d > 0f64 && e > 0f64 { - d * e - } else if f < 0f64 && g < 0f64 { - f * g - } else { - (d * g).min(f * e) - } - } - BinaryType::Min => d.min(e), - BinaryType::Max => d.max(e), - }; + #[inline] + fn apply_densities(&self, density1: f64, density2: f64) -> f64 { + match self.binary_type { + BinaryType::Add => density1 + density2, + BinaryType::Mul => density1 * density2, + BinaryType::Min => density1.min(density2), + BinaryType::Max => density1.max(density2), + } + } - let i = match action { - BinaryType::Add => f + g, - BinaryType::Mul => { - if d > 0f64 && e > 0f64 { - f * g - } else if f < 0f64 && g < 0f64 { - d * e - } else { - (d * e).max(f * g) - } - } - BinaryType::Min => f.min(g), - BinaryType::Max => f.max(g), - }; - - match action { - BinaryType::Mul | BinaryType::Add => { - let action = match action { - BinaryType::Add => LinearType::Add, - BinaryType::Mul => LinearType::Mul, - _ => unreachable!(), - }; - - if let DensityFunction::Constant(func) = arg1.as_ref() { - return DensityFunction::Linear(LinearFunction { - action, - input: arg2, - min: h, - max: i, - arg: func.value, - }); - } - - if let DensityFunction::Constant(func) = arg2.as_ref() { - return DensityFunction::Linear(LinearFunction { - action, - input: arg1, - min: h, - max: i, - arg: func.value, - }); - } + pub fn create_new_ref( + arg1: ComponentReferenceImplementation, + arg2: ComponentReferenceImplementation, + action: BinaryType, + ) -> ComponentReferenceImplementation { + match (arg1, arg2) { + ( + ComponentReferenceImplementation::Shared(shared1), + ComponentReferenceImplementation::Shared(shared2), + ) => BinaryFunction::::new( + action, shared1, shared2, + ) + .into(), + (ref1, ref2) => { + match_ref_implementations!( + (unwrapped1, ref1), + (unwrapped2, ref2); + { + ComponentReferenceImplementation::Mutable( + MutableComponentReference(Box::new( + BinaryFunction::new(action, unwrapped1, unwrapped2) + )) + ) + } + ) } - _ => {} } - - DensityFunction::Binary(BinaryFunction { - action, - arg1, - arg2, - min: h, - max: i, - }) } } -impl<'a> DensityFunctionImpl<'a> for BinaryFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - let d = self.arg1.sample(pos); - let e = self.arg2.sample(pos); +impl, R2: ComponentReference> + ComponentFunctionImpl for BinaryFunction +{ +} - match self.action { - BinaryType::Add => d + e, - BinaryType::Mul => d * e, +impl, R2: ComponentReference> + MutableComponentFunctionImpl for BinaryFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density1 = self.arg1.sample_mut(pos, env); + let density2 = self.arg2.sample_mut(pos, env); + self.apply_densities(density1, density2) + } + + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.arg1.fill_mut(arr, applier); + match self.binary_type { + BinaryType::Add => { + let mut densities2 = vec![0f64; arr.len()]; + self.arg2.fill_mut(&mut densities2, applier); + arr.iter_mut() + .zip(densities2) + .for_each(|(returned, temp)| *returned += temp); + } + BinaryType::Mul => { + arr.iter_mut().enumerate().for_each(|(i, val)| { + if *val != 0f64 { + *val *= self.arg2.sample_mut(&applier.at(i), applier.env()); + } + }); + } BinaryType::Min => { - if d < self.arg2.min() { - d - } else { - d.min(e) - } + arr.iter_mut().enumerate().for_each(|(i, val)| { + *val = val.min(self.arg2.sample_mut(&applier.at(i), applier.env())); + }); } BinaryType::Max => { - if d > self.arg2.max() { - d - } else { - d.max(e) - } + arr.iter_mut().enumerate().for_each(|(i, val)| { + *val = val.max(self.arg2.sample_mut(&applier.at(i), applier.env())); + }); } } } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.arg1.fill(densities, applier); - match self.action { + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Binary(&self.arg1, &self.arg2, self.binary_type) + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Binary( + self.arg1.wrapped_ref(), + self.arg2.wrapped_ref(), + self.binary_type, + ) + } + + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.arg1.convert(converter), + self.arg2.convert(converter), + self.binary_type, + ) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.arg1.clone_to_new_ref(), + self.arg2.clone_to_new_ref(), + self.binary_type, + ) + } +} + +impl ImmutableComponentFunctionImpl + for BinaryFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + let density1 = self.arg1.sample(pos); + let density2 = self.arg2.sample(pos); + self.apply_densities(density1, density2) + } + + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.arg1.fill(arr, applier); + match self.binary_type { BinaryType::Add => { - let mut ds = Vec::with_capacity(densities.len()); - densities.iter().for_each(|_| ds.push(0f64)); - self.arg2.fill(&mut ds, applier); - densities - .iter_mut() - .zip(ds) - .for_each(|(real, temp)| *real += temp); + let mut densities2 = vec![0f64; arr.len()]; + self.arg2.fill(&mut densities2, applier); + arr.iter_mut() + .zip(densities2) + .for_each(|(returned, temp)| *returned += temp); } BinaryType::Mul => { - densities.iter_mut().enumerate().for_each(|(i, val)| { + arr.iter_mut().enumerate().for_each(|(i, val)| { if *val != 0f64 { *val *= self.arg2.sample(&applier.at(i)); - }; + } }); } BinaryType::Min => { - let e = self.arg2.min(); - - densities.iter_mut().enumerate().for_each(|(i, val)| { - if *val >= e { - *val = val.min(self.arg2.sample(&applier.at(i))); - } + arr.iter_mut().enumerate().for_each(|(i, val)| { + *val = val.min(self.arg2.sample(&applier.at(i))); }); } BinaryType::Max => { - let e = self.arg2.max(); - - densities.iter_mut().enumerate().for_each(|(i, val)| { - if *val <= e { - *val = val.max(self.arg2.sample(&applier.at(i))) - } + arr.iter_mut().enumerate().for_each(|(i, val)| { + *val = val.max(self.arg2.sample(&applier.at(i))); }); } } } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(BinaryFunction::create( - self.action.clone(), - self.arg1.apply(visitor), - self.arg2.apply(visitor), - ))) - } - - fn max(&self) -> f64 { - self.max - } - - fn min(&self) -> f64 { - self.min + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Binary(&self.arg1, &self.arg2, self.binary_type) } } diff --git a/pumpkin-world/src/world_gen/noise/density/mod.rs b/pumpkin-world/src/world_gen/noise/density/mod.rs index a2edc99bc..5ecf32ef9 100644 --- a/pumpkin-world/src/world_gen/noise/density/mod.rs +++ b/pumpkin-world/src/world_gen/noise/density/mod.rs @@ -1,564 +1,696 @@ -use std::{ops::Deref, sync::Arc}; - -use blend::{BlendAlphaFunction, BlendDensityFunction, BlendOffsetFunction}; -use derive_getters::Getters; -use end::EndIslandFunction; +use std::sync::Arc; + +use basic::{ConstantFunction, RangeFunction, WrapperFunction, WrapperType}; +use blend::BlendDensityFunction; +use built_in_density_function::BLEND_ALPHA; +use component_functions::{ + ComponentReference, ComponentReferenceMap, ComponentReferenceMath, ConverterEnvironment, + NoEnvironment, SharedComponentReference, +}; use enum_dispatch::enum_dispatch; -use math::{BinaryFunction, BinaryType, LinearFunction}; -use noise::{InternalNoise, InterpolatedNoiseSampler, NoiseFunction, ShiftedNoiseFunction}; -use offset::{ShiftAFunction, ShiftBFunction}; -use spline::SplineFunction; -use terrain_helpers::{create_factor_spline, create_jaggedness_spline, create_offset_spline}; -use unary::{ClampFunction, UnaryFunction, UnaryType}; -use weird::{RarityMapper, WierdScaledFunction}; +use noise::{InternalNoise, NoiseFunction}; -use crate::world_gen::blender::Blender; +use crate::world_gen::{blender::Blender, chunk_noise::ChunkNoisePos}; -use super::{clamped_map, perlin::DoublePerlinNoiseParameters, BuiltInNoiseParams}; +use super::perlin::DoublePerlinNoiseParameters; -pub mod blend; -mod end; -mod math; +pub mod basic; +mod blend; +pub mod component_functions; +pub mod end; +pub mod math; pub mod noise; mod offset; -pub mod spline; +mod spline; mod terrain_helpers; mod unary; mod weird; -struct SlopedCheeseResult<'a> { - offset: Arc>, - factor: Arc>, - depth: Arc>, - jaggedness: Arc>, - sloped_cheese: Arc>, +#[derive(Debug)] +#[enum_dispatch(NoisePosImpl)] +pub enum NoisePos { + Unblended(UnblendedNoisePos), + Chunk(ChunkNoisePos), } -#[derive(Getters)] -pub struct BuiltInNoiseFunctions<'a> { - zero: Arc>, - ten: Arc>, - blend_alpha: Arc>, - blend_offset: Arc>, - y: Arc>, - shift_x: Arc>, - shift_z: Arc>, - base_3d_noise_overworld: Arc>, - base_3d_noise_nether: Arc>, - base_3d_noise_end: Arc>, - continents_overworld: Arc>, - erosion_overworld: Arc>, - ridges_overworld: Arc>, - ridges_folded_overworld: Arc>, - offset_overworld: Arc>, - factor_overworld: Arc>, - jaggedness_overworld: Arc>, - depth_overworld: Arc>, - sloped_cheese_overworld: Arc>, - continents_overworld_large_biome: Arc>, - erosion_overworld_large_biome: Arc>, - offset_overworld_large_biome: Arc>, - factor_overworld_large_biome: Arc>, - jaggedness_overworld_large_biome: Arc>, - depth_overworld_large_biome: Arc>, - sloped_cheese_overworld_large_biome: Arc>, - offset_overworld_amplified: Arc>, - factor_overworld_amplified: Arc>, - jaggedness_overworld_amplified: Arc>, - depth_overworld_amplified: Arc>, - sloped_cheese_overworld_amplified: Arc>, - sloped_cheese_end: Arc>, - caves_spaghetti_roughness_function_overworld: Arc>, - caves_spaghetti_2d_thickness_modular_overworld: Arc>, - caves_spaghetti_2d_overworld: Arc>, - caves_entrances_overworld: Arc>, - caves_noodle_overworld: Arc>, - caves_pillars_overworld: Arc>, +#[derive(Debug)] +pub struct UnblendedNoisePos { + x: i32, + y: i32, + z: i32, } -//Bits avaliable to encode y-pos -pub const SIZE_BITS_Y: i32 = 12; -pub const MAX_HEIGHT: i32 = (1 << SIZE_BITS_Y) - 32; -pub const MAX_COLUMN_HEIGHT: i32 = (MAX_HEIGHT >> 1) - 1; -pub const MIN_HEIGHT: i32 = MAX_COLUMN_HEIGHT - MAX_HEIGHT + 1; - -impl<'a> BuiltInNoiseFunctions<'a> { - pub fn new(built_in_noise_params: &BuiltInNoiseParams<'a>) -> Self { - let blend_alpha = Arc::new(DensityFunction::BlendAlpha(BlendAlphaFunction {})); - let blend_offset = Arc::new(DensityFunction::BlendOffset(BlendOffsetFunction {})); - let zero = Arc::new(DensityFunction::Constant(ConstantFunction::new(0f64))); - let ten = Arc::new(DensityFunction::Constant(ConstantFunction::new(10f64))); - - let y = Arc::new({ - DensityFunction::ClampedY(YClampedFunction { - from: MIN_HEIGHT * 2, - to: MAX_COLUMN_HEIGHT * 2, - from_val: (MIN_HEIGHT * 2) as f64, - to_val: (MAX_COLUMN_HEIGHT * 2) as f64, - }) - }); - - let shift_x = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftA(ShiftAFunction::new(Arc::new( - InternalNoise::new(built_in_noise_params.offset().clone(), None), - )))), - WrapperType::Cache2D, - ))), - WrapperType::CacheFlat, - )) - }); - - let shift_z = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftB(ShiftBFunction::new(Arc::new( - InternalNoise::new(built_in_noise_params.offset().clone(), None), - )))), - WrapperType::Cache2D, - ))), - WrapperType::CacheFlat, - )) - }); - - let base_3d_noise_overworld = Arc::new({ - DensityFunction::InterpolatedNoise( - InterpolatedNoiseSampler::create_base_3d_noise_function( - 0.25f64, 0.125f64, 80f64, 160f64, 8f64, - ), - ) - }); +impl UnblendedNoisePos { + pub fn new(x: i32, y: i32, z: i32) -> Self { + Self { x, y, z } + } +} - let base_3d_noise_nether = Arc::new({ - DensityFunction::InterpolatedNoise( - InterpolatedNoiseSampler::create_base_3d_noise_function( - 0.25f64, 0.375f64, 80f64, 60f64, 8f64, - ), - ) - }); +impl NoisePosImpl for UnblendedNoisePos { + fn x(&self) -> i32 { + self.x + } - let base_3d_noise_end = Arc::new({ - DensityFunction::InterpolatedNoise( - InterpolatedNoiseSampler::create_base_3d_noise_function( - 0.25f64, 0.25f64, 80f64, 160f64, 4f64, - ), + fn y(&self) -> i32 { + self.y + } + + fn z(&self) -> i32 { + self.z + } + + fn get_blender(&self) -> Blender { + Blender::NO_BLEND + } +} + +#[enum_dispatch] +pub trait NoisePosImpl { + fn x(&self) -> i32; + fn y(&self) -> i32; + fn z(&self) -> i32; + + fn get_blender(&self) -> Blender; +} + +pub mod built_in_density_function { + use std::sync::Arc; + + use lazy_static::lazy_static; + + use crate::world_gen::noise::built_in_noise_params; + use crate::world_gen::positions::{MAX_COLUMN_HEIGHT, MIN_HEIGHT}; + + use super::{apply_blending, noise_in_range, vertical_range_choice}; + + use super::basic::{ + ConstantFunction, RangeFunction, WrapperFunction, WrapperType, YClampedFunction, + }; + use super::blend::{BlendAlphaFunction, BlendOffsetFunction}; + use super::component_functions::{ + ComponentReferenceMap, ComponentReferenceMath, NoEnvironment, SharedComponentReference, + }; + use super::end::EndIslandFunction; + use super::noise::{ + InternalNoise, InterpolatedNoiseFunction, NoiseFunction, ShiftedNoiseFunction, + }; + use super::offset::{ShiftAFunction, ShiftBFunction}; + + use super::spline::{ImmutableSplineRef, SplineFunction}; + + use super::terrain_helpers::{ + create_factor_spline, create_jaggedness_spline, create_offset_spline, + }; + + use super::weird::{RarityMapper, WierdScaledFunction}; + + lazy_static! { + pub static ref ZERO: SharedComponentReference = ConstantFunction::new(0f64).into(); + pub static ref TEN: SharedComponentReference = ConstantFunction::new(10f64).into(); + pub static ref BLEND_ALPHA: SharedComponentReference = BlendAlphaFunction::INSTANCE.into(); + pub static ref BLEND_OFFSET: SharedComponentReference = + BlendOffsetFunction::INSTANCE.into(); + pub static ref Y: SharedComponentReference = YClampedFunction::new( + MIN_HEIGHT * 2, + MAX_COLUMN_HEIGHT as i32 * 2, + (MIN_HEIGHT * 2) as f64, + ((MAX_COLUMN_HEIGHT as i32) * 2) as f64 + ) + .into(); + pub static ref SHIFT_X: SharedComponentReference = + WrapperFunction::::new( + WrapperFunction::::new( + ShiftAFunction::new(Arc::new(InternalNoise::new( + &built_in_noise_params::OFFSET, + None + ))) + .into(), + WrapperType::Cache2D + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref SHIFT_Z: SharedComponentReference = + WrapperFunction::::new( + WrapperFunction::::new( + ShiftBFunction::new(Arc::new(InternalNoise::new( + &built_in_noise_params::OFFSET, + None + ))) + .into(), + WrapperType::Cache2D + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref BASE_3D_NOISE_OVERWORLD: SharedComponentReference = + InterpolatedNoiseFunction::create_base_3d_noise_function( + 0.25f64, 0.125f64, 80f64, 160f64, 8f64 ) - }); - - let continents_overworld = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - zero.clone(), - shift_z.clone(), + .into(); + pub static ref BASE_3D_NOISE_NETHER: SharedComponentReference = + InterpolatedNoiseFunction::create_base_3d_noise_function( + 0.25f64, 0.375f64, 80f64, 60f64, 8f64 + ) + .into(); + pub static ref BASE_3D_NOISE_END: SharedComponentReference = + InterpolatedNoiseFunction::create_base_3d_noise_function( + 0.25f64, 0.25f64, 80f64, 160f64, 4f64 + ) + .into(); + pub static ref CONTINENTS_OVERWORLD: SharedComponentReference = + WrapperFunction::::new( + ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, Arc::new(InternalNoise::new( - built_in_noise_params.continentalness().clone(), - None, - )), - ))), - WrapperType::CacheFlat, - )) - }); - - let erosion_overworld = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - zero.clone(), - shift_z.clone(), + &built_in_noise_params::CONTINENTALNESS, + None + )) + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref EROSION_OVERWORLD: SharedComponentReference = + WrapperFunction::::new( + ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, - Arc::new(InternalNoise::new( - built_in_noise_params.erosion().clone(), - None, - )), - ))), - WrapperType::CacheFlat, - )) - }); - - let ridges_overworld = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - zero.clone(), - shift_z.clone(), + Arc::new(InternalNoise::new(&built_in_noise_params::EROSION, None)) + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref RIDGES_OVERWORLD: SharedComponentReference = + WrapperFunction::::new( + ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, - Arc::new(InternalNoise::new( - built_in_noise_params.ridge().clone(), - None, - )), - ))), - WrapperType::CacheFlat, - )) - }); - - let ridges_folded_overworld = Arc::new({ - ridges_overworld - .abs() - .add_const(-0.6666666666666666f64) - .abs() - .add_const(-0.3333333333333333f64) - .mul_const(-3f64) - }); - - let overworld_sloped_cheese_result = sloped_cheese_function( - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.jagged().clone(), - None, - )), - 1500f64, - 0f64, - ))), - continents_overworld.clone(), - erosion_overworld.clone(), - ridges_overworld.clone(), - ridges_folded_overworld.clone(), - blend_offset.clone(), - ten.clone(), - zero.clone(), - base_3d_noise_overworld.clone(), - false, - ); + Arc::new(InternalNoise::new(&built_in_noise_params::RIDGE, None)) + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref RIDGES_FOLDED_OVERWORLD: SharedComponentReference = RIDGES_OVERWORLD + .clone() + .abs() + .add_const(-0.6666666666666666f64) + .abs() + .add_const(-0.3333333333333333f64) + .mul_const(-3f64); + static ref JAGGED_NOISE: SharedComponentReference = NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::JAGGED, None)), + 1500f64, + 0f64 + ) + .into(); + pub static ref OFFSET_OVERWORLD: SharedComponentReference = apply_blending( + ConstantFunction::new(-0.50375f32 as f64).add( + SplineFunction::::new( + create_offset_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into() + ), + BLEND_OFFSET.clone(), + ); + pub static ref FACTOR_OVERWORLD: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_factor_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into(), + TEN.clone(), + ); + pub static ref JAGGEDNESS_OVERWORLD: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_jaggedness_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into(), + ZERO.clone(), + ); + pub static ref DEPTH_OVERWORLD: SharedComponentReference = + YClampedFunction::new(-64, 320, 1.5f64, -1.5f64).add(OFFSET_OVERWORLD.clone()); + pub static ref SLOPED_CHEESE_OVERWORLD: SharedComponentReference = { + let density1 = JAGGEDNESS_OVERWORLD + .clone() + .mul(JAGGED_NOISE.clone().half_negative()); + let density2 = ConstantFunction::new(4f64).mul( + DEPTH_OVERWORLD + .clone() + .add(density1) + .mul(FACTOR_OVERWORLD.clone()) + .quarter_negative(), + ); - let continents_overworld_large_biome = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - zero.clone(), - shift_z.clone(), + density2.add(BASE_3D_NOISE_OVERWORLD.clone()) + }; + pub static ref CONTINENTS_OVERWORLD_LARGE_BIOME: SharedComponentReference = + WrapperFunction::::new( + ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, Arc::new(InternalNoise::new( - built_in_noise_params.continentalness_large().clone(), - None, - )), - ))), - WrapperType::CacheFlat, - )) - }); - - let erosion_overworld_large_biome = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - zero.clone(), - shift_z.clone(), + &built_in_noise_params::CONTINENTALNESS_LARGE, + None + )) + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref EROSION_OVERWORLD_LARGE_BIOME: SharedComponentReference = + WrapperFunction::::new( + ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, Arc::new(InternalNoise::new( - built_in_noise_params.erosion_large().clone(), - None, - )), - ))), - WrapperType::CacheFlat, - )) - }); - - let overworld_large_biome_sloped_cheese_result = sloped_cheese_function( - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.jagged().clone(), - None, - )), - 1500f64, - 0f64, - ))), - continents_overworld_large_biome.clone(), - erosion_overworld_large_biome.clone(), - ridges_overworld.clone(), - ridges_folded_overworld.clone(), - blend_offset.clone(), - ten.clone(), - zero.clone(), - base_3d_noise_overworld.clone(), - false, - ); + &built_in_noise_params::EROSION_LARGE, + None + )) + ) + .into(), + WrapperType::FlatCache + ) + .into(); + pub static ref OFFSET_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending( + ConstantFunction::new(-0.50375f32 as f64).add( + SplineFunction::::new( + create_offset_spline( + CONTINENTS_OVERWORLD_LARGE_BIOME.clone(), + EROSION_OVERWORLD_LARGE_BIOME.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into() + ), + BLEND_OFFSET.clone() + ); + pub static ref FACTOR_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_factor_spline( + CONTINENTS_OVERWORLD_LARGE_BIOME.clone(), + EROSION_OVERWORLD_LARGE_BIOME.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into(), + TEN.clone() + ); + pub static ref JAGGEDNESS_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_jaggedness_spline( + CONTINENTS_OVERWORLD_LARGE_BIOME.clone(), + EROSION_OVERWORLD_LARGE_BIOME.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ) + .into() + ) + .into(), + ZERO.clone() + ); + pub static ref DEPTH_OVERWORLD_LARGE_BIOME: SharedComponentReference = + YClampedFunction::new(-64, 320, 1.5f64, -1.5f64) + .add(OFFSET_OVERWORLD_LARGE_BIOME.clone()); + pub static ref SLOPED_CHEESE_OVERWORLD_LARGE_BIOME: SharedComponentReference = { + let density1 = JAGGEDNESS_OVERWORLD_LARGE_BIOME + .clone() + .mul(JAGGED_NOISE.clone().half_negative()); + let density2 = ConstantFunction::new(4f64).mul( + DEPTH_OVERWORLD_LARGE_BIOME + .clone() + .add(density1) + .mul(FACTOR_OVERWORLD_LARGE_BIOME.clone()) + .quarter_negative(), + ); - let overworld_amplified_sloped_cheese_result = sloped_cheese_function( - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.jagged().clone(), - None, - )), - 1500f64, - 0f64, - ))), - continents_overworld.clone(), - erosion_overworld.clone(), - ridges_overworld.clone(), - ridges_folded_overworld.clone(), - blend_offset.clone(), - ten.clone(), - zero.clone(), - base_3d_noise_overworld.clone(), - true, - ); + density2.add(BASE_3D_NOISE_OVERWORLD.clone()) + }; + pub static ref OFFSET_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending( + ConstantFunction::new(-0.50375f32 as f64).add( + SplineFunction::::new( + create_offset_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + true + ) + .into() + ) + .into() + ), + BLEND_OFFSET.clone() + ); + pub static ref FACTOR_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_factor_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + true + ) + .into() + ) + .into(), + TEN.clone() + ); + pub static ref JAGGEDNESS_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending( + SplineFunction::::new( + create_jaggedness_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + true + ) + .into() + ) + .into(), + ZERO.clone() + ); + pub static ref DEPTH_OVERWORLD_AMPLIFIED: SharedComponentReference = + YClampedFunction::new(-64, 320, 1.5f64, -1.5f64) + .add(OFFSET_OVERWORLD_AMPLIFIED.clone()); + pub static ref SLOPED_CHEESE_OVERWORLD_AMPLIFIED: SharedComponentReference = { + let density1 = JAGGEDNESS_OVERWORLD_AMPLIFIED + .clone() + .mul(JAGGED_NOISE.clone().half_negative()); + let density2 = ConstantFunction::new(4f64).mul( + DEPTH_OVERWORLD_AMPLIFIED + .clone() + .add(density1) + .mul(FACTOR_OVERWORLD_AMPLIFIED.clone()) + .quarter_negative(), + ); - let sloped_cheese_end = Arc::new({ - DensityFunction::EndIsland(EndIslandFunction::new(0)).add(base_3d_noise_end.clone()) - }); - - let caves_spaghetti_roughness_function_overworld = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new( - noise_in_range( - built_in_noise_params - .spaghetti_roughness_modulator() - .clone(), - 1f64, + density2.add(BASE_3D_NOISE_OVERWORLD.clone()) + }; + pub static ref SLOPED_CHEESE_END: SharedComponentReference = + EndIslandFunction::new(0).add(BASE_3D_NOISE_END.clone()); + pub static ref CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD: SharedComponentReference = + WrapperFunction::::new( + noise_in_range( + &built_in_noise_params::SPAGHETTI_ROUGHNESS_MODULATOR, + 1f64, + 1f64, + 0f64, + -0.1f64 + ) + .mul( + Into::::into(NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::SPAGHETTI_ROUGHNESS, + None + )), 1f64, - 0f64, - -0.1f64, - ) - .mul(Arc::new( - DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_roughness().clone(), - None, - )), - 1f64, - 1f64, - )) - .abs() - .add_const(-0.4f64), - )), + 1f64 + )) + .abs() + .add_const(-0.4f64) ), - WrapperType::CacheOnce, - )) - }); - - let caves_spaghetti_2d_thickness_modular_overworld = Arc::new({ - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(noise_in_range( - built_in_noise_params.spaghetti_2d_thickness().clone(), + WrapperType::OnceCache, + ) + .into(); + pub static ref CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD: SharedComponentReference = + WrapperFunction::::new( + noise_in_range( + &built_in_noise_params::SPAGHETTI_2D_THICKNESS, 2f64, 1f64, -0.6f64, - -1.3f64, - )), - WrapperType::CacheOnce, - )) - }); - - let caves_spaghetti_2d_overworld = Arc::new({ - let function1 = DensityFunction::Noise(NoiseFunction::new( + -1.3f64 + ), + WrapperType::OnceCache, + ) + .into(); + pub static ref CAVES_SPAGHETTI_2D_OVERWORLD: SharedComponentReference = { + let function1 = NoiseFunction::new( Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_2d_modulator().clone(), + &built_in_noise_params::SPAGHETTI_2D_MODULATOR, None, )), 2f64, 1f64, - )); + ); - let function2 = DensityFunction::Wierd(WierdScaledFunction::new( - Arc::new(function1), + let function2 = WierdScaledFunction::::new( + function1.into(), Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_2d().clone(), + &built_in_noise_params::SPAGHETTI_2D, None, )), RarityMapper::Caves, - )); + ); let function3 = noise_in_range( - built_in_noise_params.spaghetti_2d_elevation().clone(), + &built_in_noise_params::SPAGHETTI_2D_ELEVATION, 1f64, 0f64, ((-64i32) / 8i32) as f64, 8f64, ); - let function4 = caves_spaghetti_2d_thickness_modular_overworld.clone(); + let function4 = CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD.clone(); - let function5 = function3.add(Arc::new( - DensityFunction::ClampedY(YClampedFunction { - from: -64, - to: 320, - from_val: 8f64, - to_val: -40f64, - }) - .abs(), - )); + let function5 = function3.add(YClampedFunction::new(-64, 320, 8f64, -40f64).abs()); - let function6 = Arc::new(function5.add(function4.clone()).cube()); + let function6 = function5.add(function4.clone()).cube(); - let function7 = function2.add(Arc::new(function4.mul_const(0.083f64))); + let function7 = function2.add(function4.mul_const(0.083f64)); - function7.binary_max(function6).clamp(-1f64, 1f64) - }); - - let caves_entrances_overworld = Arc::new({ - let function = DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_3d_rarity().clone(), - None, - )), - 2f64, - 1f64, - )); + function7.max(function6).clamp(-1f64, 1f64) + }; + pub static ref CAVES_ENTRANCES_OVERWORLD: SharedComponentReference = { + let function_ref: SharedComponentReference = + WrapperFunction::::new( + NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::SPAGHETTI_3D_RARITY, + None, + )), + 2f64, + 1f64, + ) + .into(), + WrapperType::OnceCache, + ) + .into(); - let function2 = Arc::new(noise_in_range( - built_in_noise_params.spaghetti_3d_thickness().clone(), + let function2 = noise_in_range( + &built_in_noise_params::SPAGHETTI_3D_THICKNESS, 1f64, 1f64, -0.065f64, -0.088f64, - )); + ); - let function3 = DensityFunction::Wierd(WierdScaledFunction::new( - Arc::new(function.clone()), + let function3 = WierdScaledFunction::::new( + function_ref.clone(), Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_3d_1().clone(), + &built_in_noise_params::SPAGHETTI_3D_1, None, )), RarityMapper::Tunnels, - )); + ); - let function4 = Arc::new(DensityFunction::Wierd(WierdScaledFunction::new( - Arc::new(function), + let function4 = WierdScaledFunction::::new( + function_ref, Arc::new(InternalNoise::new( - built_in_noise_params.spaghetti_3d_2().clone(), + &built_in_noise_params::SPAGHETTI_3D_2, None, )), RarityMapper::Tunnels, - ))); - - let function5 = Arc::new( - function3 - .binary_max(function4) - .add(function2) - .clamp(-1f64, 1f64), ); + let function5 = function3 + .max(function4.into()) + .add(function2) + .clamp(-1f64, 1f64); - let function6 = caves_spaghetti_roughness_function_overworld.clone(); + let function6 = CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD.clone(); - let function7 = DensityFunction::Noise(NoiseFunction::new( + let function7 = NoiseFunction::new( Arc::new(InternalNoise::new( - built_in_noise_params.cave_entrance().clone(), + &built_in_noise_params::CAVE_ENTRANCE, None, )), 0.75f64, 0.5f64, - )); + ); let function8 = function7 .add_const(0.37f64) - .add(Arc::new(DensityFunction::ClampedY(YClampedFunction { - from: -10, - to: 30, - from_val: 0.3f64, - to_val: 0f64, - }))); - - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(function8.binary_min(Arc::new(function6.add(function5)))), - WrapperType::CacheOnce, - )) - }); - - let caves_noodle_overworld = Arc::new({ - let function = y.clone(); - - let function2 = veritcal_range_choice( - function.clone(), - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.noodle().clone(), - None, - )), + .add(YClampedFunction::new(-10, 30, 0.3f64, 0f64).into()); + + WrapperFunction::::new( + function8.min(function6.add(function5)), + WrapperType::OnceCache, + ) + .into() + }; + pub static ref CAVES_NOODLE_OVERWORLD: SharedComponentReference = { + let function2 = vertical_range_choice( + Y.clone(), + NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)), 1f64, 1f64, - ))), + ) + .into(), -60, 320, -1, ); - let function3 = veritcal_range_choice( - function.clone(), - Arc::new(noise_in_range( - built_in_noise_params.noodle_thickness().clone(), + let function3 = vertical_range_choice( + Y.clone(), + noise_in_range( + &built_in_noise_params::NOODLE_THICKNESS, 1f64, 1f64, -0.05f64, -0.1f64, - )), + ), -60, 320, 0, ); - let function4 = veritcal_range_choice( - function.clone(), - Arc::new(DensityFunction::Noise(NoiseFunction::new( + let function4 = vertical_range_choice( + Y.clone(), + NoiseFunction::new( Arc::new(InternalNoise::new( - built_in_noise_params.noodle_ridge_a().clone(), + &built_in_noise_params::NOODLE_RIDGE_A, None, )), 2.6666666666666665f64, 2.6666666666666665f64, - ))), + ) + .into(), -60, 320, 0, ); - let function5 = veritcal_range_choice( - function.clone(), - Arc::new(DensityFunction::Noise(NoiseFunction::new( + let function5 = vertical_range_choice( + Y.clone(), + NoiseFunction::new( Arc::new(InternalNoise::new( - built_in_noise_params.noodle_ridge_b().clone(), + &built_in_noise_params::NOODLE_RIDGE_B, None, )), 2.6666666666666665f64, 2.6666666666666665f64, - ))), + ) + .into(), -60, 320, 0, ); - let function6 = Arc::new( - function4 - .abs() - .binary_max(Arc::new(function5.abs())) - .mul_const(1.5f64), - ); + let function6 = function4.abs().max(function5.abs()).mul_const(1.5f64); - DensityFunction::Range(RangeFunction { - input: Arc::new(function2), - min: -1000000f64, - max: 0f64, - in_range: Arc::new(DensityFunction::Constant(ConstantFunction::new(64f64))), - out_range: Arc::new(function3.add(function6)), - }) - }); - - let caves_pillars_overworld = Arc::new({ - let function = DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - built_in_noise_params.pillar().clone(), - None, - )), + RangeFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + function2, + -1000000f64, + 0f64, + ConstantFunction::new(64f64).into(), + function3.add(function6), + ) + .into() + }; + pub static ref CAVES_PILLARS_OVERWORLD: SharedComponentReference = { + let function = NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::PILLAR, None)), 25f64, 0.3f64, - )); + ); - let function2 = Arc::new(noise_in_range( - built_in_noise_params.pillar_rareness().clone(), + let function2 = noise_in_range( + &built_in_noise_params::PILLAR_RARENESS, 1f64, 1f64, 0f64, -2f64, - )); + ); let function3 = noise_in_range( - built_in_noise_params.pillar_thickness().clone(), + &built_in_noise_params::PILLAR_THICKNESS, 1f64, 1f64, 0f64, @@ -567,127 +699,12 @@ impl<'a> BuiltInNoiseFunctions<'a> { let function4 = function.mul_const(2f64).add(function2); - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(function4.mul(Arc::new(function3.cube()))), - WrapperType::CacheOnce, - )) - }); - - Self { - zero, - ten, - blend_offset, - blend_alpha, - y, - shift_x, - shift_z, - base_3d_noise_overworld, - base_3d_noise_nether, - base_3d_noise_end, - continents_overworld, - erosion_overworld, - ridges_overworld, - ridges_folded_overworld, - offset_overworld: overworld_sloped_cheese_result.offset, - factor_overworld: overworld_sloped_cheese_result.factor, - jaggedness_overworld: overworld_sloped_cheese_result.jaggedness, - depth_overworld: overworld_sloped_cheese_result.depth, - sloped_cheese_overworld: overworld_sloped_cheese_result.sloped_cheese, - continents_overworld_large_biome, - erosion_overworld_large_biome, - offset_overworld_large_biome: overworld_large_biome_sloped_cheese_result.offset, - factor_overworld_large_biome: overworld_large_biome_sloped_cheese_result.factor, - jaggedness_overworld_large_biome: overworld_large_biome_sloped_cheese_result.jaggedness, - depth_overworld_large_biome: overworld_large_biome_sloped_cheese_result.depth, - sloped_cheese_overworld_large_biome: overworld_large_biome_sloped_cheese_result - .sloped_cheese, - offset_overworld_amplified: overworld_amplified_sloped_cheese_result.offset, - factor_overworld_amplified: overworld_amplified_sloped_cheese_result.factor, - jaggedness_overworld_amplified: overworld_amplified_sloped_cheese_result.jaggedness, - depth_overworld_amplified: overworld_amplified_sloped_cheese_result.depth, - sloped_cheese_overworld_amplified: overworld_amplified_sloped_cheese_result - .sloped_cheese, - sloped_cheese_end, - caves_spaghetti_roughness_function_overworld, - caves_spaghetti_2d_thickness_modular_overworld, - caves_spaghetti_2d_overworld, - caves_entrances_overworld, - caves_noodle_overworld, - caves_pillars_overworld, - } - } -} - -#[allow(clippy::too_many_arguments)] -fn sloped_cheese_function<'a>( - jagged_noise: Arc>, - continents: Arc>, - erosion: Arc>, - ridges: Arc>, - ridges_folded: Arc>, - blend_offset: Arc>, - ten: Arc>, - zero: Arc>, - base_3d_noise_overworld: Arc>, - amplified: bool, -) -> SlopedCheeseResult<'a> { - let offset = Arc::new(apply_blending( - Arc::new( - DensityFunction::Constant(ConstantFunction::new(-0.50375f32 as f64)).add(Arc::new( - DensityFunction::Spline(SplineFunction::new(Arc::new(create_offset_spline( - continents.clone(), - erosion.clone(), - ridges_folded.clone(), - amplified, - )))), - )), - ), - blend_offset, - )); - - let factor = Arc::new(apply_blending( - Arc::new(DensityFunction::Spline(SplineFunction::new(Arc::new( - create_factor_spline( - continents.clone(), - erosion.clone(), - ridges.clone(), - ridges_folded.clone(), - amplified, - ), - )))), - ten, - )); - - let depth = Arc::new( - DensityFunction::ClampedY(YClampedFunction { - from: -64, - to: 320, - from_val: 1.5f64, - to_val: -1.5f64, - }) - .add(offset.clone()), - ); - - let jaggedness = Arc::new(apply_blending( - Arc::new(DensityFunction::Spline(SplineFunction::new(Arc::new( - create_jaggedness_spline(continents, erosion, ridges, ridges_folded, amplified), - )))), - zero, - )); - - let density1 = Arc::new(jaggedness.mul(Arc::new(jagged_noise.half_negative()))); - let density2 = DensityFunction::Constant(ConstantFunction::new(4f64)).mul(Arc::new( - depth.add(density1).mul(factor.clone()).quarter_negative(), - )); - - let sloped_cheese = Arc::new(density2.add(base_3d_noise_overworld)); - - SlopedCheeseResult { - offset, - factor, - depth, - jaggedness, - sloped_cheese, + WrapperFunction::::new( + function4.mul(function3.cube()), + WrapperType::OnceCache, + ) + .into() + }; } } @@ -695,925 +712,805 @@ pub fn peaks_valleys_noise(variance: f32) -> f32 { -((variance.abs() - 0.6666667f32).abs() - 0.33333334f32) * 3f32 } -pub fn veritcal_range_choice<'a>( - input: Arc>, - in_range: Arc>, +pub fn vertical_range_choice( + input: SharedComponentReference, + in_range: SharedComponentReference, min: i32, max: i32, out: i32, -) -> DensityFunction<'a> { - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::Range(RangeFunction { +) -> SharedComponentReference { + WrapperFunction::::new( + RangeFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( input, - min: min as f64, - max: (max + 1) as f64, + min as f64, + (max + 1) as f64, in_range, - out_range: Arc::new(DensityFunction::Constant(ConstantFunction::new(out as f64))), - })), + ConstantFunction::new(out as f64).into(), + ) + .into(), WrapperType::Interpolated, - )) + ) + .into() } -pub fn apply_blend_density(density: DensityFunction) -> DensityFunction { - let function = DensityFunction::BlendDensity(BlendDensityFunction::new(Arc::new(density))); - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(function), - WrapperType::Interpolated, - )) +pub fn apply_blend_density(density: SharedComponentReference) -> SharedComponentReference { + let function = BlendDensityFunction::::new(density); + Into::::into( + WrapperFunction::::new( + function.into(), + WrapperType::Interpolated, + ), + ) .mul_const(0.64f64) .squeeze() } -fn apply_blending<'a>( - function: Arc>, - blend: Arc>, -) -> DensityFunction<'a> { - let function = lerp_density( - Arc::new(DensityFunction::BlendAlpha(BlendAlphaFunction {})), - blend, - function, - ); - - DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(DensityFunction::Wrapper(WrapperFunction::new( - Arc::new(function), +fn apply_blending( + function: SharedComponentReference, + blend: SharedComponentReference, +) -> SharedComponentReference { + let function = lerp_density(BLEND_ALPHA.clone(), blend, function); + + WrapperFunction::::new( + WrapperFunction::::new( + function, WrapperType::Cache2D, - ))), - WrapperType::CacheFlat, - )) + ) + .into(), + WrapperType::FlatCache, + ) + .into() } fn noise_in_range( - noise: DoublePerlinNoiseParameters, + noise: &'static DoublePerlinNoiseParameters, xz_scale: f64, y_scale: f64, min: f64, max: f64, -) -> DensityFunction { +) -> SharedComponentReference { map_range( - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise, None)), - xz_scale, - y_scale, - ))), + NoiseFunction::new(Arc::new(InternalNoise::new(noise, None)), xz_scale, y_scale).into(), min, max, ) } -fn map_range(function: Arc, min: f64, max: f64) -> DensityFunction { +fn map_range(function: SharedComponentReference, min: f64, max: f64) -> SharedComponentReference { let d = (min + max) * 0.5f64; let e = (max - min) * 0.5f64; - DensityFunction::Constant(ConstantFunction::new(d)).add(Arc::new( - DensityFunction::Constant(ConstantFunction::new(e)).mul(function), - )) + function.mul_const(e).add_const(d) } -#[derive(Clone)] -#[enum_dispatch(DensityFunctionImpl)] -pub enum DensityFunction<'a> { - Clamp(ClampFunction<'a>), - Unary(UnaryFunction<'a>), - Noise(NoiseFunction<'a>), - ShiftA(ShiftAFunction<'a>), - ShiftB(ShiftBFunction<'a>), - ShiftedNoise(ShiftedNoiseFunction<'a>), - Spline(SplineFunction<'a>), - Constant(ConstantFunction), - Linear(LinearFunction<'a>), - Binary(BinaryFunction<'a>), - BlendOffset(BlendOffsetFunction), - BlendAlpha(BlendAlphaFunction), - BlendDensity(BlendDensityFunction<'a>), - ClampedY(YClampedFunction), - InterpolatedNoise(InterpolatedNoiseSampler), - EndIsland(EndIslandFunction), - Wierd(WierdScaledFunction<'a>), - Range(RangeFunction<'a>), - Wrapper(WrapperFunction<'a>), +pub fn lerp_density( + delta: SharedComponentReference, + start: SharedComponentReference, + end: SharedComponentReference, +) -> SharedComponentReference { + if let ConverterEnvironment::::Constant(constant) = start.environment() { + lerp_density_static_start(delta, constant, end) + } else { + let function_ref: SharedComponentReference = WrapperFunction::< + NoEnvironment, + SharedComponentReference, + >::new(delta, WrapperType::OnceCache) + .into(); + + let function2 = function_ref.clone().mul_const(-1f64).add_const(1f64); + start.mul(function2).add(end.mul(function_ref)) + } } -impl<'a> DensityFunction<'a> { - pub fn clamp(&self, min: f64, max: f64) -> Self { - assert!(min <= max); - Self::Clamp(ClampFunction { - input: Arc::new(self.clone()), - min, - max, - }) - } +pub fn lerp_density_static_start( + delta: SharedComponentReference, + start: f64, + end: SharedComponentReference, +) -> SharedComponentReference { + delta.mul(end.add_const(-start)).add_const(start) +} - pub fn abs(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::Abs, - Arc::new(self.clone()), - )) +#[cfg(test)] +mod test { + use std::sync::Arc; + + use pumpkin_core::random::{ + legacy_rand::LegacyRand, RandomDeriver, RandomDeriverImpl, RandomImpl, + }; + + use crate::world_gen::noise::{ + built_in_noise_params, + density::{built_in_density_function::*, NoisePos, UnblendedNoisePos}, + perlin::DoublePerlinNoiseSampler, + }; + + use super::{ + component_functions::{ + ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ComponentReferenceMath, ConversionResultPre, ConverterEnvironment, ConverterImpl, + DensityFunctionEnvironment, EnvironmentApplierImpl, MutableComponentFunctionImpl, + MutableComponentReference, NoEnvironment, OwnedConverterEnvironment, + SharedComponentReference, + }, + noise::{InternalNoise, NoiseFunction}, + }; + + pub struct TestConverter { + pub splitter: RandomDeriver, } - pub fn square(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::Square, - Arc::new(self.clone()), - )) - } + impl ConverterImpl for TestConverter { + fn convert_noise(&mut self, noise: &Arc) -> Option> { + let id = noise.parameters.id(); + let mut rand = self.splitter.split_string(id); + let sampler = DoublePerlinNoiseSampler::new(&mut rand, noise.parameters, false); - pub fn cube(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::Cube, - Arc::new(self.clone()), - )) - } + Some(Arc::new(InternalNoise::new( + noise.parameters, + Some(sampler), + ))) + } - pub fn half_negative(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::HalfNeg, - Arc::new(self.clone()), - )) - } + fn convert_env_pre_internal( + &mut self, + _component: ConverterEnvironment, + ) -> ConversionResultPre { + ConversionResultPre::Default + } - pub fn quarter_negative(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::QuartNeg, - Arc::new(self.clone()), - )) - } + fn converts_post_internal( + &mut self, + _component: ConverterEnvironment, + ) -> bool { + false + } - pub fn squeeze(&self) -> Self { - Self::Unary(UnaryFunction::create( - UnaryType::Squeeze, - Arc::new(self.clone()), - )) + fn convert_env_post_internal( + &mut self, + _component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation { + unreachable!() + } } - pub fn add_const(&self, val: f64) -> Self { - self.add(Arc::new(Self::Constant(ConstantFunction::new(val)))) - } + #[test] + fn test_density_function_correctness() { + let pos = NoisePos::Unblended(UnblendedNoisePos { x: 0, y: 0, z: 0 }); - pub fn add(&self, other: Arc>) -> Self { - BinaryFunction::create(BinaryType::Add, Arc::new(self.clone()), other) - } + assert_eq!(BLEND_ALPHA.sample(&pos), 1f64); - pub fn mul_const(&self, val: f64) -> Self { - self.mul(Arc::new(Self::Constant(ConstantFunction::new(val)))) - } + assert_eq!(BLEND_OFFSET.sample(&pos), 0f64); - pub fn mul(&self, other: Arc>) -> Self { - BinaryFunction::create(BinaryType::Mul, Arc::new(self.clone()), other) - } + assert_eq!(ZERO.sample(&pos), 0f64); - pub fn binary_min(&self, other: Arc>) -> Self { - BinaryFunction::create(BinaryType::Min, Arc::new(self.clone()), other) - } + assert_eq!(Y.sample(&pos), 0f64); - pub fn binary_max(&self, other: Arc>) -> Self { - BinaryFunction::create(BinaryType::Max, Arc::new(self.clone()), other) - } -} + assert_eq!(SHIFT_X.sample(&pos), 0f64); -pub struct Unused<'a> { - _x: &'a str, -} + assert_eq!(SHIFT_Z.sample(&pos), 0f64); -impl<'a> NoisePosImpl for Unused<'a> { - fn x(&self) -> i32 { - todo!() - } + assert_eq!(BASE_3D_NOISE_OVERWORLD.sample(&pos), 0.05283727086562935f64); - fn y(&self) -> i32 { - todo!() - } + assert_eq!(BASE_3D_NOISE_NETHER.sample(&pos), 0.05283727086562935f64); - fn z(&self) -> i32 { - todo!() - } -} + assert_eq!(BASE_3D_NOISE_END.sample(&pos), 0.05283727086562935f64); -impl<'a> ApplierImpl<'a> for Unused<'a> { - fn at(&self, _index: usize) -> NoisePos<'a> { - todo!() - } + assert_eq!(CONTINENTS_OVERWORLD.sample(&pos), 0f64); - fn fill(&self, _densities: &mut [f64], _function: &DensityFunction<'a>) { - todo!() - } -} + assert_eq!(EROSION_OVERWORLD.sample(&pos), 0f64); -impl<'a> VisitorImpl<'a> for Unused<'a> { - fn apply(&self, _function: Arc>) -> Arc> { - todo!() - } -} + assert_eq!(RIDGES_OVERWORLD.sample(&pos), 0f64); -#[enum_dispatch(NoisePosImpl)] -pub enum NoisePos<'a> { - Unblended(UnblendedNoisePos), - Todo(Unused<'a>), -} + assert_eq!(RIDGES_FOLDED_OVERWORLD.sample(&pos), -1f64); -pub struct UnblendedNoisePos { - x: i32, - y: i32, - z: i32, -} + assert_eq!(OFFSET_OVERWORLD.sample(&pos), -0.6037500277161598f64); -impl UnblendedNoisePos { - pub fn new(x: i32, y: i32, z: i32) -> Self { - Self { x, y, z } - } -} + assert_eq!(FACTOR_OVERWORLD.sample(&pos), 5.549900531768799f64); -impl NoisePosImpl for UnblendedNoisePos { - fn x(&self) -> i32 { - self.x - } + assert_eq!(JAGGEDNESS_OVERWORLD.sample(&pos), 0f64); - fn y(&self) -> i32 { - self.y - } + assert_eq!(DEPTH_OVERWORLD.sample(&pos), 0.3962499722838402f64); - fn z(&self) -> i32 { - self.z - } -} + assert_eq!(SLOPED_CHEESE_OVERWORLD.sample(&pos), 8.849428998431454f64); -#[enum_dispatch] -pub trait NoisePosImpl { - fn x(&self) -> i32; - fn y(&self) -> i32; - fn z(&self) -> i32; + assert_eq!(CONTINENTS_OVERWORLD_LARGE_BIOME.sample(&pos), 0f64); - fn get_blender(&self) -> Blender { - unimplemented!() - } -} + assert_eq!(EROSION_OVERWORLD_LARGE_BIOME.sample(&pos), 0f64); -#[enum_dispatch(ApplierImpl)] -pub enum Applier<'a> { - Todo(Unused<'a>), -} + assert_eq!( + OFFSET_OVERWORLD_LARGE_BIOME.sample(&pos), + -0.6037500277161598f64 + ); -#[enum_dispatch] -pub trait ApplierImpl<'a> { - fn at(&self, index: usize) -> NoisePos<'a>; + assert_eq!( + FACTOR_OVERWORLD_LARGE_BIOME.sample(&pos), + 5.549900531768799f64 + ); - fn fill(&self, densities: &mut [f64], function: &DensityFunction<'a>); -} + assert_eq!(JAGGEDNESS_OVERWORLD_LARGE_BIOME.sample(&pos), 0f64); -#[enum_dispatch(VisitorImpl)] -pub enum Visitor<'a> { - Unwrap(UnwrapVisitor), - Todo(Unused<'a>), -} + assert_eq!( + DEPTH_OVERWORLD_LARGE_BIOME.sample(&pos), + 0.3962499722838402f64 + ); -pub struct UnwrapVisitor {} + assert_eq!( + SLOPED_CHEESE_OVERWORLD_LARGE_BIOME.sample(&pos), + 8.849428998431454f64 + ); -impl<'a> VisitorImpl<'a> for UnwrapVisitor { - fn apply(&self, function: Arc>) -> Arc> { - match function.deref() { - DensityFunction::Wrapper(wrapper) => wrapper.wrapped(), - _ => function.clone(), - } - } -} + assert_eq!( + OFFSET_OVERWORLD_AMPLIFIED.sample(&pos), + -0.6037500277161598f64 + ); -#[enum_dispatch] -pub trait VisitorImpl<'a> { - fn apply(&self, function: Arc>) -> Arc>; + assert_eq!( + FACTOR_OVERWORLD_AMPLIFIED.sample(&pos), + 0.6516130566596985f64 + ); - fn apply_internal_noise<'b>(&self, function: Arc>) -> Arc> { - function.clone() - } -} + assert_eq!(JAGGEDNESS_OVERWORLD_AMPLIFIED.sample(&pos), 0f64); -#[enum_dispatch] -pub trait DensityFunctionImpl<'a> { - fn sample(&self, pos: &NoisePos) -> f64; + assert_eq!( + DEPTH_OVERWORLD_AMPLIFIED.sample(&pos), + 0.3962499722838402f64 + ); - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>); + assert_eq!( + SLOPED_CHEESE_OVERWORLD_AMPLIFIED.sample(&pos), + 1.085643893430405f64 + ); - fn apply(&self, visitor: &Visitor<'a>) -> Arc>; + assert_eq!(SLOPED_CHEESE_END.sample(&pos), 0.6153372708656294f64); - fn min(&self) -> f64; + assert_eq!( + CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD.sample(&pos), + 0.020000000000000004f64 + ); - fn max(&self) -> f64; -} + assert_eq!( + CAVES_ENTRANCES_OVERWORLD.sample(&pos), + -0.056499999999999995f64 + ); -#[derive(Clone)] -pub struct ConstantFunction { - value: f64, -} + assert_eq!(CAVES_NOODLE_OVERWORLD.sample(&pos), -0.07500000000000001f64); -impl ConstantFunction { - pub fn new(value: f64) -> Self { - ConstantFunction { value } - } -} + assert_eq!( + CAVES_PILLARS_OVERWORLD.sample(&pos), + -0.16637500000000005f64 + ); -impl<'a> DensityFunctionImpl<'a> for ConstantFunction { - fn sample(&self, _pos: &NoisePos) -> f64 { - self.value - } + assert_eq!( + CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD.sample(&pos), + -0.95f64 + ); - fn fill(&self, densities: &mut [f64], _applier: &Applier) { - densities.fill(self.value) + assert_eq!(CAVES_SPAGHETTI_2D_OVERWORLD.sample(&pos), -0.07885f64); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::Constant(self.clone()))) + #[test] + fn test_conversion() { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 0, 0)); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut rand2 = splitter.split_string("test"); + assert_eq!(rand2.next_i32(), 457448999); + + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + + let shift_x = SHIFT_X.clone(); + assert_eq!(shift_x.sample(pos), 0f64); + + let converted_shift_x = shift_x.clone().convert(&mut converter).assert_shared(); + assert_eq!(converted_shift_x.sample(pos), -1.0434329952492611f64); + + let converted = ZERO.clone().convert(&mut converter).assert_shared(); + assert_eq!(converted.sample(pos), 0f64); + + let converted = Y.clone().convert(&mut converter).assert_shared(); + assert_eq!(converted.sample(pos), 0f64); + + let converted = SHIFT_Z.clone().convert(&mut converter).assert_shared(); + assert_eq!(converted.sample(pos), -1.0434329952492611f64); + + let converted = BASE_3D_NOISE_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.05283727086562935f64); + + let converted = BASE_3D_NOISE_NETHER + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.05283727086562935f64); + + let converted = BASE_3D_NOISE_END + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.05283727086562935f64); + + let converted = CONTINENTS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.07789864655134425f64); + + let converted = EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.1909838546072366f64); + + let converted = RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.18402646504201148f64); + + let converted = RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.4479206048739655f64); + + let converted = OFFSET_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.4883981039747596f64); + + let converted = FACTOR_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 5.053797245025635f64); + + let converted = JAGGEDNESS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0f64); + + let converted = DEPTH_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.5116018960252404f64); + + let converted = SLOPED_CHEESE_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 10.394966281594634f64); + + let converted = CONTINENTS_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.5413000828801735f64); + + let converted = EROSION_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.22584626355586912f64); + + let converted = OFFSET_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.3040638118982315f64); + + let converted = FACTOR_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 6.040968418121338f64); + + let converted = JAGGEDNESS_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0f64); + + let converted = DEPTH_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.6959361881017685f64); + + let converted = SLOPED_CHEESE_OVERWORLD_LARGE_BIOME + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 16.869351404267768f64); + + let converted = OFFSET_OVERWORLD_AMPLIFIED + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.47187428921461105f64); + + let converted = FACTOR_OVERWORLD_AMPLIFIED + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.6070870161056519f64); + + let converted = JAGGEDNESS_OVERWORLD_AMPLIFIED + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0f64); + + let converted = DEPTH_OVERWORLD_AMPLIFIED + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.528125710785389f64); + + let converted = SLOPED_CHEESE_OVERWORLD_AMPLIFIED + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 1.3353103184231423f64); + + let converted = SLOPED_CHEESE_END + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.6153372708656294f64); + + let converted = CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.0022723587537428667f64); + + let converted = CAVES_ENTRANCES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 0.20826666534765442f64); + + let converted = CAVES_NOODLE_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 64f64); + + let converted = CAVES_PILLARS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.0863817754261902f64); + + let converted = CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), -0.9871490512034798f64); + + let converted = CAVES_SPAGHETTI_2D_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + assert_eq!(converted.sample(pos), 1f64); } - fn min(&self) -> f64 { - self.value + pub struct OwnedConverter { + pub splitter: RandomDeriver, } - fn max(&self) -> f64 { - self.value + struct MutableWrapper { + wrapped: SharedComponentReference, } -} -#[derive(Clone)] -pub enum WrapperType { - Cache2D, - CacheFlat, - CacheOnce, - Interpolated, - CacheCell, -} - -#[derive(Clone)] -pub struct WrapperFunction<'a> { - input: Arc>, - wrapper: WrapperType, -} + impl ComponentFunctionImpl for MutableWrapper {} -impl<'a> WrapperFunction<'a> { - pub fn new(input: Arc>, wrapper: WrapperType) -> Self { - Self { input, wrapper } - } + impl MutableComponentFunctionImpl for MutableWrapper { + fn sample_mut(&mut self, pos: &NoisePos, _env: &E) -> f64 { + self.wrapped.sample(pos) + } - pub fn wrapped(&self) -> Arc> { - self.input.clone() - } + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.wrapped.fill(arr, applier.cast_up()); + } - pub fn wrapper(&self) -> WrapperType { - self.wrapper.clone() - } -} + fn environment(&self) -> ConverterEnvironment { + // TODO: actually test owned conversion? + unreachable!() + } -impl<'a> DensityFunctionImpl<'a> for WrapperFunction<'a> { - fn max(&self) -> f64 { - self.input.max() - } + fn into_environment(self: Box) -> OwnedConverterEnvironment { + unreachable!() + } - fn min(&self) -> f64 { - self.input.min() - } + fn convert( + self: Box, + _converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + ComponentReferenceImplementation::Mutable(MutableComponentReference(self)) + } - fn sample(&self, pos: &NoisePos) -> f64 { - self.input.sample(pos) + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + unimplemented!() + } } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::Wrapper(WrapperFunction { - input: self.input.apply(visitor), - wrapper: self.wrapper.clone(), - }))) - } + pub struct FakeEnvironment {} - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier) - } -} + impl DensityFunctionEnvironment for FakeEnvironment {} -#[derive(Clone)] -pub struct RangeFunction<'a> { - input: Arc>, - min: f64, - max: f64, - in_range: Arc>, - out_range: Arc>, -} + impl ConverterImpl for OwnedConverter { + fn convert_noise(&mut self, noise: &Arc) -> Option> { + let id = noise.parameters.id(); + let mut rand = self.splitter.split_string(id); + let sampler = DoublePerlinNoiseSampler::new(&mut rand, noise.parameters, false); -impl<'a> RangeFunction<'a> { - pub fn new( - input: Arc>, - min: f64, - max: f64, - in_range: Arc>, - out_range: Arc>, - ) -> Self { - Self { - input, - min, - max, - in_range, - out_range, + Some(Arc::new(InternalNoise::new( + noise.parameters, + Some(sampler), + ))) } - } -} -impl<'a> DensityFunctionImpl<'a> for RangeFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - let d = self.input.sample(pos); - if d >= self.min && d < self.max { - self.in_range.sample(pos) - } else { - self.out_range.sample(pos) + fn converts_post_internal( + &mut self, + _component: ConverterEnvironment, + ) -> bool { + false } - } - - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier); - densities.iter_mut().enumerate().for_each(|(i, val)| { - if *val >= self.min && *val < self.max { - *val = self.in_range.sample(&applier.at(i)); - } else { - *val = self.out_range.sample(&applier.at(i)); - } - }); - } - - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::Range(RangeFunction { - input: self.input.apply(visitor), - min: self.min, - max: self.max, - in_range: self.in_range.apply(visitor), - out_range: self.out_range.apply(visitor), - }))) - } - fn min(&self) -> f64 { - self.in_range.min().min(self.out_range.min()) - } + fn convert_env_post_internal( + &mut self, + _component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation { + unreachable!() + } - fn max(&self) -> f64 { - self.in_range.max().max(self.out_range.max()) + fn convert_env_pre_internal( + &mut self, + _component: ConverterEnvironment, + ) -> ConversionResultPre { + ConversionResultPre::Default + } } -} - -#[derive(Clone)] -pub struct YClampedFunction { - from: i32, - to: i32, - from_val: f64, - to_val: f64, -} -impl YClampedFunction { - pub fn new(from: i32, to: i32, from_val: f64, to_val: f64) -> Self { - Self { - from, - to, - from_val, - to_val, + impl SharedComponentReference { + pub fn convert_to_dyn( + self, + converter: &mut dyn ConverterImpl, + ) -> Box> { + match self.convert(converter) { + ComponentReferenceImplementation::Shared(shared) => Box::new(shared), + ComponentReferenceImplementation::Mutable(owned) => Box::new(owned), + } } } -} -impl<'a> DensityFunctionImpl<'a> for YClampedFunction { - fn sample(&self, pos: &NoisePos) -> f64 { - clamped_map( - pos.y() as f64, - self.from as f64, - self.to as f64, - self.from_val, - self.to_val, + #[test] + fn test_owned_converter() { + let test_func = NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::NETHER_WART, + None, + )), + 10f64, + 1.2f64, ) + .add( + NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)), + 0.1f64, + -1f64, + ) + .into(), + ); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let standard_convert = test_func.clone().convert(&mut converter).assert_shared(); + + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let mut owned_convert = test_func.convert_to_dyn(&mut converter); + + for i in -10..=10 { + for j in -10..=10 { + for k in -10..=10 { + let pos = + NoisePos::Unblended(UnblendedNoisePos::new(i * 100, j * 100, k * 100)); + assert_eq!( + standard_convert.sample(&pos), + owned_convert.sample_mut(&pos, &FakeEnvironment {}) + ); + } + } + } } - fn min(&self) -> f64 { - self.from_val.min(self.to_val) - } - - fn max(&self) -> f64 { - self.from_val.max(self.to_val) - } - - fn fill(&self, densities: &mut [f64], applier: &Applier) { - applier.fill(densities, &DensityFunction::ClampedY(self.clone())) - } - - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::ClampedY(self.clone()))) - } -} - -pub trait UnaryDensityFunction<'a>: DensityFunctionImpl<'a> { - fn apply_density(&self, density: f64) -> f64; -} - -pub trait OffsetDensityFunction<'a>: DensityFunctionImpl<'a> { - fn offset_noise(&self) -> &InternalNoise<'a>; - - fn sample_3d(&self, x: f64, y: f64, z: f64) -> f64 { - self.offset_noise() - .sample(x * 0.25f64, y * 0.25f64, z * 0.25f64) - * 4f64 - } -} - -pub fn lerp_density<'a>( - delta: Arc>, - start: Arc>, - end: Arc>, -) -> DensityFunction<'a> { - if let DensityFunction::Constant(function) = start.as_ref() { - lerp_density_static_start(delta, function.value, end) - } else { - let function = Arc::new(DensityFunction::Wrapper(WrapperFunction::new( - delta, - WrapperType::CacheOnce, - ))); - let function2 = Arc::new(function.mul_const(-1f64).add_const(1f64)); - start.mul(function2).add(Arc::new(end.mul(function))) - } -} - -pub fn lerp_density_static_start<'a>( - delta: Arc>, - start: f64, - end: Arc>, -) -> DensityFunction<'a> { - delta.mul(Arc::new(end.add_const(-start))).add_const(start) -} - -#[cfg(test)] -mod test { - use crate::world_gen::noise::{density::DensityFunctionImpl, BuiltInNoiseParams}; - - use super::{BuiltInNoiseFunctions, NoisePos, UnblendedNoisePos}; - #[test] - fn test_density_function_correctness() { - let noise_params = BuiltInNoiseParams::new(); - let noise_functions = BuiltInNoiseFunctions::new(&noise_params); + fn test_owned_conversion() { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 0, 0)); - let pos = NoisePos::Unblended(UnblendedNoisePos { x: 0, y: 0, z: 0 }); + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut rand2 = splitter.split_string("test"); + assert_eq!(rand2.next_i32(), 457448999); - assert_eq!(noise_functions.blend_alpha.sample(&pos), 1f64); - assert_eq!(noise_functions.blend_alpha.min(), 1f64); - assert_eq!(noise_functions.blend_alpha.max(), 1f64); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(splitter), + }; - assert_eq!(noise_functions.blend_offset.sample(&pos), 0f64); - assert_eq!(noise_functions.blend_offset.min(), 0f64); - assert_eq!(noise_functions.blend_offset.max(), 0f64); + let env = &FakeEnvironment {}; - assert_eq!(noise_functions.zero.sample(&pos), 0f64); - assert_eq!(noise_functions.zero.min(), 0f64); - assert_eq!(noise_functions.zero.max(), 0f64); + let shift_x = SHIFT_X.clone(); + assert_eq!(shift_x.sample(pos), 0f64); - assert_eq!(noise_functions.y.sample(&pos), 0f64); - assert_eq!(noise_functions.y.min(), -4064f64); - assert_eq!(noise_functions.y.max(), 4062f64); - - assert_eq!(noise_functions.shift_x.sample(&pos), 0f64); - assert_eq!(noise_functions.shift_x.min(), -8f64); - assert_eq!(noise_functions.shift_x.max(), 8f64); - - assert_eq!(noise_functions.shift_z.sample(&pos), 0f64); - assert_eq!(noise_functions.shift_z.min(), -8f64); - assert_eq!(noise_functions.shift_z.max(), 8f64); - - assert_eq!( - noise_functions.base_3d_noise_overworld.sample(&pos), - 0.05283727086562935f64 - ); - assert_eq!( - noise_functions.base_3d_noise_overworld.min(), - -87.55150000000002f64 - ); + let mut converted_shift_x = shift_x.clone().convert_to_dyn(&mut converter); assert_eq!( - noise_functions.base_3d_noise_overworld.max(), - 87.55150000000002f64 + converted_shift_x.sample_mut(pos, env), + -1.0434329952492611f64 ); - assert_eq!( - noise_functions.base_3d_noise_nether.sample(&pos), - 0.05283727086562935f64 - ); - assert_eq!( - noise_functions.base_3d_noise_nether.min(), - -258.65450000000004f64 - ); - assert_eq!( - noise_functions.base_3d_noise_nether.max(), - 258.65450000000004f64 - ); + let mut converted = ZERO.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0f64); - assert_eq!( - noise_functions.base_3d_noise_end.sample(&pos), - 0.05283727086562935f64 - ); - assert_eq!( - noise_functions.base_3d_noise_end.min(), - -173.10299999999998f64 - ); - assert_eq!( - noise_functions.base_3d_noise_end.max(), - 173.10299999999998f64 - ); + let mut converted = Y.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0f64); - assert_eq!(noise_functions.continents_overworld.sample(&pos), 0f64); - assert_eq!(noise_functions.continents_overworld.min(), -2f64); - assert_eq!(noise_functions.continents_overworld.max(), 2f64); + let mut converted = SHIFT_Z.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -1.0434329952492611f64); - assert_eq!(noise_functions.erosion_overworld.sample(&pos), 0f64); - assert_eq!(noise_functions.erosion_overworld.min(), -2f64); - assert_eq!(noise_functions.erosion_overworld.max(), 2f64); + let mut converted = BASE_3D_NOISE_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.05283727086562935f64); - assert_eq!(noise_functions.ridges_overworld.sample(&pos), 0f64); - assert_eq!(noise_functions.ridges_overworld.min(), -2f64); - assert_eq!(noise_functions.ridges_overworld.max(), 2f64); + let mut converted = BASE_3D_NOISE_NETHER.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.05283727086562935f64); - assert_eq!(noise_functions.ridges_folded_overworld.sample(&pos), -1f64); - assert_eq!( - noise_functions.ridges_folded_overworld.min(), - -3.000000000000001f64 - ); - assert_eq!(noise_functions.ridges_folded_overworld.max(), 1f64); + let mut converted = BASE_3D_NOISE_END.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.05283727086562935f64); - assert_eq!( - noise_functions.offset_overworld.sample(&pos), - -0.6037500277161598f64 - ); - assert_eq!( - noise_functions.offset_overworld.min(), - -1.3752707839012146f64 - ); - assert_eq!( - noise_functions.offset_overworld.max(), - 0.9962499737739563f64 - ); + let mut converted = CONTINENTS_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.07789864655134425f64); - assert_eq!( - noise_functions.factor_overworld.sample(&pos), - 5.549900531768799f64 - ); - assert_eq!(noise_functions.factor_overworld.min(), 0.625f64); - assert_eq!(noise_functions.factor_overworld.max(), 6.300000190734863f64); + let mut converted = EROSION_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.1909838546072366f64); - assert_eq!(noise_functions.jaggedness_overworld.sample(&pos), 0f64); - assert_eq!(noise_functions.jaggedness_overworld.min(), 0f64); - assert_eq!( - noise_functions.jaggedness_overworld.max(), - 0.6299999952316284f64 - ); - - assert_eq!( - noise_functions.depth_overworld.sample(&pos), - 0.3962499722838402f64 - ); - assert_eq!( - noise_functions.depth_overworld.min(), - -2.8752707839012146f64 - ); - assert_eq!(noise_functions.depth_overworld.max(), 2.4962499737739563f64); - - assert_eq!( - noise_functions.sloped_cheese_overworld.sample(&pos), - 8.849428998431454f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld.min(), - -109.63470657711427f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld.max(), - 182.2090019645691f64 - ); + let mut converted = RIDGES_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.18402646504201148f64); - assert_eq!( - noise_functions - .continents_overworld_large_biome - .sample(&pos), - 0f64 - ); - assert_eq!( - noise_functions.continents_overworld_large_biome.min(), - -2f64 - ); - assert_eq!(noise_functions.continents_overworld_large_biome.max(), 2f64); + let mut converted = RIDGES_FOLDED_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.4479206048739655f64); - assert_eq!( - noise_functions.erosion_overworld_large_biome.sample(&pos), - 0f64 - ); - assert_eq!(noise_functions.erosion_overworld_large_biome.min(), -2f64); - assert_eq!(noise_functions.erosion_overworld_large_biome.max(), 2f64); + let mut converted = OFFSET_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.4883981039747596f64); - assert_eq!( - noise_functions.offset_overworld_large_biome.sample(&pos), - -0.6037500277161598f64 - ); - assert_eq!( - noise_functions.offset_overworld_large_biome.min(), - -1.3752707839012146f64 - ); - assert_eq!( - noise_functions.offset_overworld_large_biome.max(), - 0.9962499737739563f64 - ); + let mut converted = FACTOR_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 5.053797245025635f64); - assert_eq!( - noise_functions.factor_overworld_large_biome.sample(&pos), - 5.549900531768799f64 - ); - assert_eq!(noise_functions.factor_overworld_large_biome.min(), 0.625f64); - assert_eq!( - noise_functions.factor_overworld_large_biome.max(), - 6.300000190734863f64 - ); - - assert_eq!( - noise_functions - .jaggedness_overworld_large_biome - .sample(&pos), - 0f64 - ); - assert_eq!(noise_functions.jaggedness_overworld_large_biome.min(), 0f64); - assert_eq!( - noise_functions.jaggedness_overworld_large_biome.max(), - 0.6299999952316284f64 - ); - - assert_eq!( - noise_functions.depth_overworld_large_biome.sample(&pos), - 0.3962499722838402f64 - ); - assert_eq!( - noise_functions.depth_overworld_large_biome.min(), - -2.8752707839012146f64 - ); - assert_eq!( - noise_functions.depth_overworld_large_biome.max(), - 2.4962499737739563f64 - ); - - assert_eq!( - noise_functions - .sloped_cheese_overworld_large_biome - .sample(&pos), - 8.849428998431454f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld_large_biome.min(), - -109.63470657711427f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld_large_biome.max(), - 182.2090019645691f64 - ); - - assert_eq!( - noise_functions.offset_overworld_amplified.sample(&pos), - -0.6037500277161598f64 - ); - assert_eq!( - noise_functions.offset_overworld_amplified.min(), - -1.3752707839012146f64 - ); - assert_eq!( - noise_functions.offset_overworld_amplified.max(), - 2.640259087085724f64 - ); + let mut converted = JAGGEDNESS_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0f64); - assert_eq!( - noise_functions.factor_overworld_amplified.sample(&pos), - 0.6516130566596985f64 - ); - assert_eq!( - noise_functions.factor_overworld_amplified.min(), - 0.13888883590698242f64 - ); - assert_eq!( - noise_functions.factor_overworld_amplified.max(), - 6.300000190734863f64 - ); + let mut converted = DEPTH_OVERWORLD.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.5116018960252404f64); - assert_eq!( - noise_functions.jaggedness_overworld_amplified.sample(&pos), - 0f64 - ); - assert_eq!(noise_functions.jaggedness_overworld_amplified.min(), 0f64); - assert_eq!( - noise_functions.jaggedness_overworld_amplified.max(), - 1.2599999904632568f64 - ); + let mut converted = SLOPED_CHEESE_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 10.394966281594634f64); - assert_eq!( - noise_functions.depth_overworld_amplified.sample(&pos), - 0.3962499722838402f64 - ); - assert_eq!( - noise_functions.depth_overworld_amplified.min(), - -2.8752707839012146f64 - ); - assert_eq!( - noise_functions.depth_overworld_amplified.max(), - 4.140259087085724f64 - ); + let mut converted = CONTINENTS_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.5413000828801735f64); - assert_eq!( - noise_functions - .sloped_cheese_overworld_amplified - .sample(&pos), - 1.085643893430405f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld_amplified.min(), - -113.6037066672365f64 - ); - assert_eq!( - noise_functions.sloped_cheese_overworld_amplified.max(), - 255.39003359528283f64 - ); + let mut converted = EROSION_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.22584626355586912f64); - assert_eq!( - noise_functions.sloped_cheese_end.sample(&pos), - 0.6153372708656294f64 - ); - assert_eq!( - noise_functions.sloped_cheese_end.min(), - -173.94674999999998f64 - ); - assert_eq!( - noise_functions.sloped_cheese_end.max(), - 173.66549999999998f64 - ); + let mut converted = OFFSET_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.3040638118982315f64); - assert_eq!( - noise_functions - .caves_spaghetti_roughness_function_overworld - .sample(&pos), - 0.020000000000000004f64 - ); - assert_eq!( - noise_functions - .caves_spaghetti_roughness_function_overworld - .min(), - -0.24000000000000005f64 - ); - assert_eq!( - noise_functions - .caves_spaghetti_roughness_function_overworld - .max(), - 0.08000000000000002f64 - ); + let mut converted = FACTOR_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 6.040968418121338f64); - assert_eq!( - noise_functions.caves_entrances_overworld.sample(&pos), - -0.056499999999999995f64 - ); - assert_eq!(noise_functions.caves_entrances_overworld.min(), -1.63f64); - // NOTE: this doesn't match java but max/min is never used anywhere so - assert_eq!(noise_functions.caves_entrances_overworld.max(), 1.08f64); + let mut converted = JAGGEDNESS_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0f64); - assert_eq!( - noise_functions.caves_noodle_overworld.sample(&pos), - -0.07500000000000001f64 - ); - assert_eq!(noise_functions.caves_noodle_overworld.min(), -0.125f64); - assert_eq!(noise_functions.caves_noodle_overworld.max(), 64f64); + let mut converted = DEPTH_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.6959361881017685f64); - assert_eq!( - noise_functions.caves_pillars_overworld.sample(&pos), - -0.16637500000000005f64 - ); - assert_eq!( - noise_functions.caves_pillars_overworld.min(), - -31.44487500000001f64 - ); - assert_eq!( - noise_functions.caves_pillars_overworld.max(), - 22.460625000000007f64 - ); + let mut converted = SLOPED_CHEESE_OVERWORLD_LARGE_BIOME + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 16.869351404267768f64); - assert_eq!( - noise_functions - .caves_spaghetti_2d_thickness_modular_overworld - .sample(&pos), - -0.95f64 - ); - assert_eq!( - noise_functions - .caves_spaghetti_2d_thickness_modular_overworld - .min(), - -1.65f64 - ); - assert_eq!( - noise_functions - .caves_spaghetti_2d_thickness_modular_overworld - .max(), - -0.2499999999999999f64 - ); + let mut converted = OFFSET_OVERWORLD_AMPLIFIED + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.47187428921461105f64); - assert_eq!( - noise_functions.caves_spaghetti_2d_overworld.sample(&pos), - -0.07885f64 - ); - assert_eq!(noise_functions.caves_spaghetti_2d_overworld.min(), -1f64); - assert_eq!(noise_functions.caves_spaghetti_2d_overworld.max(), 1f64); + let mut converted = FACTOR_OVERWORLD_AMPLIFIED + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.6070870161056519f64); + + let mut converted = JAGGEDNESS_OVERWORLD_AMPLIFIED + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0f64); + + let mut converted = DEPTH_OVERWORLD_AMPLIFIED + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.528125710785389f64); + + let mut converted = SLOPED_CHEESE_OVERWORLD_AMPLIFIED + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 1.3353103184231423f64); + + let mut converted = SLOPED_CHEESE_END.clone().convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.6153372708656294f64); + + let mut converted = CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.0022723587537428667f64); + + let mut converted = CAVES_ENTRANCES_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 0.20826666534765442f64); + + let mut converted = CAVES_NOODLE_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 64f64); + + let mut converted = CAVES_PILLARS_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.0863817754261902f64); + + let mut converted = CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), -0.9871490512034798f64); + + let mut converted = CAVES_SPAGHETTI_2D_OVERWORLD + .clone() + .convert_to_dyn(&mut converter); + assert_eq!(converted.sample_mut(pos, env), 1f64); } } diff --git a/pumpkin-world/src/world_gen/noise/density/noise.rs b/pumpkin-world/src/world_gen/noise/density/noise.rs index 71843e58c..76e70678e 100644 --- a/pumpkin-world/src/world_gen/noise/density/noise.rs +++ b/pumpkin-world/src/world_gen/noise/density/noise.rs @@ -1,30 +1,38 @@ -use std::sync::Arc; +use std::{marker::PhantomData, sync::Arc}; use pumpkin_core::random::{xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl}; -use crate::world_gen::noise::{ - clamped_lerp, - perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler, OctavePerlinNoiseSampler}, +use crate::{ + match_ref_implementations, + world_gen::noise::{ + clamped_lerp, + perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler, OctavePerlinNoiseSampler}, + }, }; use super::{ - Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, NoisePosImpl, Visitor, - VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + OwnedConverterEnvironment, SharedComponentReference, SharedConverterEnvironment, + }, + NoisePos, NoisePosImpl, }; -pub(crate) struct InternalNoise<'a> { - data: DoublePerlinNoiseParameters<'a>, - sampler: Option, +pub(crate) struct InternalNoise { + pub(crate) parameters: &'static DoublePerlinNoiseParameters, + pub(crate) sampler: Option, } -impl<'a> InternalNoise<'a> { +impl InternalNoise { pub(crate) fn new( - data: DoublePerlinNoiseParameters<'a>, - function: Option, + parameters: &'static DoublePerlinNoiseParameters, + sampler: Option, ) -> Self { Self { - data, - sampler: function, + parameters, + sampler, } } @@ -34,24 +42,16 @@ impl<'a> InternalNoise<'a> { None => 0f64, } } - - pub(crate) fn max_value(&self) -> f64 { - match &self.sampler { - Some(sampler) => sampler.max_value(), - None => 2f64, - } - } } -#[derive(Clone)] -pub struct NoiseFunction<'a> { - pub(crate) noise: Arc>, - xz_scale: f64, - y_scale: f64, +pub struct NoiseFunction { + pub(crate) noise: Arc, + pub(crate) xz_scale: f64, + pub(crate) y_scale: f64, } -impl<'a> NoiseFunction<'a> { - pub fn new(noise: Arc>, xz_scale: f64, y_scale: f64) -> Self { +impl NoiseFunction { + pub fn new(noise: Arc, xz_scale: f64, y_scale: f64) -> Self { Self { noise, xz_scale, @@ -60,7 +60,10 @@ impl<'a> NoiseFunction<'a> { } } -impl<'a> DensityFunctionImpl<'a> for NoiseFunction<'a> { +impl ComponentFunctionImpl for NoiseFunction {} + +impl ImmutableComponentFunctionImpl for NoiseFunction { + #[inline] fn sample(&self, pos: &NoisePos) -> f64 { self.noise.sample( pos.x() as f64 * self.xz_scale, @@ -69,107 +72,245 @@ impl<'a> DensityFunctionImpl<'a> for NoiseFunction<'a> { ) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - applier.fill(densities, &DensityFunction::Noise(self.clone())) + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::Noise(self.clone()))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Noise(self) } +} - fn max(&self) -> f64 { - self.noise.max_value() - } +#[derive(Clone)] +pub(crate) struct ShiftedNoiseUntypedData { + pub(crate) xz_scale: f64, + pub(crate) y_scale: f64, +} - fn min(&self) -> f64 { - -self.max() - } +pub struct ShiftedNoiseFunction< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, +> { + pub(crate) shift_x: R1, + pub(crate) shift_y: R2, + pub(crate) shift_z: R3, + pub(crate) noise: Arc, + pub(crate) data: ShiftedNoiseUntypedData, + _dummy: PhantomData, } -#[derive(Clone)] -pub struct ShiftedNoiseFunction<'a> { - shift_x: Arc>, - shift_y: Arc>, - shift_z: Arc>, - noise: Arc>, - xz_scale: f64, - y_scale: f64, +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > From> for MutableComponentReference +{ + fn from(value: ShiftedNoiseFunction) -> Self { + Self(Box::new(value)) + } } -impl<'a> ShiftedNoiseFunction<'a> { +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > ShiftedNoiseFunction +{ pub fn new( - shift_x: Arc>, - shift_y: Arc>, - shift_z: Arc>, + shift_x: R1, + shift_y: R2, + shift_z: R3, xz_scale: f64, y_scale: f64, - noise: Arc>, + noise: Arc, ) -> Self { Self { shift_x, shift_y, shift_z, noise, - xz_scale, - y_scale, + data: ShiftedNoiseUntypedData { xz_scale, y_scale }, + _dummy: PhantomData:: {}, + } + } + + pub fn create_new_ref( + x: ComponentReferenceImplementation, + y: ComponentReferenceImplementation, + z: ComponentReferenceImplementation, + noise: Arc, + data: &ShiftedNoiseUntypedData, + ) -> ComponentReferenceImplementation { + match (x, y, z) { + ( + ComponentReferenceImplementation::Shared(shared_x), + ComponentReferenceImplementation::Shared(shared_y), + ComponentReferenceImplementation::Shared(shared_z), + ) => ShiftedNoiseFunction::< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + shared_x, + shared_y, + shared_z, + data.xz_scale, + data.y_scale, + noise, + ) + .into(), + (x, y, z) => { + match_ref_implementations!( + (ref_x, x), + (ref_y, y), + (ref_z, z); + { + ComponentReferenceImplementation::Mutable( + MutableComponentReference(Box::new( + ShiftedNoiseFunction::new( + ref_x, + ref_y, + ref_z, + data.xz_scale, + data.y_scale, + noise + ) + )) + ) + } + ) + } } } } -impl<'a> DensityFunctionImpl<'a> for ShiftedNoiseFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - let d = (pos.x() as f64).mul_add(self.xz_scale, self.shift_x.sample(pos)); - let e = (pos.y() as f64).mul_add(self.y_scale, self.shift_y.sample(pos)); - let f = (pos.z() as f64).mul_add(self.xz_scale, self.shift_z.sample(pos)); +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > ComponentFunctionImpl for ShiftedNoiseFunction +{ +} - self.noise.sample(d, e, f) +impl< + E: DensityFunctionEnvironment, + R1: ComponentReference, + R2: ComponentReference, + R3: ComponentReference, + > MutableComponentFunctionImpl for ShiftedNoiseFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let x_pos = (pos.x() as f64) * self.data.xz_scale + self.shift_x.sample_mut(pos, env); + let y_pos = (pos.y() as f64) * self.data.y_scale + self.shift_y.sample_mut(pos, env); + let z_pos = (pos.z() as f64) * self.data.xz_scale + self.shift_z.sample_mut(pos, env); + + self.noise.sample(x_pos, y_pos, z_pos) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - applier.fill(densities, &DensityFunction::ShiftedNoise(self.clone())) + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + applier.fill_mut(arr, self); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - let new_x = self.shift_x.apply(visitor); - let new_y = self.shift_y.apply(visitor); - let new_z = self.shift_z.apply(visitor); - let new_noise = visitor.apply_internal_noise(self.noise.clone()); - - Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction { - shift_x: new_x, - shift_y: new_y, - shift_z: new_z, - xz_scale: self.xz_scale, - y_scale: self.y_scale, - noise: new_noise, - })) + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::ShiftedNoise( + &self.shift_x, + &self.shift_y, + &self.shift_z, + &self.noise, + &self.data, + ) } - fn max(&self) -> f64 { - self.noise.max_value() + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::ShiftedNoise( + self.shift_x.wrapped_ref(), + self.shift_y.wrapped_ref(), + self.shift_z.wrapped_ref(), + self.noise, + self.data, + ) + } + + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.shift_x.convert(converter), + self.shift_y.convert(converter), + self.shift_z.convert(converter), + converter + .convert_noise(&self.noise) + .unwrap_or_else(|| self.noise.clone()), + &self.data, + ) } - fn min(&self) -> f64 { - -self.max() + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.shift_x.clone_to_new_ref(), + self.shift_y.clone_to_new_ref(), + self.shift_z.clone_to_new_ref(), + self.noise.clone(), + &self.data, + ) } } -#[derive(Clone)] -pub struct InterpolatedNoiseSampler { - lower: Arc, - upper: Arc, - interpolation: Arc, - xz_scale_scaled: f64, - y_scale_scaled: f64, - xz_factor: f64, - y_factor: f64, - smear_scale: f64, - max_value: f64, - xz_scale: f64, - y_scale: f64, +impl ImmutableComponentFunctionImpl + for ShiftedNoiseFunction< + E, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + > +{ + fn sample(&self, pos: &NoisePos) -> f64 { + let x_pos = (pos.x() as f64) * self.data.xz_scale + self.shift_x.sample(pos); + let y_pos = (pos.y() as f64) * self.data.y_scale + self.shift_y.sample(pos); + let z_pos = (pos.z() as f64) * self.data.xz_scale + self.shift_z.sample(pos); + + self.noise.sample(x_pos, y_pos, z_pos) + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::ShiftedNoise( + &self.shift_x, + &self.shift_y, + &self.shift_z, + &self.noise, + &self.data, + ) + } +} + +pub struct InterpolatedNoiseFunction { + pub(crate) lower: Arc, + pub(crate) upper: Arc, + pub(crate) interpolation: Arc, + pub(crate) xz_scale_scaled: f64, + pub(crate) y_scale_scaled: f64, + pub(crate) xz_factor: f64, + pub(crate) y_factor: f64, + pub(crate) smear_scale: f64, + pub(crate) xz_scale: f64, + pub(crate) y_scale: f64, } -impl InterpolatedNoiseSampler { +impl InterpolatedNoiseFunction { fn create_from_random( rand: &mut RandomGenerator, xz_scale: f64, @@ -185,9 +326,9 @@ impl InterpolatedNoiseSampler { OctavePerlinNoiseSampler::calculate_amplitudes(&(-7..=0).collect::>()); Self::new( - OctavePerlinNoiseSampler::new(rand, start_1, &litudes_1), - OctavePerlinNoiseSampler::new(rand, start_1, &litudes_1), - OctavePerlinNoiseSampler::new(rand, start_2, &litudes_2), + OctavePerlinNoiseSampler::new(rand, start_1, &litudes_1, true), + OctavePerlinNoiseSampler::new(rand, start_1, &litudes_1, true), + OctavePerlinNoiseSampler::new(rand, start_2, &litudes_2, true), xz_scale, y_scale, xz_factor, @@ -214,7 +355,7 @@ impl InterpolatedNoiseSampler { y_factor: f64, smear_scale: f64, ) -> Self { - let mut rand = RandomGenerator::LegacyXoroshiro(Xoroshiro::from_seed(0)); + let mut rand = RandomGenerator::Xoroshiro(Xoroshiro::from_seed(0)); Self::create_from_random( &mut rand, xz_scale, @@ -237,11 +378,6 @@ impl InterpolatedNoiseSampler { smear_scale: f64, ) -> Self { let y_scale_scaled = 684.412f64 * y_scale; - let max_value = OctavePerlinNoiseSampler::get_total_amplitude( - y_scale_scaled + 2f64, - lower.persistence, - &lower.amplitudes, - ); Self { lower: Arc::new(lower), upper: Arc::new(upper), @@ -253,12 +389,13 @@ impl InterpolatedNoiseSampler { smear_scale, y_scale_scaled, xz_scale_scaled: 684.412f64 * xz_scale, - max_value, } } } -impl<'a> DensityFunctionImpl<'a> for InterpolatedNoiseSampler { +impl ComponentFunctionImpl for InterpolatedNoiseFunction {} + +impl ImmutableComponentFunctionImpl for InterpolatedNoiseFunction { fn sample(&self, pos: &NoisePos) -> f64 { let d = pos.x() as f64 * self.xz_scale_scaled; let e = pos.y() as f64 * self.y_scale_scaled; @@ -322,19 +459,12 @@ impl<'a> DensityFunctionImpl<'a> for InterpolatedNoiseSampler { clamped_lerp(l / 512f64, m / 512f64, q) / 128f64 } - fn max(&self) -> f64 { - self.max_value - } - - fn min(&self) -> f64 { - -self.max() - } - - fn fill(&self, densities: &mut [f64], applier: &Applier) { - applier.fill(densities, &DensityFunction::InterpolatedNoise(self.clone())) + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::InterpolatedNoise(self.clone()))) + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::InterpolatedNoise(self) } } diff --git a/pumpkin-world/src/world_gen/noise/density/offset.rs b/pumpkin-world/src/world_gen/noise/density/offset.rs index 49be5872f..e9b8cd42a 100644 --- a/pumpkin-world/src/world_gen/noise/density/offset.rs +++ b/pumpkin-world/src/world_gen/noise/density/offset.rs @@ -1,88 +1,71 @@ use std::sync::Arc; use super::{ - noise::InternalNoise, Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, - NoisePosImpl, OffsetDensityFunction, Visitor, VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ImmutableComponentFunctionImpl, + SharedConverterEnvironment, + }, + noise::InternalNoise, + NoisePos, NoisePosImpl, }; -#[derive(Clone)] -pub struct ShiftAFunction<'a> { - offset: Arc>, +#[inline] +fn sample_3d(noise: &InternalNoise, x: f64, y: f64, z: f64) -> f64 { + noise.sample(x * 0.25f64, y * 0.25f64, z * 0.25f64) * 4f64 } -impl<'a> ShiftAFunction<'a> { - pub fn new(offset: Arc>) -> Self { - Self { offset } - } +pub struct ShiftAFunction { + pub(crate) offset: Arc, } -impl<'a> OffsetDensityFunction<'a> for ShiftAFunction<'a> { - fn offset_noise(&self) -> &InternalNoise<'a> { - &self.offset +impl ShiftAFunction { + pub fn new(offset: Arc) -> Self { + Self { offset } } } -impl<'a> DensityFunctionImpl<'a> for ShiftAFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - self.sample_3d(pos.x() as f64, 0f64, pos.z() as f64) - } - - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::ShiftA(ShiftAFunction { - offset: visitor.apply_internal_noise(self.offset.clone()), - }))) - } +impl ComponentFunctionImpl for ShiftAFunction {} - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - applier.fill(densities, &DensityFunction::ShiftA(self.clone())) +impl ImmutableComponentFunctionImpl for ShiftAFunction { + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + sample_3d(&self.offset, pos.x() as f64, 0f64, pos.z() as f64) } - fn max(&self) -> f64 { - self.offset_noise().max_value() * 4f64 + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); } - fn min(&self) -> f64 { - -self.max() + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::ShiftA(&self.offset) } } -#[derive(Clone)] -pub struct ShiftBFunction<'a> { - offset: Arc>, +pub struct ShiftBFunction { + pub(crate) offset: Arc, } -impl<'a> ShiftBFunction<'a> { - pub fn new(offset: Arc>) -> Self { +impl ShiftBFunction { + pub fn new(offset: Arc) -> Self { Self { offset } } } -impl<'a> OffsetDensityFunction<'a> for ShiftBFunction<'a> { - fn offset_noise(&self) -> &InternalNoise<'a> { - &self.offset - } -} +impl ComponentFunctionImpl for ShiftBFunction {} -impl<'a> DensityFunctionImpl<'a> for ShiftBFunction<'a> { +impl ImmutableComponentFunctionImpl for ShiftBFunction { + #[inline] fn sample(&self, pos: &NoisePos) -> f64 { - self.sample_3d(pos.z() as f64, pos.x() as f64, 0f64) - } - - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::ShiftB(ShiftBFunction { - offset: visitor.apply_internal_noise(self.offset.clone()), - }))) - } - - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - applier.fill(densities, &DensityFunction::ShiftB(self.clone())) + sample_3d(&self.offset, pos.z() as f64, pos.x() as f64, 0f64) } - fn max(&self) -> f64 { - self.offset_noise().max_value() * 4f64 + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); } - fn min(&self) -> f64 { - -self.max() + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::ShiftB(&self.offset) } } diff --git a/pumpkin-world/src/world_gen/noise/density/spline.rs b/pumpkin-world/src/world_gen/noise/density/spline.rs index aebffcfae..9f4698188 100644 --- a/pumpkin-world/src/world_gen/noise/density/spline.rs +++ b/pumpkin-world/src/world_gen/noise/density/spline.rs @@ -1,59 +1,220 @@ -use std::sync::Arc; +use std::{marker::PhantomData, sync::Arc}; + +use enum_dispatch::enum_dispatch; +use itertools::Itertools; use crate::world_gen::noise::lerp; use super::{ - Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, Visitor, VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + OwnedConverterEnvironment, SharedComponentReference, SharedConverterEnvironment, + }, + NoisePos, }; -pub enum SplineValue<'a> { - Spline(Spline<'a>), +//TODO : De-duplicate code with traits and generics + +#[derive(Clone)] +pub enum ImmutableValue { + Spline(ImmutableSplineRef), Fixed(f32), } -impl<'a> SplineValue<'a> { - fn max(&self) -> f32 { +impl ImmutableValue { + fn sample(&self, pos: &NoisePos) -> f32 { match self { - Self::Fixed(value) => *value, - Self::Spline(spline) => spline.max, + Self::Fixed(val) => *val, + Self::Spline(spline) => spline.0.sample(pos), } } +} - fn min(&self) -> f32 { - match self { - Self::Fixed(value) => *value, - Self::Spline(spline) => spline.min, +#[enum_dispatch(SplinePointImpl)] +pub(crate) enum SplinePoint { + Mutable(MutablePoint), + Immutable(ImmutablePoint), +} + +#[enum_dispatch] +trait SplinePointImpl { + fn sample_outside_range_mut(&mut self, oob_loc: f32, pos: &NoisePos, env: &E) -> f32; + + fn sampled_value_mut(&mut self, pos: &NoisePos, env: &E) -> f32; + + fn location(&self) -> f32; + + fn derivative(&self) -> f32; + + fn convert(self, converter: &mut dyn ConverterImpl) -> SplinePoint; + + fn clone_to_new_point(&self) -> SplinePoint; +} + +#[derive(Clone)] +pub struct ImmutablePoint { + pub(crate) location: f32, + pub(crate) value: ImmutableValue, + pub(crate) derivative: f32, +} + +impl ImmutablePoint { + fn sample_outside_range(&self, oob_loc: f32, pos: &NoisePos) -> f32 { + let oob_value = self.value.sample(pos); + if self.derivative == 0f32 { + oob_value + } else { + self.derivative * (oob_loc - self.location) + oob_value } } - fn apply(&self, pos: &NoisePos) -> f32 { - match self { - Self::Fixed(value) => *value, - Self::Spline(spline) => spline.apply(pos), + fn maybe_convert( + &self, + converter: &mut dyn ConverterImpl, + ) -> Option> { + match &self.value { + ImmutableValue::Fixed(_value) => None, + ImmutableValue::Spline(spline_ref) => { + spline_ref + .maybe_convert(converter) + .map(|converted_ref| match converted_ref { + SplineRef::Immutable(spline) => SplinePoint::Immutable(ImmutablePoint { + location: self.location, + value: ImmutableValue::Spline(spline), + derivative: self.derivative, + }), + SplineRef::Mutable(spline) => SplinePoint::Mutable(MutablePoint { + location: self.location, + value: spline, + derivative: self.derivative, + }), + }) + } } } +} - fn visit(&self, visitor: &Visitor<'a>) -> SplineValue<'a> { - match self { - Self::Fixed(val) => Self::Fixed(*val), - Self::Spline(spline) => Self::Spline(spline.visit(visitor)), - } +impl SplinePointImpl for ImmutablePoint { + #[inline] + fn sample_outside_range_mut(&mut self, oob_loc: f32, pos: &NoisePos, _env: &E) -> f32 { + self.sample_outside_range(oob_loc, pos) + } + + #[inline] + fn sampled_value_mut(&mut self, pos: &NoisePos, _env: &E) -> f32 { + self.value.sample(pos) + } + + #[inline] + fn location(&self) -> f32 { + self.location + } + + #[inline] + fn derivative(&self) -> f32 { + self.derivative + } + + fn convert(self, converter: &mut dyn ConverterImpl) -> SplinePoint { + self.maybe_convert(converter) + .unwrap_or_else(|| match self.value { + ImmutableValue::Fixed(value) => SplinePoint::Immutable(ImmutablePoint { + location: self.location, + value: ImmutableValue::Fixed(value), + derivative: self.derivative, + }), + ImmutableValue::Spline(spline) => SplinePoint::Immutable(ImmutablePoint { + location: self.location, + value: ImmutableValue::Spline(spline), + derivative: self.derivative, + }), + }) + } + + fn clone_to_new_point(&self) -> SplinePoint { + SplinePoint::Immutable(self.clone()) } } -#[derive(Clone)] -pub(crate) struct SplinePoint<'a> { - location: f32, - value: Arc>, - derivative: f32, +pub struct MutablePoint { + pub(crate) location: f32, + pub(crate) value: MutableSplineRef, + pub(crate) derivative: f32, } -#[derive(Clone)] -pub struct Spline<'a> { - function: Arc>, - points: Vec>, - min: f32, - max: f32, +impl SplinePointImpl for MutablePoint { + fn sample_outside_range_mut(&mut self, oob_loc: f32, pos: &NoisePos, env: &E) -> f32 { + let oob_value = self.value.sample_mut(pos, env); + if self.derivative == 0f32 { + oob_value + } else { + self.derivative * (oob_loc - self.location) + oob_value + } + } + + #[inline] + fn sampled_value_mut(&mut self, pos: &NoisePos, env: &E) -> f32 { + self.value.sample_mut(pos, env) + } + + #[inline] + fn derivative(&self) -> f32 { + self.derivative + } + + #[inline] + fn location(&self) -> f32 { + self.location + } + + fn convert(self, converter: &mut dyn ConverterImpl) -> SplinePoint { + match self.value.convert(converter) { + SplineRef::Immutable(spline) => SplinePoint::Immutable(ImmutablePoint { + location: self.location, + value: ImmutableValue::Spline(spline), + derivative: self.derivative, + }), + SplineRef::Mutable(spline) => SplinePoint::Mutable(MutablePoint { + location: self.location, + value: spline, + derivative: self.derivative, + }), + } + } + + fn clone_to_new_point(&self) -> SplinePoint { + match self.value.clone_to_new_ref() { + SplineRef::Immutable(spline) => SplinePoint::Immutable(ImmutablePoint { + location: self.location, + value: ImmutableValue::Spline(spline), + derivative: self.derivative, + }), + SplineRef::Mutable(spline) => SplinePoint::Mutable(MutablePoint { + location: self.location, + value: spline, + derivative: self.derivative, + }), + } + } +} + +/// Returns the smallest usize between min..max that does not match the predicate +fn binary_walk(min: usize, max: usize, pred: impl Fn(usize) -> bool) -> usize { + let mut i = max - min; + let mut min = min; + while i > 0 { + let j = i / 2; + let k = min + j; + if pred(k) { + i = j; + } else { + min = k + 1; + i -= j + 1; + } + } + min } enum Range { @@ -61,34 +222,22 @@ enum Range { Below, } -impl<'a> Spline<'a> { - fn sample_outside_range(point: f32, value: f32, points: &[SplinePoint], i: usize) -> f32 { - let f = points[i].derivative; - if f == 0f32 { - value - } else { - f.mul_add(point - points[i].location, value) - } - } +pub struct ImmutableSpline { + pub(crate) function: SharedComponentReference, + pub(crate) points: Box<[ImmutablePoint]>, +} - fn binary_walk(min: usize, max: usize, pred: impl Fn(usize) -> bool) -> usize { - let mut i = max - min; - let mut min = min; - while i > 0 { - let j = i / 2; - let k = min + j; - if pred(k) { - i = j; - } else { - min = k + 1; - i -= j + 1; - } - } - min +impl From for ImmutableSplineRef { + fn from(value: ImmutableSpline) -> Self { + Self(Arc::new(value)) } +} - fn find_range_for_location(points: &[SplinePoint], x: f32) -> Range { - let index_greater_than_x = Self::binary_walk(0, points.len(), |i| x < points[i].location); +impl ImmutableSpline { + // TODO: Is there a way to do this on the slice itself? + fn find_index_for_location(&self, loc: f32) -> Range { + let index_greater_than_x = + binary_walk(0, self.points.len(), |i| loc < self.points[i].location); if index_greater_than_x == 0 { Range::Below } else { @@ -96,165 +245,409 @@ impl<'a> Spline<'a> { } } - pub fn new(function: Arc>, points: &[SplinePoint<'a>]) -> Self { - let i = points.len() - 1; - let mut f = f32::INFINITY; - let mut g = f32::NEG_INFINITY; + pub fn sample(&self, pos: &NoisePos) -> f32 { + let location = self.function.sample(pos) as f32; + match self.find_index_for_location(location) { + Range::In(index) => { + if index == self.points.len() - 1 { + self.points[index].sample_outside_range(location, pos) + } else { + let lower_point = &self.points[index]; + let upper_point = &self.points[index + 1]; - let h = function.min() as f32; - let j = function.max() as f32; + let lower_value = lower_point.value.sample(pos); + let upper_value = upper_point.value.sample(pos); - if h < points[0].location { - let k = Self::sample_outside_range(h, points[0].value.min(), points, 0); - let l = Self::sample_outside_range(h, points[0].value.max(), points, 0); + let x_scale = (location - lower_point.location) + / (upper_point.location - lower_point.location); + let extrapolated_lower_value = lower_point.derivative + * (upper_point.location - lower_point.location) + - (upper_value - lower_value); + let extrapolated_upper_value = -upper_point.derivative + * (upper_point.location - lower_point.location) + + (upper_value - lower_value); - f = f.min(k.min(l)); - g = f.max(k.max(l)); + (x_scale * (1f32 - x_scale)) + * lerp(x_scale, extrapolated_lower_value, extrapolated_upper_value) + + lerp(x_scale, lower_value, upper_value) + } + } + Range::Below => self.points[0].sample_outside_range(location, pos), } + } +} - if j > points[i].location { - let k = Self::sample_outside_range(j, points[i].value.min(), points, i); - let l = Self::sample_outside_range(j, points[i].value.max(), points, i); +pub trait MutableSplineImpl: Send + Sync { + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f32; - f = f.min(k.min(l)); - g = g.max(k.max(l)); - } + fn convert(self: Box, converter: &mut dyn ConverterImpl) -> SplineRef; - for point in points { - f = f.min(point.value.min()); - g = g.max(point.value.max()); - } + fn clone_to_new_ref(&self) -> SplineRef; +} - for m in 0..i { - let l = points[m].location; - let n = points[m + 1].location; - let o = n - l; - - let spline2 = &points[m].value; - let spline3 = &points[m + 1].value; - - let p = spline2.min(); - let q = spline2.max(); - let r = spline3.min(); - let s = spline3.max(); - let t = points[m].derivative; - let u = points[m + 1].derivative; - - if t != 0f32 || u != 0f32 { - let v = t * o; - let w = u * o; - - let x = p.min(r); - let y = q.max(s); - - let z = v - s + p; - let aa = v - r + q; - let ab = -w + r - q; - let ac = -w + s - p; - let ad = z.min(ab); - let ae = aa.max(ac); - - f = f.min(0.25f32.mul_add(ad, x)); - g = g.max(0.25f32.mul_add(ae, y)); - } - } +pub struct MutableSpline> { + pub(crate) function: R, + pub(crate) points: Box<[SplinePoint]>, + _dummy: PhantomData, +} - Self { - function, - points: points.to_vec(), - min: f, - max: g, +impl> MutableSpline { + fn create_new_spline( + converted_base: ComponentReferenceImplementation, + converted_points: Vec>, + ) -> SplineRef { + match converted_base { + ComponentReferenceImplementation::Shared(shared) => { + if converted_points + .iter() + .all(|point| matches!(point, SplinePoint::Immutable(_))) + { + let immutable_points = converted_points + .into_iter() + .map(|point| match point { + SplinePoint::Immutable(point) => point, + _ => unreachable!(), + }) + .collect_vec(); + SplineRef::Immutable( + ImmutableSpline { + function: shared, + points: immutable_points.into_boxed_slice(), + } + .into(), + ) + } else { + SplineRef::Mutable( + MutableSpline { + function: shared, + points: converted_points.into_boxed_slice(), + _dummy: PhantomData:: {}, + } + .into(), + ) + } + } + ComponentReferenceImplementation::Mutable(owned) => SplineRef::Mutable( + MutableSpline { + function: owned, + points: converted_points.into_boxed_slice(), + _dummy: PhantomData:: {}, + } + .into(), + ), } } +} - pub fn apply(&self, pos: &NoisePos) -> f32 { - let f = self.function.sample(pos) as f32; - let i = Self::find_range_for_location(&self.points, f); +impl> From> + for MutableSplineRef +{ + fn from(value: MutableSpline) -> Self { + Self(Box::new(value)) + } +} - match i { +impl> MutableSplineImpl + for MutableSpline +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f32 { + let location = self.function.sample_mut(pos, env) as f32; + match self.find_index_for_location(location) { Range::In(index) => { - let last_index = self.points.len() - 1; - if index == last_index { - Self::sample_outside_range( - f, - self.points[last_index].value.apply(pos), - &self.points, - last_index, - ) + if index == self.points.len() - 1 { + self.points[index].sample_outside_range_mut(location, pos, env) } else { - let point_1 = &self.points[index]; - let point_2 = &self.points[index + 1]; - let k = (f - point_1.location) / (point_2.location - point_1.location); - - let n = point_1.value.apply(pos); - let o = point_2.value.apply(pos); - - let p = point_1 - .derivative - .mul_add(point_2.location - point_1.location, -(o - n)); - let q = - (-point_2.derivative).mul_add(point_2.location - point_1.location, o - n); - (k * (1f32 - k)).mul_add(lerp(k, p, q), lerp(k, n, o)) + let lower_value = self.points[index].sampled_value_mut(pos, env); + let upper_value = self.points[index + 1].sampled_value_mut(pos, env); + + let lower_point = &self.points[index]; + let upper_point = &self.points[index + 1]; + + let x_scale = (location - lower_point.location()) + / (upper_point.location() - lower_point.location()); + let extrapolated_lower_value = lower_point.derivative() + * (upper_point.location() - lower_point.location()) + - (upper_value - lower_value); + let extrapolated_upper_value = -upper_point.derivative() + * (upper_point.location() - lower_point.location()) + + (upper_value - lower_value); + + (x_scale * (1f32 - x_scale)) + * lerp(x_scale, extrapolated_lower_value, extrapolated_upper_value) + + lerp(x_scale, lower_value, upper_value) } } - Range::Below => { - Self::sample_outside_range(f, self.points[0].value.apply(pos), &self.points, 0) - } + Range::Below => self.points[0].sample_outside_range_mut(location, pos, env), } } - pub fn visit(&self, visitor: &Visitor<'a>) -> Spline<'a> { - let new_function = visitor.apply(self.function.clone()); - let new_points = self + fn convert(self: Box, converter: &mut dyn ConverterImpl) -> SplineRef { + let converted_base = self.function.convert(converter); + let points = self.points.into_vec(); + let converted_points = points + .into_iter() + .map(|point| point.convert(converter)) + .collect_vec(); + + Self::create_new_spline(converted_base, converted_points) + } + + fn clone_to_new_ref(&self) -> SplineRef { + let cloned_function = self.function.clone_to_new_ref(); + let cloned_points = self .points .iter() - .map(|point| SplinePoint { - location: point.location, - derivative: point.derivative, - value: Arc::new(point.value.visit(visitor)), + .map(|point| point.clone_to_new_point()) + .collect_vec(); + + Self::create_new_spline(cloned_function, cloned_points) + } +} + +impl> MutableSpline { + fn find_index_for_location(&self, loc: f32) -> Range { + let index_greater_than_x = + binary_walk(0, self.points.len(), |i| loc < self.points[i].location()); + if index_greater_than_x == 0 { + Range::Below + } else { + Range::In(index_greater_than_x - 1) + } + } +} + +pub(crate) enum SplineRef { + Immutable(ImmutableSplineRef), + Mutable(MutableSplineRef), +} + +pub(crate) trait SplineRefImpl: Send + Sync { + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f32; + + fn convert(self, converter: &mut dyn ConverterImpl) -> SplineRef; + + fn clone_to_new_ref(&self) -> SplineRef; + + fn into_ref(self) -> SplineRef; +} + +pub(crate) struct MutableSplineRef(Box>); + +impl SplineRefImpl for MutableSplineRef { + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f32 { + self.0.sample_mut(pos, env) + } + + #[inline] + fn convert(self, converter: &mut dyn ConverterImpl) -> SplineRef { + self.0.convert(converter) + } + + fn clone_to_new_ref(&self) -> SplineRef { + self.0.clone_to_new_ref() + } + + fn into_ref(self) -> SplineRef { + SplineRef::Mutable(self) + } +} + +#[derive(Clone)] +pub(crate) struct ImmutableSplineRef(Arc); + +impl ImmutableSplineRef { + pub fn maybe_convert( + &self, + converter: &mut dyn ConverterImpl, + ) -> Option> { + let converted_base = self.0.function.maybe_convert(converter); + let maybe_converted_points = self + .0 + .points + .iter() + .map(|point| point.maybe_convert(converter)) + .collect_vec(); + + if converted_base.is_none() && maybe_converted_points.iter().all(|point| point.is_none()) { + None + } else { + let converted_base = converted_base.unwrap_or_else(|| self.0.function.clone().into()); + let converted_points = maybe_converted_points + .into_iter() + .enumerate() + .map(|(index, point)| { + if let Some(point) = point { + point + } else { + self.0.points[index].clone().into() + } + }) + .collect_vec(); + + Some(match converted_base { + ComponentReferenceImplementation::Shared(shared) => { + if converted_points + .iter() + .all(|point| matches!(point, SplinePoint::Immutable(_))) + { + let immutable_points = converted_points + .into_iter() + .map(|point| match point { + SplinePoint::Immutable(point) => point, + _ => unreachable!(), + }) + .collect_vec(); + SplineRef::Immutable( + ImmutableSpline { + function: shared, + points: immutable_points.into_boxed_slice(), + } + .into(), + ) + } else { + SplineRef::Mutable( + MutableSpline { + function: shared, + points: converted_points.into_boxed_slice(), + _dummy: PhantomData:: {}, + } + .into(), + ) + } + } + ComponentReferenceImplementation::Mutable(owned) => SplineRef::Mutable( + MutableSpline { + function: owned, + points: converted_points.into_boxed_slice(), + _dummy: PhantomData:: {}, + } + .into(), + ), }) - .collect::>(); - Self::new(new_function, &new_points) + } + } +} + +impl SplineRefImpl for ImmutableSplineRef { + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, _env: &E) -> f32 { + self.0.sample(pos) + } + + fn convert(self, converter: &mut dyn ConverterImpl) -> SplineRef { + self.maybe_convert(converter) + .unwrap_or_else(|| SplineRef::Immutable(self.clone())) + } + + fn clone_to_new_ref(&self) -> SplineRef { + SplineRef::Immutable(self.clone()) + } + + fn into_ref(self) -> SplineRef { + SplineRef::Immutable(self) } } #[derive(Clone)] -pub struct SplineFunction<'a> { - spline: Arc>, +pub struct SplineFunction> { + pub(crate) spline: S, + _dummy: PhantomData, } -impl<'a> SplineFunction<'a> { - pub fn new(spline: Arc>) -> Self { - Self { spline } +impl> SplineFunction { + pub fn new(spline: S) -> Self { + Self { + spline, + _dummy: PhantomData:: {}, + } + } + + pub fn create_new_ref(spline: SplineRef) -> ComponentReferenceImplementation { + match spline { + SplineRef::Mutable(mutable_spline) => ComponentReferenceImplementation::Mutable( + SplineFunction { + spline: mutable_spline, + _dummy: PhantomData:: {}, + } + .into(), + ), + SplineRef::Immutable(immutable_spline) => ComponentReferenceImplementation::Shared( + SplineFunction:: { + spline: immutable_spline, + _dummy: PhantomData:: {}, + } + .into(), + ), + } } } -impl<'a> DensityFunctionImpl<'a> for SplineFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - self.spline.apply(pos) as f64 +impl + 'static> From> + for MutableComponentReference +{ + fn from(value: SplineFunction) -> Self { + Self(Box::new(value)) } +} - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - applier.fill(densities, &DensityFunction::Spline(self.clone())) +impl> ComponentFunctionImpl + for SplineFunction +{ +} + +impl> MutableComponentFunctionImpl + for SplineFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + self.spline.sample_mut(pos, env) as f64 } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - let new_spline = self.spline.visit(visitor); - Arc::new(DensityFunction::Spline(SplineFunction { - spline: Arc::new(new_spline), - })) + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + applier.fill_mut(arr, self); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Spline(&self.spline) } - fn max(&self) -> f64 { - self.spline.max as f64 + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Spline(self.spline.into_ref()) } - fn min(&self) -> f64 { - self.spline.min as f64 + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.spline.convert(converter)) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.spline.clone_to_new_ref()) } } -#[derive(Clone)] +impl ImmutableComponentFunctionImpl + for SplineFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + self.spline.0.sample(pos) as f64 + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + applier.fill(arr, self); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Spline(&self.spline) + } +} + +#[derive(Clone, Copy)] pub enum FloatAmplifier { Identity, OffsetAmplifier, @@ -279,14 +672,15 @@ impl FloatAmplifier { } } } -pub struct SplineBuilder<'a> { - function: Arc>, + +pub struct SplineBuilder { + function: SharedComponentReference, amplifier: FloatAmplifier, - points: Vec>, + points: Vec, } -impl<'a> SplineBuilder<'a> { - pub fn new(function: Arc>, amplifier: FloatAmplifier) -> Self { +impl SplineBuilder { + pub fn new(function: SharedComponentReference, amplifier: FloatAmplifier) -> Self { Self { function, amplifier, @@ -295,68 +689,1010 @@ impl<'a> SplineBuilder<'a> { } #[must_use] - pub fn add_value(&mut self, location: f32, value: f32, derivative: f32) -> &mut Self { - self.add_spline( - location, - SplineValue::Fixed(self.amplifier.apply(value)), - derivative, - ) + #[inline] + pub fn add_fixed_value(self, location: f32, value: f32) -> Self { + self.add_fixed_value_derivative(location, value, 0f32) } #[must_use] - pub fn add_spline( - &mut self, + pub fn add_fixed_value_derivative(self, location: f32, value: f32, derivative: f32) -> Self { + let amplified = self.amplifier.apply(value); + self.add_value(location, ImmutableValue::Fixed(amplified), derivative) + } + + #[must_use] + #[inline] + pub fn add_spline_value(self, location: f32, value: ImmutableSplineRef) -> Self { + self.add_spline_value_derivative(location, value, 0f32) + } + + #[must_use] + pub fn add_spline_value_derivative( + self, location: f32, - value: SplineValue<'a>, + value: ImmutableSplineRef, derivative: f32, - ) -> &mut Self { + ) -> Self { + self.add_value(location, ImmutableValue::Spline(value), derivative) + } + + #[must_use] + pub fn add_value(mut self, location: f32, value: ImmutableValue, derivative: f32) -> Self { + #[cfg(debug_assertions)] if let Some(last) = self.points.last() { - if location <= last.location { - panic!("Points must be in asscending order"); - } + assert!(location > last.location); } - self.points.push(SplinePoint { + self.points.push(ImmutablePoint { location, - value: Arc::new(value), + value, derivative, }); self } - pub fn build(&self) -> Spline<'a> { - Spline::new(self.function.clone(), &self.points) + pub fn build(self) -> ImmutableSpline { + ImmutableSpline { + function: self.function, + points: self.points.into_boxed_slice(), + } } } #[cfg(test)] mod test { - use crate::world_gen::noise::{ - density::{BuiltInNoiseFunctions, NoisePos, UnblendedNoisePos}, - BuiltInNoiseParams, + use pumpkin_core::random::{legacy_rand::LegacyRand, RandomDeriver, RandomImpl}; + + use crate::world_gen::noise::density::{ + built_in_density_function::CONTINENTS_OVERWORLD, + component_functions::{ComponentReference, NoEnvironment, SharedComponentReference}, + test::{FakeEnvironment, OwnedConverter, TestConverter}, + NoisePos, UnblendedNoisePos, }; - use super::{FloatAmplifier, SplineBuilder}; + use super::{FloatAmplifier, ImmutableSplineRef, SplineBuilder, SplineFunction}; #[test] fn test_correctness() { - let noise_params = BuiltInNoiseParams::new(); - let noise_functions = BuiltInNoiseFunctions::new(&noise_params); - let pos = NoisePos::Unblended(UnblendedNoisePos { x: 0, y: 0, z: 0 }); + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; let spline = SplineBuilder::new( - noise_functions.continents_overworld, + CONTINENTS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), FloatAmplifier::Identity, ) - .add_value(-1.1f32, 0.044f32, 0f32) - .add_value(-1.02f32, -0.2222f32, 0f32) - .add_value(-0.51f32, -0.2222f32, 0f32) - .add_value(-0.44f32, -0.12f32, 0f32) - .add_value(-0.18f32, -0.12f32, 0f32) + .add_fixed_value_derivative(-1.1f32, 0.044f32, -0.1f32) + .add_fixed_value(-1.02f32, -0.2222f32) + .add_fixed_value_derivative(-0.51f32, -0.2222f32, 0.1f32) + .add_fixed_value(-0.44f32, -0.12f32) + .add_fixed_value_derivative(-0.18f32, -0.12f32, 0.1f32) .build(); - assert_eq!(spline.apply(&pos), -0.12f32); + let values = [ + ((-100, -100), -0.07604788f32), + ((-100, -90), -0.07773465f32), + ((-100, -80), -0.07928875f32), + ((-100, -70), -0.08118123f32), + ((-100, -60), -0.08313452f32), + ((-100, -50), -0.083534524f32), + ((-100, -40), -0.086245626f32), + ((-100, -30), -0.08444518f32), + ((-100, -20), -0.08520311f32), + ((-100, -10), -0.08629203f32), + ((-100, 0), -0.08723046f32), + ((-100, 10), -0.0888218f32), + ((-100, 20), -0.09126012f32), + ((-100, 30), -0.092776805f32), + ((-100, 40), -0.09374735f32), + ((-100, 50), -0.09605039f32), + ((-100, 60), -0.09593062f32), + ((-100, 70), -0.09638955f32), + ((-100, 80), -0.09660137f32), + ((-100, 90), -0.09732263f32), + ((-100, 100), -0.09875606f32), + ((-90, -100), -0.07605396f32), + ((-90, -90), -0.07945493f32), + ((-90, -80), -0.08126007f32), + ((-90, -70), -0.0827491f32), + ((-90, -60), -0.084900096f32), + ((-90, -50), -0.087383136f32), + ((-90, -40), -0.08763948f32), + ((-90, -30), -0.08750856f32), + ((-90, -20), -0.08923715f32), + ((-90, -10), -0.08950907f32), + ((-90, 0), -0.08966042f32), + ((-90, 10), -0.091661744f32), + ((-90, 20), -0.09423652f32), + ((-90, 30), -0.09460543f32), + ((-90, 40), -0.09597071f32), + ((-90, 50), -0.09838261f32), + ((-90, 60), -0.09757312f32), + ((-90, 70), -0.09852694f32), + ((-90, 80), -0.09875368f32), + ((-90, 90), -0.10035795f32), + ((-90, 100), -0.099384755f32), + ((-80, -100), -0.07845141f32), + ((-80, -90), -0.0802805f32), + ((-80, -80), -0.08364986f32), + ((-80, -70), -0.085202575f32), + ((-80, -60), -0.0893721f32), + ((-80, -50), -0.09021371f32), + ((-80, -40), -0.088948175f32), + ((-80, -30), -0.09102255f32), + ((-80, -20), -0.09252357f32), + ((-80, -10), -0.092946626f32), + ((-80, 0), -0.0917982f32), + ((-80, 10), -0.09275723f32), + ((-80, 20), -0.09508084f32), + ((-80, 30), -0.09741648f32), + ((-80, 40), -0.09864242f32), + ((-80, 50), -0.1010126f32), + ((-80, 60), -0.10251929f32), + ((-80, 70), -0.10301858f32), + ((-80, 80), -0.10152783f32), + ((-80, 90), -0.1018514f32), + ((-80, 100), -0.101050965f32), + ((-70, -100), -0.08047484f32), + ((-70, -90), -0.0827865f32), + ((-70, -80), -0.08533125f32), + ((-70, -70), -0.087316774f32), + ((-70, -60), -0.08924434f32), + ((-70, -50), -0.09139694f32), + ((-70, -40), -0.092277184f32), + ((-70, -30), -0.09338808f32), + ((-70, -20), -0.095891915f32), + ((-70, -10), -0.095507845f32), + ((-70, 0), -0.09539513f32), + ((-70, 10), -0.0951063f32), + ((-70, 20), -0.09744669f32), + ((-70, 30), -0.101334676f32), + ((-70, 40), -0.10026048f32), + ((-70, 50), -0.102552444f32), + ((-70, 60), -0.104417525f32), + ((-70, 70), -0.10407996f32), + ((-70, 80), -0.10480991f32), + ((-70, 90), -0.10390431f32), + ((-70, 100), -0.102846265f32), + ((-60, -100), -0.08198626f32), + ((-60, -90), -0.08353661f32), + ((-60, -80), -0.08603583f32), + ((-60, -70), -0.08766833f32), + ((-60, -60), -0.089199014f32), + ((-60, -50), -0.091917805f32), + ((-60, -40), -0.09299549f32), + ((-60, -30), -0.0956157f32), + ((-60, -20), -0.09864686f32), + ((-60, -10), -0.09914974f32), + ((-60, 0), -0.10039974f32), + ((-60, 10), -0.10030475f32), + ((-60, 20), -0.10159342f32), + ((-60, 30), -0.10401981f32), + ((-60, 40), -0.10531161f32), + ((-60, 50), -0.10649038f32), + ((-60, 60), -0.10697486f32), + ((-60, 70), -0.10814563f32), + ((-60, 80), -0.10756317f32), + ((-60, 90), -0.10590332f32), + ((-60, 100), -0.10525697f32), + ((-50, -100), -0.08205913f32), + ((-50, -90), -0.08393769f32), + ((-50, -80), -0.086751714f32), + ((-50, -70), -0.089658506f32), + ((-50, -60), -0.092683166f32), + ((-50, -50), -0.09480399f32), + ((-50, -40), -0.09606384f32), + ((-50, -30), -0.09774114f32), + ((-50, -20), -0.100446284f32), + ((-50, -10), -0.10084822f32), + ((-50, 0), -0.10314222f32), + ((-50, 10), -0.10293749f32), + ((-50, 20), -0.10586517f32), + ((-50, 30), -0.10697569f32), + ((-50, 40), -0.10719836f32), + ((-50, 50), -0.10689005f32), + ((-50, 60), -0.10781257f32), + ((-50, 70), -0.10913751f32), + ((-50, 80), -0.111755826f32), + ((-50, 90), -0.10983417f32), + ((-50, 100), -0.10947363f32), + ((-40, -100), -0.0824882f32), + ((-40, -90), -0.08360703f32), + ((-40, -80), -0.086381115f32), + ((-40, -70), -0.09064654f32), + ((-40, -60), -0.093374886f32), + ((-40, -50), -0.09642702f32), + ((-40, -40), -0.09817896f32), + ((-40, -30), -0.100624494f32), + ((-40, -20), -0.10402103f32), + ((-40, -10), -0.103324674f32), + ((-40, 0), -0.10734479f32), + ((-40, 10), -0.10787663f32), + ((-40, 20), -0.11011673f32), + ((-40, 30), -0.10879173f32), + ((-40, 40), -0.10899488f32), + ((-40, 50), -0.1093022f32), + ((-40, 60), -0.11100974f32), + ((-40, 70), -0.11430037f32), + ((-40, 80), -0.11370994f32), + ((-40, 90), -0.1117007f32), + ((-40, 100), -0.111225165f32), + ((-30, -100), -0.08073887f32), + ((-30, -90), -0.08562371f32), + ((-30, -80), -0.08811793f32), + ((-30, -70), -0.092022136f32), + ((-30, -60), -0.09238706f32), + ((-30, -50), -0.09777247f32), + ((-30, -40), -0.10047619f32), + ((-30, -30), -0.1017582f32), + ((-30, -20), -0.10325858f32), + ((-30, -10), -0.10587716f32), + ((-30, 0), -0.10807945f32), + ((-30, 10), -0.11133594f32), + ((-30, 20), -0.11149085f32), + ((-30, 30), -0.11169845f32), + ((-30, 40), -0.11191458f32), + ((-30, 50), -0.11245423f32), + ((-30, 60), -0.11395778f32), + ((-30, 70), -0.116144754f32), + ((-30, 80), -0.115703195f32), + ((-30, 90), -0.11417798f32), + ((-30, 100), -0.113027185f32), + ((-20, -100), -0.081831336f32), + ((-20, -90), -0.08537665f32), + ((-20, -80), -0.08823441f32), + ((-20, -70), -0.09004638f32), + ((-20, -60), -0.091682106f32), + ((-20, -50), -0.09560484f32), + ((-20, -40), -0.100073636f32), + ((-20, -30), -0.102195345f32), + ((-20, -20), -0.103985146f32), + ((-20, -10), -0.105535336f32), + ((-20, 0), -0.11013269f32), + ((-20, 10), -0.1115511f32), + ((-20, 20), -0.113062836f32), + ((-20, 30), -0.112847894f32), + ((-20, 40), -0.11428483f32), + ((-20, 50), -0.11667834f32), + ((-20, 60), -0.117276795f32), + ((-20, 70), -0.11689238f32), + ((-20, 80), -0.1160782f32), + ((-20, 90), -0.11455002f32), + ((-20, 100), -0.11329481f32), + ((-10, -100), -0.08257191f32), + ((-10, -90), -0.085004464f32), + ((-10, -80), -0.08695547f32), + ((-10, -70), -0.08808699f32), + ((-10, -60), -0.091026604f32), + ((-10, -50), -0.09544293f32), + ((-10, -40), -0.09790615f32), + ((-10, -30), -0.10184401f32), + ((-10, -20), -0.10396968f32), + ((-10, -10), -0.1076317f32), + ((-10, 0), -0.11115202f32), + ((-10, 10), -0.11212789f32), + ((-10, 20), -0.11348673f32), + ((-10, 30), -0.11471321f32), + ((-10, 40), -0.114718616f32), + ((-10, 50), -0.11725365f32), + ((-10, 60), -0.11695717f32), + ((-10, 70), -0.116616994f32), + ((-10, 80), -0.11536371f32), + ((-10, 90), -0.11446484f32), + ((-10, 100), -0.11369774f32), + ((0, -100), -0.08459158f32), + ((0, -90), -0.08656791f32), + ((0, -80), -0.08754034f32), + ((0, -70), -0.08878641f32), + ((0, -60), -0.09282567f32), + ((0, -50), -0.09490024f32), + ((0, -40), -0.09933582f32), + ((0, -30), -0.10083613f32), + ((0, -20), -0.104990706f32), + ((0, -10), -0.10789699f32), + ((0, 0), -0.10978986f32), + ((0, 10), -0.11214093f32), + ((0, 20), -0.11311828f32), + ((0, 30), -0.11421281f32), + ((0, 40), -0.11489451f32), + ((0, 50), -0.11654575f32), + ((0, 60), -0.116693474f32), + ((0, 70), -0.11676903f32), + ((0, 80), -0.11486762f32), + ((0, 90), -0.11349271f32), + ((0, 100), -0.11301751f32), + ((10, -100), -0.08532186f32), + ((10, -90), -0.087390676f32), + ((10, -80), -0.08947607f32), + ((10, -70), -0.091350235f32), + ((10, -60), -0.092257306f32), + ((10, -50), -0.094102554f32), + ((10, -40), -0.09877145f32), + ((10, -30), -0.101968475f32), + ((10, -20), -0.10476847f32), + ((10, -10), -0.10820749f32), + ((10, 0), -0.1099116f32), + ((10, 10), -0.1106353f32), + ((10, 20), -0.11173092f32), + ((10, 30), -0.11349803f32), + ((10, 40), -0.11299823f32), + ((10, 50), -0.11539698f32), + ((10, 60), -0.11715141f32), + ((10, 70), -0.11558097f32), + ((10, 80), -0.114774175f32), + ((10, 90), -0.11429333f32), + ((10, 100), -0.112418234f32), + ((20, -100), -0.08536324f32), + ((20, -90), -0.08702316f32), + ((20, -80), -0.09097032f32), + ((20, -70), -0.09171111f32), + ((20, -60), -0.092209786f32), + ((20, -50), -0.09390856f32), + ((20, -40), -0.09674665f32), + ((20, -30), -0.0995738f32), + ((20, -20), -0.10170178f32), + ((20, -10), -0.107144f32), + ((20, 0), -0.10934077f32), + ((20, 10), -0.11114335f32), + ((20, 20), -0.11120629f32), + ((20, 30), -0.11104426f32), + ((20, 40), -0.109872885f32), + ((20, 50), -0.11435944f32), + ((20, 60), -0.11630697f32), + ((20, 70), -0.11403515f32), + ((20, 80), -0.11370773f32), + ((20, 90), -0.11165723f32), + ((20, 100), -0.11122058f32), + ((30, -100), -0.083562575f32), + ((30, -90), -0.08608784f32), + ((30, -80), -0.08794823f32), + ((30, -70), -0.091189116f32), + ((30, -60), -0.093153656f32), + ((30, -50), -0.0951614f32), + ((30, -40), -0.0953993f32), + ((30, -30), -0.096983574f32), + ((30, -20), -0.10012217f32), + ((30, -10), -0.10612148f32), + ((30, 0), -0.10943102f32), + ((30, 10), -0.10920269f32), + ((30, 20), -0.10791202f32), + ((30, 30), -0.10835938f32), + ((30, 40), -0.10786465f32), + ((30, 50), -0.11130254f32), + ((30, 60), -0.1126149f32), + ((30, 70), -0.110773936f32), + ((30, 80), -0.109979525f32), + ((30, 90), -0.10987309f32), + ((30, 100), -0.108747214f32), + ((40, -100), -0.08093807f32), + ((40, -90), -0.08576739f32), + ((40, -80), -0.085233085f32), + ((40, -70), -0.09012596f32), + ((40, -60), -0.09217769f32), + ((40, -50), -0.09351354f32), + ((40, -40), -0.09589194f32), + ((40, -30), -0.09674299f32), + ((40, -20), -0.09954912f32), + ((40, -10), -0.10170849f32), + ((40, 0), -0.10476398f32), + ((40, 10), -0.10546719f32), + ((40, 20), -0.10537742f32), + ((40, 30), -0.105657674f32), + ((40, 40), -0.10615531f32), + ((40, 50), -0.10808634f32), + ((40, 60), -0.10634413f32), + ((40, 70), -0.107364416f32), + ((40, 80), -0.10856771f32), + ((40, 90), -0.10862812f32), + ((40, 100), -0.10680454f32), + ((50, -100), -0.082533084f32), + ((50, -90), -0.086810954f32), + ((50, -80), -0.085271746f32), + ((50, -70), -0.08944471f32), + ((50, -60), -0.09193231f32), + ((50, -50), -0.09362271f32), + ((50, -40), -0.09453575f32), + ((50, -30), -0.095691115f32), + ((50, -20), -0.098154165f32), + ((50, -10), -0.097271696f32), + ((50, 0), -0.09942495f32), + ((50, 10), -0.10164021f32), + ((50, 20), -0.10168414f32), + ((50, 30), -0.104937024f32), + ((50, 40), -0.10539722f32), + ((50, 50), -0.10424481f32), + ((50, 60), -0.10219841f32), + ((50, 70), -0.10340266f32), + ((50, 80), -0.106310576f32), + ((50, 90), -0.10595322f32), + ((50, 100), -0.10645929f32), + ((60, -100), -0.08115639f32), + ((60, -90), -0.08455347f32), + ((60, -80), -0.08534711f32), + ((60, -70), -0.08780121f32), + ((60, -60), -0.090132974f32), + ((60, -50), -0.091330595f32), + ((60, -40), -0.091192245f32), + ((60, -30), -0.0924395f32), + ((60, -20), -0.09527585f32), + ((60, -10), -0.09565725f32), + ((60, 0), -0.09630064f32), + ((60, 10), -0.09673829f32), + ((60, 20), -0.09658762f32), + ((60, 30), -0.09961178f32), + ((60, 40), -0.100632355f32), + ((60, 50), -0.10012698f32), + ((60, 60), -0.09957688f32), + ((60, 70), -0.10111454f32), + ((60, 80), -0.10357678f32), + ((60, 90), -0.104492605f32), + ((60, 100), -0.10421045f32), + ((70, -100), -0.074997574f32), + ((70, -90), -0.07923891f32), + ((70, -80), -0.08061024f32), + ((70, -70), -0.08389824f32), + ((70, -60), -0.08752339f32), + ((70, -50), -0.090026386f32), + ((70, -40), -0.09045799f32), + ((70, -30), -0.091568656f32), + ((70, -20), -0.09186759f32), + ((70, -10), -0.09279721f32), + ((70, 0), -0.093260504f32), + ((70, 10), -0.092824616f32), + ((70, 20), -0.093960315f32), + ((70, 30), -0.09660603f32), + ((70, 40), -0.09790762f32), + ((70, 50), -0.09831002f32), + ((70, 60), -0.09862129f32), + ((70, 70), -0.1009444f32), + ((70, 80), -0.101910815f32), + ((70, 90), -0.10201355f32), + ((70, 100), -0.1022472f32), + ((80, -100), -0.07063179f32), + ((80, -90), -0.073081866f32), + ((80, -80), -0.0773198f32), + ((80, -70), -0.079035714f32), + ((80, -60), -0.08466645f32), + ((80, -50), -0.08781248f32), + ((80, -40), -0.087890774f32), + ((80, -30), -0.09016053f32), + ((80, -20), -0.09094465f32), + ((80, -10), -0.09138842f32), + ((80, 0), -0.090936236f32), + ((80, 10), -0.09181613f32), + ((80, 20), -0.09273602f32), + ((80, 30), -0.09400447f32), + ((80, 40), -0.094502196f32), + ((80, 50), -0.09436651f32), + ((80, 60), -0.09598513f32), + ((80, 70), -0.098289296f32), + ((80, 80), -0.10086883f32), + ((80, 90), -0.101560704f32), + ((80, 100), -0.10193728f32), + ((90, -100), -0.07009827f32), + ((90, -90), -0.071226865f32), + ((90, -80), -0.07469955f32), + ((90, -70), -0.07523824f32), + ((90, -60), -0.07865613f32), + ((90, -50), -0.084405504f32), + ((90, -40), -0.085147366f32), + ((90, -30), -0.08834492f32), + ((90, -20), -0.08923916f32), + ((90, -10), -0.08832547f32), + ((90, 0), -0.087817885f32), + ((90, 10), -0.09013721f32), + ((90, 20), -0.091518745f32), + ((90, 30), -0.091617286f32), + ((90, 40), -0.0920376f32), + ((90, 50), -0.09236775f32), + ((90, 60), -0.094668776f32), + ((90, 70), -0.096736684f32), + ((90, 80), -0.099345334f32), + ((90, 90), -0.10124628f32), + ((90, 100), -0.10255872f32), + ((100, -100), -0.06807774f32), + ((100, -90), -0.07107438f32), + ((100, -80), -0.072487816f32), + ((100, -70), -0.075734794f32), + ((100, -60), -0.07796392f32), + ((100, -50), -0.08121155f32), + ((100, -40), -0.08184202f32), + ((100, -30), -0.08378057f32), + ((100, -20), -0.0849825f32), + ((100, -10), -0.08561178f32), + ((100, 0), -0.08618045f32), + ((100, 10), -0.08772436f32), + ((100, 20), -0.08878901f32), + ((100, 30), -0.08852096f32), + ((100, 40), -0.0906315f32), + ((100, 50), -0.091744505f32), + ((100, 60), -0.093411185f32), + ((100, 70), -0.09586958f32), + ((100, 80), -0.098537765f32), + ((100, 90), -0.10159851f32), + ((100, 100), -0.10332601f32), + ]; + + for ((x, z), result) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_owned_correctness() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let spline = SplineBuilder::new(CONTINENTS_OVERWORLD.clone(), FloatAmplifier::Identity) + .add_fixed_value_derivative(-1.1f32, 0.044f32, -0.1f32) + .add_fixed_value(-1.02f32, -0.2222f32) + .add_fixed_value_derivative(-0.51f32, -0.2222f32, 0.1f32) + .add_fixed_value(-0.44f32, -0.12f32) + .add_fixed_value_derivative(-0.18f32, -0.12f32, 0.1f32) + .build(); + + let spline_function: SharedComponentReference = + SplineFunction::::new(spline.into()).into(); + let mut func = spline_function.convert_to_dyn(&mut converter); + + let values = [ + ((-100, -100), -0.07604788f32), + ((-100, -90), -0.07773465f32), + ((-100, -80), -0.07928875f32), + ((-100, -70), -0.08118123f32), + ((-100, -60), -0.08313452f32), + ((-100, -50), -0.083534524f32), + ((-100, -40), -0.086245626f32), + ((-100, -30), -0.08444518f32), + ((-100, -20), -0.08520311f32), + ((-100, -10), -0.08629203f32), + ((-100, 0), -0.08723046f32), + ((-100, 10), -0.0888218f32), + ((-100, 20), -0.09126012f32), + ((-100, 30), -0.092776805f32), + ((-100, 40), -0.09374735f32), + ((-100, 50), -0.09605039f32), + ((-100, 60), -0.09593062f32), + ((-100, 70), -0.09638955f32), + ((-100, 80), -0.09660137f32), + ((-100, 90), -0.09732263f32), + ((-100, 100), -0.09875606f32), + ((-90, -100), -0.07605396f32), + ((-90, -90), -0.07945493f32), + ((-90, -80), -0.08126007f32), + ((-90, -70), -0.0827491f32), + ((-90, -60), -0.084900096f32), + ((-90, -50), -0.087383136f32), + ((-90, -40), -0.08763948f32), + ((-90, -30), -0.08750856f32), + ((-90, -20), -0.08923715f32), + ((-90, -10), -0.08950907f32), + ((-90, 0), -0.08966042f32), + ((-90, 10), -0.091661744f32), + ((-90, 20), -0.09423652f32), + ((-90, 30), -0.09460543f32), + ((-90, 40), -0.09597071f32), + ((-90, 50), -0.09838261f32), + ((-90, 60), -0.09757312f32), + ((-90, 70), -0.09852694f32), + ((-90, 80), -0.09875368f32), + ((-90, 90), -0.10035795f32), + ((-90, 100), -0.099384755f32), + ((-80, -100), -0.07845141f32), + ((-80, -90), -0.0802805f32), + ((-80, -80), -0.08364986f32), + ((-80, -70), -0.085202575f32), + ((-80, -60), -0.0893721f32), + ((-80, -50), -0.09021371f32), + ((-80, -40), -0.088948175f32), + ((-80, -30), -0.09102255f32), + ((-80, -20), -0.09252357f32), + ((-80, -10), -0.092946626f32), + ((-80, 0), -0.0917982f32), + ((-80, 10), -0.09275723f32), + ((-80, 20), -0.09508084f32), + ((-80, 30), -0.09741648f32), + ((-80, 40), -0.09864242f32), + ((-80, 50), -0.1010126f32), + ((-80, 60), -0.10251929f32), + ((-80, 70), -0.10301858f32), + ((-80, 80), -0.10152783f32), + ((-80, 90), -0.1018514f32), + ((-80, 100), -0.101050965f32), + ((-70, -100), -0.08047484f32), + ((-70, -90), -0.0827865f32), + ((-70, -80), -0.08533125f32), + ((-70, -70), -0.087316774f32), + ((-70, -60), -0.08924434f32), + ((-70, -50), -0.09139694f32), + ((-70, -40), -0.092277184f32), + ((-70, -30), -0.09338808f32), + ((-70, -20), -0.095891915f32), + ((-70, -10), -0.095507845f32), + ((-70, 0), -0.09539513f32), + ((-70, 10), -0.0951063f32), + ((-70, 20), -0.09744669f32), + ((-70, 30), -0.101334676f32), + ((-70, 40), -0.10026048f32), + ((-70, 50), -0.102552444f32), + ((-70, 60), -0.104417525f32), + ((-70, 70), -0.10407996f32), + ((-70, 80), -0.10480991f32), + ((-70, 90), -0.10390431f32), + ((-70, 100), -0.102846265f32), + ((-60, -100), -0.08198626f32), + ((-60, -90), -0.08353661f32), + ((-60, -80), -0.08603583f32), + ((-60, -70), -0.08766833f32), + ((-60, -60), -0.089199014f32), + ((-60, -50), -0.091917805f32), + ((-60, -40), -0.09299549f32), + ((-60, -30), -0.0956157f32), + ((-60, -20), -0.09864686f32), + ((-60, -10), -0.09914974f32), + ((-60, 0), -0.10039974f32), + ((-60, 10), -0.10030475f32), + ((-60, 20), -0.10159342f32), + ((-60, 30), -0.10401981f32), + ((-60, 40), -0.10531161f32), + ((-60, 50), -0.10649038f32), + ((-60, 60), -0.10697486f32), + ((-60, 70), -0.10814563f32), + ((-60, 80), -0.10756317f32), + ((-60, 90), -0.10590332f32), + ((-60, 100), -0.10525697f32), + ((-50, -100), -0.08205913f32), + ((-50, -90), -0.08393769f32), + ((-50, -80), -0.086751714f32), + ((-50, -70), -0.089658506f32), + ((-50, -60), -0.092683166f32), + ((-50, -50), -0.09480399f32), + ((-50, -40), -0.09606384f32), + ((-50, -30), -0.09774114f32), + ((-50, -20), -0.100446284f32), + ((-50, -10), -0.10084822f32), + ((-50, 0), -0.10314222f32), + ((-50, 10), -0.10293749f32), + ((-50, 20), -0.10586517f32), + ((-50, 30), -0.10697569f32), + ((-50, 40), -0.10719836f32), + ((-50, 50), -0.10689005f32), + ((-50, 60), -0.10781257f32), + ((-50, 70), -0.10913751f32), + ((-50, 80), -0.111755826f32), + ((-50, 90), -0.10983417f32), + ((-50, 100), -0.10947363f32), + ((-40, -100), -0.0824882f32), + ((-40, -90), -0.08360703f32), + ((-40, -80), -0.086381115f32), + ((-40, -70), -0.09064654f32), + ((-40, -60), -0.093374886f32), + ((-40, -50), -0.09642702f32), + ((-40, -40), -0.09817896f32), + ((-40, -30), -0.100624494f32), + ((-40, -20), -0.10402103f32), + ((-40, -10), -0.103324674f32), + ((-40, 0), -0.10734479f32), + ((-40, 10), -0.10787663f32), + ((-40, 20), -0.11011673f32), + ((-40, 30), -0.10879173f32), + ((-40, 40), -0.10899488f32), + ((-40, 50), -0.1093022f32), + ((-40, 60), -0.11100974f32), + ((-40, 70), -0.11430037f32), + ((-40, 80), -0.11370994f32), + ((-40, 90), -0.1117007f32), + ((-40, 100), -0.111225165f32), + ((-30, -100), -0.08073887f32), + ((-30, -90), -0.08562371f32), + ((-30, -80), -0.08811793f32), + ((-30, -70), -0.092022136f32), + ((-30, -60), -0.09238706f32), + ((-30, -50), -0.09777247f32), + ((-30, -40), -0.10047619f32), + ((-30, -30), -0.1017582f32), + ((-30, -20), -0.10325858f32), + ((-30, -10), -0.10587716f32), + ((-30, 0), -0.10807945f32), + ((-30, 10), -0.11133594f32), + ((-30, 20), -0.11149085f32), + ((-30, 30), -0.11169845f32), + ((-30, 40), -0.11191458f32), + ((-30, 50), -0.11245423f32), + ((-30, 60), -0.11395778f32), + ((-30, 70), -0.116144754f32), + ((-30, 80), -0.115703195f32), + ((-30, 90), -0.11417798f32), + ((-30, 100), -0.113027185f32), + ((-20, -100), -0.081831336f32), + ((-20, -90), -0.08537665f32), + ((-20, -80), -0.08823441f32), + ((-20, -70), -0.09004638f32), + ((-20, -60), -0.091682106f32), + ((-20, -50), -0.09560484f32), + ((-20, -40), -0.100073636f32), + ((-20, -30), -0.102195345f32), + ((-20, -20), -0.103985146f32), + ((-20, -10), -0.105535336f32), + ((-20, 0), -0.11013269f32), + ((-20, 10), -0.1115511f32), + ((-20, 20), -0.113062836f32), + ((-20, 30), -0.112847894f32), + ((-20, 40), -0.11428483f32), + ((-20, 50), -0.11667834f32), + ((-20, 60), -0.117276795f32), + ((-20, 70), -0.11689238f32), + ((-20, 80), -0.1160782f32), + ((-20, 90), -0.11455002f32), + ((-20, 100), -0.11329481f32), + ((-10, -100), -0.08257191f32), + ((-10, -90), -0.085004464f32), + ((-10, -80), -0.08695547f32), + ((-10, -70), -0.08808699f32), + ((-10, -60), -0.091026604f32), + ((-10, -50), -0.09544293f32), + ((-10, -40), -0.09790615f32), + ((-10, -30), -0.10184401f32), + ((-10, -20), -0.10396968f32), + ((-10, -10), -0.1076317f32), + ((-10, 0), -0.11115202f32), + ((-10, 10), -0.11212789f32), + ((-10, 20), -0.11348673f32), + ((-10, 30), -0.11471321f32), + ((-10, 40), -0.114718616f32), + ((-10, 50), -0.11725365f32), + ((-10, 60), -0.11695717f32), + ((-10, 70), -0.116616994f32), + ((-10, 80), -0.11536371f32), + ((-10, 90), -0.11446484f32), + ((-10, 100), -0.11369774f32), + ((0, -100), -0.08459158f32), + ((0, -90), -0.08656791f32), + ((0, -80), -0.08754034f32), + ((0, -70), -0.08878641f32), + ((0, -60), -0.09282567f32), + ((0, -50), -0.09490024f32), + ((0, -40), -0.09933582f32), + ((0, -30), -0.10083613f32), + ((0, -20), -0.104990706f32), + ((0, -10), -0.10789699f32), + ((0, 0), -0.10978986f32), + ((0, 10), -0.11214093f32), + ((0, 20), -0.11311828f32), + ((0, 30), -0.11421281f32), + ((0, 40), -0.11489451f32), + ((0, 50), -0.11654575f32), + ((0, 60), -0.116693474f32), + ((0, 70), -0.11676903f32), + ((0, 80), -0.11486762f32), + ((0, 90), -0.11349271f32), + ((0, 100), -0.11301751f32), + ((10, -100), -0.08532186f32), + ((10, -90), -0.087390676f32), + ((10, -80), -0.08947607f32), + ((10, -70), -0.091350235f32), + ((10, -60), -0.092257306f32), + ((10, -50), -0.094102554f32), + ((10, -40), -0.09877145f32), + ((10, -30), -0.101968475f32), + ((10, -20), -0.10476847f32), + ((10, -10), -0.10820749f32), + ((10, 0), -0.1099116f32), + ((10, 10), -0.1106353f32), + ((10, 20), -0.11173092f32), + ((10, 30), -0.11349803f32), + ((10, 40), -0.11299823f32), + ((10, 50), -0.11539698f32), + ((10, 60), -0.11715141f32), + ((10, 70), -0.11558097f32), + ((10, 80), -0.114774175f32), + ((10, 90), -0.11429333f32), + ((10, 100), -0.112418234f32), + ((20, -100), -0.08536324f32), + ((20, -90), -0.08702316f32), + ((20, -80), -0.09097032f32), + ((20, -70), -0.09171111f32), + ((20, -60), -0.092209786f32), + ((20, -50), -0.09390856f32), + ((20, -40), -0.09674665f32), + ((20, -30), -0.0995738f32), + ((20, -20), -0.10170178f32), + ((20, -10), -0.107144f32), + ((20, 0), -0.10934077f32), + ((20, 10), -0.11114335f32), + ((20, 20), -0.11120629f32), + ((20, 30), -0.11104426f32), + ((20, 40), -0.109872885f32), + ((20, 50), -0.11435944f32), + ((20, 60), -0.11630697f32), + ((20, 70), -0.11403515f32), + ((20, 80), -0.11370773f32), + ((20, 90), -0.11165723f32), + ((20, 100), -0.11122058f32), + ((30, -100), -0.083562575f32), + ((30, -90), -0.08608784f32), + ((30, -80), -0.08794823f32), + ((30, -70), -0.091189116f32), + ((30, -60), -0.093153656f32), + ((30, -50), -0.0951614f32), + ((30, -40), -0.0953993f32), + ((30, -30), -0.096983574f32), + ((30, -20), -0.10012217f32), + ((30, -10), -0.10612148f32), + ((30, 0), -0.10943102f32), + ((30, 10), -0.10920269f32), + ((30, 20), -0.10791202f32), + ((30, 30), -0.10835938f32), + ((30, 40), -0.10786465f32), + ((30, 50), -0.11130254f32), + ((30, 60), -0.1126149f32), + ((30, 70), -0.110773936f32), + ((30, 80), -0.109979525f32), + ((30, 90), -0.10987309f32), + ((30, 100), -0.108747214f32), + ((40, -100), -0.08093807f32), + ((40, -90), -0.08576739f32), + ((40, -80), -0.085233085f32), + ((40, -70), -0.09012596f32), + ((40, -60), -0.09217769f32), + ((40, -50), -0.09351354f32), + ((40, -40), -0.09589194f32), + ((40, -30), -0.09674299f32), + ((40, -20), -0.09954912f32), + ((40, -10), -0.10170849f32), + ((40, 0), -0.10476398f32), + ((40, 10), -0.10546719f32), + ((40, 20), -0.10537742f32), + ((40, 30), -0.105657674f32), + ((40, 40), -0.10615531f32), + ((40, 50), -0.10808634f32), + ((40, 60), -0.10634413f32), + ((40, 70), -0.107364416f32), + ((40, 80), -0.10856771f32), + ((40, 90), -0.10862812f32), + ((40, 100), -0.10680454f32), + ((50, -100), -0.082533084f32), + ((50, -90), -0.086810954f32), + ((50, -80), -0.085271746f32), + ((50, -70), -0.08944471f32), + ((50, -60), -0.09193231f32), + ((50, -50), -0.09362271f32), + ((50, -40), -0.09453575f32), + ((50, -30), -0.095691115f32), + ((50, -20), -0.098154165f32), + ((50, -10), -0.097271696f32), + ((50, 0), -0.09942495f32), + ((50, 10), -0.10164021f32), + ((50, 20), -0.10168414f32), + ((50, 30), -0.104937024f32), + ((50, 40), -0.10539722f32), + ((50, 50), -0.10424481f32), + ((50, 60), -0.10219841f32), + ((50, 70), -0.10340266f32), + ((50, 80), -0.106310576f32), + ((50, 90), -0.10595322f32), + ((50, 100), -0.10645929f32), + ((60, -100), -0.08115639f32), + ((60, -90), -0.08455347f32), + ((60, -80), -0.08534711f32), + ((60, -70), -0.08780121f32), + ((60, -60), -0.090132974f32), + ((60, -50), -0.091330595f32), + ((60, -40), -0.091192245f32), + ((60, -30), -0.0924395f32), + ((60, -20), -0.09527585f32), + ((60, -10), -0.09565725f32), + ((60, 0), -0.09630064f32), + ((60, 10), -0.09673829f32), + ((60, 20), -0.09658762f32), + ((60, 30), -0.09961178f32), + ((60, 40), -0.100632355f32), + ((60, 50), -0.10012698f32), + ((60, 60), -0.09957688f32), + ((60, 70), -0.10111454f32), + ((60, 80), -0.10357678f32), + ((60, 90), -0.104492605f32), + ((60, 100), -0.10421045f32), + ((70, -100), -0.074997574f32), + ((70, -90), -0.07923891f32), + ((70, -80), -0.08061024f32), + ((70, -70), -0.08389824f32), + ((70, -60), -0.08752339f32), + ((70, -50), -0.090026386f32), + ((70, -40), -0.09045799f32), + ((70, -30), -0.091568656f32), + ((70, -20), -0.09186759f32), + ((70, -10), -0.09279721f32), + ((70, 0), -0.093260504f32), + ((70, 10), -0.092824616f32), + ((70, 20), -0.093960315f32), + ((70, 30), -0.09660603f32), + ((70, 40), -0.09790762f32), + ((70, 50), -0.09831002f32), + ((70, 60), -0.09862129f32), + ((70, 70), -0.1009444f32), + ((70, 80), -0.101910815f32), + ((70, 90), -0.10201355f32), + ((70, 100), -0.1022472f32), + ((80, -100), -0.07063179f32), + ((80, -90), -0.073081866f32), + ((80, -80), -0.0773198f32), + ((80, -70), -0.079035714f32), + ((80, -60), -0.08466645f32), + ((80, -50), -0.08781248f32), + ((80, -40), -0.087890774f32), + ((80, -30), -0.09016053f32), + ((80, -20), -0.09094465f32), + ((80, -10), -0.09138842f32), + ((80, 0), -0.090936236f32), + ((80, 10), -0.09181613f32), + ((80, 20), -0.09273602f32), + ((80, 30), -0.09400447f32), + ((80, 40), -0.094502196f32), + ((80, 50), -0.09436651f32), + ((80, 60), -0.09598513f32), + ((80, 70), -0.098289296f32), + ((80, 80), -0.10086883f32), + ((80, 90), -0.101560704f32), + ((80, 100), -0.10193728f32), + ((90, -100), -0.07009827f32), + ((90, -90), -0.071226865f32), + ((90, -80), -0.07469955f32), + ((90, -70), -0.07523824f32), + ((90, -60), -0.07865613f32), + ((90, -50), -0.084405504f32), + ((90, -40), -0.085147366f32), + ((90, -30), -0.08834492f32), + ((90, -20), -0.08923916f32), + ((90, -10), -0.08832547f32), + ((90, 0), -0.087817885f32), + ((90, 10), -0.09013721f32), + ((90, 20), -0.091518745f32), + ((90, 30), -0.091617286f32), + ((90, 40), -0.0920376f32), + ((90, 50), -0.09236775f32), + ((90, 60), -0.094668776f32), + ((90, 70), -0.096736684f32), + ((90, 80), -0.099345334f32), + ((90, 90), -0.10124628f32), + ((90, 100), -0.10255872f32), + ((100, -100), -0.06807774f32), + ((100, -90), -0.07107438f32), + ((100, -80), -0.072487816f32), + ((100, -70), -0.075734794f32), + ((100, -60), -0.07796392f32), + ((100, -50), -0.08121155f32), + ((100, -40), -0.08184202f32), + ((100, -30), -0.08378057f32), + ((100, -20), -0.0849825f32), + ((100, -10), -0.08561178f32), + ((100, 0), -0.08618045f32), + ((100, 10), -0.08772436f32), + ((100, 20), -0.08878901f32), + ((100, 30), -0.08852096f32), + ((100, 40), -0.0906315f32), + ((100, 50), -0.091744505f32), + ((100, 60), -0.093411185f32), + ((100, 70), -0.09586958f32), + ((100, 80), -0.098537765f32), + ((100, 90), -0.10159851f32), + ((100, 100), -0.10332601f32), + ]; + + for ((x, z), result) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(func.sample_mut(pos, &FakeEnvironment {}), result as f64); + } } } diff --git a/pumpkin-world/src/world_gen/noise/density/terrain_helpers.rs b/pumpkin-world/src/world_gen/noise/density/terrain_helpers.rs index 2d478fb94..b19df8c63 100644 --- a/pumpkin-world/src/world_gen/noise/density/terrain_helpers.rs +++ b/pumpkin-world/src/world_gen/noise/density/terrain_helpers.rs @@ -1,20 +1,18 @@ // From da java -use std::sync::Arc; - -use crate::world_gen::noise::density::spline::{ - FloatAmplifier, Spline, SplineBuilder, SplineValue, -}; -use crate::world_gen::noise::density::{peaks_valleys_noise, DensityFunction}; +use crate::world_gen::noise::density::peaks_valleys_noise; use crate::world_gen::noise::lerp; +use super::component_functions::SharedComponentReference; +use super::spline::{FloatAmplifier, ImmutableSpline, ImmutableSplineRef, SplineBuilder}; + #[inline] fn get_offset_value(f: f32, g: f32, h: f32) -> f32 { - let k = (1f32 - g).mul_add(-0.5f32, 1f32); + let k = (1f32 - g) * -0.5f32 + 1f32; let l = 0.5f32 * (1f32 - g); let m = (f + 1.17f32) * 0.46082947f32; - let n = m.mul_add(k, -l); + let n = m * k - l; if f < h { n.max(-0.2222f32) @@ -25,10 +23,10 @@ fn get_offset_value(f: f32, g: f32, h: f32) -> f32 { #[inline] fn skew_map(f: f32) -> f32 { - let k = (1f32 - f).mul_add(-0.5f32, 1f32); - let l = 0.5f32 * (1f32 - f); + let i = 1f32 - (1f32 - f) * 0.5f32; + let j = 0.5f32 * (1f32 - f); - l / (0.46082947f32 * k) - 1.17f32 + j / (0.46082947f32 * i) - 1.17f32 } #[inline] @@ -37,12 +35,12 @@ fn diff_quot(f: f32, g: f32, h: f32, i: f32) -> f32 { } fn create_ridges_spline( - function: Arc, + function: SharedComponentReference, f: f32, bl: bool, amplifier: FloatAmplifier, -) -> Spline { - let mut builder = SplineBuilder::new(function, amplifier); +) -> ImmutableSpline { + let builder = SplineBuilder::new(function, amplifier); let i = get_offset_value(-1f32, f, -0.7f32); let k = get_offset_value(1f32, f, -0.7f32); @@ -54,27 +52,27 @@ fn create_ridges_spline( let p = get_offset_value(-0.75f32, f, -0.7f32); let q = diff_quot(i, p, -1f32, -0.75f32); let builder = builder - .add_value(-1f32, i, q) - .add_value(-0.75f32, p, 0f32) - .add_value(-0.65f32, n, 0f32); + .add_fixed_value_derivative(-1f32, i, q) + .add_fixed_value(-0.75f32, p) + .add_fixed_value(-0.65f32, n); let r = get_offset_value(l, f, -0.7f32); let s = diff_quot(r, k, l, 1f32); builder - .add_value(l - 0.01f32, r, 0f32) - .add_value(l, r, s) - .add_value(1f32, k, s) + .add_fixed_value(l - 0.01f32, r) + .add_fixed_value_derivative(l, r, s) + .add_fixed_value_derivative(1f32, k, s) } else { let n = diff_quot(i, k, -1f32, 1f32); let builder = if bl { builder - .add_value(-1f32, 0.2f32.max(i), 0f32) - .add_value(0f32, lerp(0.5f32, i, k), n) + .add_fixed_value(-1f32, 0.2f32.max(i)) + .add_fixed_value_derivative(0f32, lerp(0.5f32, i, k), n) } else { - builder.add_value(-1f32, i, n) + builder.add_fixed_value_derivative(-1f32, i, n) }; - builder.add_value(1f32, k, n) + builder.add_fixed_value_derivative(1f32, k, n) }; builder.build() @@ -82,7 +80,7 @@ fn create_ridges_spline( #[allow(clippy::too_many_arguments)] fn create_standard_spline( - ridges: Arc, + ridges: SharedComponentReference, continental: f32, f: f32, g: f32, @@ -90,135 +88,125 @@ fn create_standard_spline( i: f32, j: f32, amplifier: FloatAmplifier, -) -> Spline { +) -> ImmutableSpline { let k = j.max(0.5f32 * (f - continental)); let l = 5f32 * (g - f); SplineBuilder::new(ridges, amplifier) - .add_value(-1f32, continental, 0f32) - .add_value(-0.4f32, f, k.min(l)) - .add_value(0f32, g, l) - .add_value(0.4f32, h, 2f32 * (h - g)) - .add_value(1f32, i, 0.7f32 * (i - h)) + .add_fixed_value_derivative(-1f32, continental, k) + .add_fixed_value_derivative(-0.4f32, f, k.min(l)) + .add_fixed_value_derivative(0f32, g, l) + .add_fixed_value_derivative(0.4f32, h, 2f32 * (h - g)) + .add_fixed_value_derivative(1f32, i, 0.7f32 * (i - h)) .build() } -fn create_total_spline<'a>( - erosion: Arc>, - ridges: Arc>, - ridges_folded: Arc>, +fn create_total_spline( + erosion: SharedComponentReference, + ridges: SharedComponentReference, + ridges_folded: SharedComponentReference, f: f32, bl: bool, amplifier: FloatAmplifier, -) -> Spline<'a> { - let spline = SplineBuilder::new(ridges.clone(), amplifier.clone()) - .add_value(-0.2f32, 6.3f32, 0f32) - .add_value(0.2f32, f, 0f32) - .build(); +) -> ImmutableSpline { + let spline_ref: ImmutableSplineRef = SplineBuilder::new(ridges.clone(), amplifier) + .add_fixed_value(-0.2f32, 6.3f32) + .add_fixed_value(0.2f32, f) + .build() + .into(); - let mut builder = SplineBuilder::new(erosion, amplifier.clone()); + let builder = SplineBuilder::new(erosion, amplifier); let builder = builder - .add_spline(-0.6f32, SplineValue::Spline(spline.clone()), 0f32) - .add_spline( + .add_spline_value(-0.6f32, spline_ref.clone()) + .add_spline_value( -0.5f32, - SplineValue::Spline( - SplineBuilder::new(ridges.clone(), amplifier.clone()) - .add_value(-0.05f32, 6.3f32, 0f32) - .add_value(0.05f32, 2.67f32, 0f32) - .build(), - ), - 0f32, + SplineBuilder::new(ridges.clone(), amplifier) + .add_fixed_value(-0.05f32, 6.3f32) + .add_fixed_value(0.05f32, 2.67f32) + .build() + .into(), ) - .add_spline(-0.35f32, SplineValue::Spline(spline.clone()), 0f32) - .add_spline(-0.25f32, SplineValue::Spline(spline.clone()), 0f32) - .add_spline( + .add_spline_value(-0.35f32, spline_ref.clone()) + .add_spline_value(-0.25f32, spline_ref.clone()) + .add_spline_value( -0.1f32, - SplineValue::Spline( - SplineBuilder::new(ridges.clone(), amplifier.clone()) - .add_value(-0.05f32, 2.67, 0f32) - .add_value(0.05f32, 6.3f32, 0f32) - .build(), - ), - 0f32, + SplineBuilder::new(ridges.clone(), amplifier) + .add_fixed_value(-0.05f32, 2.67f32) + .add_fixed_value(0.05f32, 6.3f32) + .build() + .into(), ) - .add_spline(0.03f32, SplineValue::Spline(spline.clone()), 0f32); + .add_spline_value(0.03f32, spline_ref.clone()); let builder = if bl { - let spline2 = SplineBuilder::new(ridges.clone(), amplifier.clone()) - .add_value(0f32, f, 0f32) - .add_value(0.1f32, 0.625f32, 0f32) - .build(); - let spline3 = SplineBuilder::new(ridges_folded.clone(), amplifier.clone()) - .add_value(-0.9f32, f, 0f32) - .add_spline(-0.69f32, SplineValue::Spline(spline2), 0f32) + let spline2 = SplineBuilder::new(ridges.clone(), amplifier) + .add_fixed_value(0f32, f) + .add_fixed_value(0.1f32, 0.625f32) .build(); + let spline3_ref: ImmutableSplineRef = SplineBuilder::new(ridges_folded.clone(), amplifier) + .add_fixed_value(-0.9f32, f) + .add_spline_value(-0.69f32, spline2.into()) + .build() + .into(); builder - .add_value(0.35f32, f, 0f32) - .add_spline(0.45f32, SplineValue::Spline(spline3.clone()), 0f32) - .add_spline(0.55f32, SplineValue::Spline(spline3.clone()), 0f32) - .add_value(0.62f32, f, 0f32) + .add_fixed_value(0.35f32, f) + .add_spline_value(0.45f32, spline3_ref.clone()) + .add_spline_value(0.55f32, spline3_ref.clone()) + .add_fixed_value(0.62f32, f) } else { - let spline2 = SplineBuilder::new(ridges_folded.clone(), amplifier.clone()) - .add_spline(-0.7f32, SplineValue::Spline(spline.clone()), 0f32) - .add_value(-0.15f32, 1.37f32, 0f32) - .build(); + let spline2_ref: ImmutableSplineRef = SplineBuilder::new(ridges_folded.clone(), amplifier) + .add_spline_value(-0.7f32, spline_ref.clone()) + .add_fixed_value(-0.15f32, 1.37f32) + .build() + .into(); - let spline3 = SplineBuilder::new(ridges_folded.clone(), amplifier.clone()) - .add_spline(0.45f32, SplineValue::Spline(spline.clone()), 0f32) - .add_value(0.7f32, 1.56f32, 0f32) - .build(); + let spline3_ref: ImmutableSplineRef = SplineBuilder::new(ridges_folded.clone(), amplifier) + .add_spline_value(0.45f32, spline_ref.clone()) + .add_fixed_value(0.7f32, 1.56f32) + .build() + .into(); builder - .add_spline(0.05f32, SplineValue::Spline(spline3.clone()), 0f32) - .add_spline(0.4f32, SplineValue::Spline(spline3.clone()), 0f32) - .add_spline(0.45f32, SplineValue::Spline(spline2.clone()), 0f32) - .add_spline(0.55f32, SplineValue::Spline(spline2.clone()), 0f32) - .add_value(0.56f32, f, 0f32) + .add_spline_value(0.05f32, spline3_ref.clone()) + .add_spline_value(0.4f32, spline3_ref.clone()) + .add_spline_value(0.45f32, spline2_ref.clone()) + .add_spline_value(0.55f32, spline2_ref.clone()) + .add_fixed_value(0.58f32, f) }; builder.build() } -fn create_folded_ridges_spline<'a>( - ridges: Arc>, - ridges_folded: Arc>, +fn create_folded_ridges_spline( + ridges: SharedComponentReference, + ridges_folded: SharedComponentReference, f: f32, g: f32, amplifier: FloatAmplifier, -) -> Spline<'a> { +) -> ImmutableSpline { let h = peaks_valleys_noise(0.4f32); let i = peaks_valleys_noise(0.56666666f32); let j = (h + i) / 2f32; - let mut builder = SplineBuilder::new(ridges_folded, amplifier.clone()); + let builder = SplineBuilder::new(ridges_folded, amplifier); - let builder = builder.add_value(h, 0f32, 0f32); + let builder = builder.add_fixed_value(h, 0f32); let builder = if g > 0f32 { - builder.add_spline( + builder.add_spline_value( j, - SplineValue::Spline(create_ridges_part_spline( - ridges.clone(), - f, - amplifier.clone(), - )), - 0f32, + create_ridges_part_spline(ridges.clone(), g, amplifier).into(), ) } else { - builder.add_value(j, 0f32, 0f32) + builder.add_fixed_value(j, 0f32) }; let builder = if f > 0f32 { - builder.add_spline( + builder.add_spline_value( 1f32, - SplineValue::Spline(create_ridges_part_spline( - ridges.clone(), - f, - amplifier.clone(), - )), - 0f32, + create_ridges_part_spline(ridges.clone(), f, amplifier).into(), ) } else { - builder.add_value(1f32, 0f32, 0f32) + builder.add_fixed_value(1f32, 0f32) }; builder.build() @@ -226,57 +214,47 @@ fn create_folded_ridges_spline<'a>( #[inline] fn create_ridges_part_spline( - ridges: Arc, + ridges: SharedComponentReference, f: f32, amplifier: FloatAmplifier, -) -> Spline { +) -> ImmutableSpline { let g = 0.63f32 * f; let h = 0.3f32 * f; SplineBuilder::new(ridges, amplifier) - .add_value(-0.01, g, 0f32) - .add_value(0.01f32, h, 0f32) + .add_fixed_value(-0.01f32, g) + .add_fixed_value(0.01f32, h) .build() } #[allow(clippy::too_many_arguments)] #[inline] -fn create_eroded_ridges_spline<'a>( - erosion: Arc>, - ridges: Arc>, - ridges_folded: Arc>, +fn create_eroded_ridges_spline( + erosion: SharedComponentReference, + ridges: SharedComponentReference, + ridges_folded: SharedComponentReference, f: f32, g: f32, h: f32, i: f32, amplifier: FloatAmplifier, -) -> Spline<'a> { - let spline = create_folded_ridges_spline( - ridges.clone(), - ridges_folded.clone(), - f, - h, - amplifier.clone(), - ); - let spline2 = create_folded_ridges_spline( - ridges.clone(), - ridges_folded.clone(), - g, - i, - amplifier.clone(), - ); +) -> ImmutableSpline { + let spline = + create_folded_ridges_spline(ridges.clone(), ridges_folded.clone(), f, h, amplifier); + let spline2_ref: ImmutableSplineRef = + create_folded_ridges_spline(ridges.clone(), ridges_folded.clone(), g, i, amplifier).into(); SplineBuilder::new(erosion, amplifier) - .add_spline(-1f32, SplineValue::Spline(spline), 0f32) - .add_spline(-0.78, SplineValue::Spline(spline2.clone()), 0f32) - .add_spline(-0.5775f32, SplineValue::Spline(spline2), 0f32) - .add_value(-0.375f32, 0f32, 0f32) + .add_spline_value(-1f32, spline.into()) + .add_spline_value(-0.78f32, spline2_ref.clone()) + .add_spline_value(-0.5775f32, spline2_ref) + .add_fixed_value(-0.375f32, 0f32) .build() } #[allow(clippy::too_many_arguments)] -fn create_continental_offset_spline<'a>( - erosion: Arc>, - ridges: Arc>, +fn create_continental_offset_spline( + erosion: SharedComponentReference, + ridges: SharedComponentReference, continental: f32, f: f32, g: f32, @@ -286,20 +264,10 @@ fn create_continental_offset_spline<'a>( bl: bool, bl2: bool, amplifier: FloatAmplifier, -) -> Spline<'a> { - let spline = create_ridges_spline( - ridges.clone(), - lerp(h, 0.6f32, 1.5f32), - bl2, - amplifier.clone(), - ); - let spline2 = create_ridges_spline( - ridges.clone(), - lerp(h, 0.6f32, 1f32), - bl2, - amplifier.clone(), - ); - let spline3 = create_ridges_spline(ridges.clone(), h, bl2, amplifier.clone()); +) -> ImmutableSpline { + let spline = create_ridges_spline(ridges.clone(), lerp(h, 0.6f32, 1.5f32), bl2, amplifier); + let spline2 = create_ridges_spline(ridges.clone(), lerp(h, 0.6f32, 1f32), bl2, amplifier); + let spline3 = create_ridges_spline(ridges.clone(), h, bl2, amplifier); let spline4 = create_standard_spline( ridges.clone(), continental - 0.15f32, @@ -308,7 +276,7 @@ fn create_continental_offset_spline<'a>( 0.5f32 * h, 0.6f32 * h, 0.5f32, - amplifier.clone(), + amplifier, ); let spline5 = create_standard_spline( @@ -319,97 +287,75 @@ fn create_continental_offset_spline<'a>( 0.5f32 * h, 0.6f32 * h, 0.5f32, - amplifier.clone(), - ); - let spline6 = create_standard_spline( - ridges.clone(), - continental, - i, - i, - f, - g, - 0.5f32, - amplifier.clone(), - ); - let spline7 = create_standard_spline( - ridges.clone(), - continental, - i, - i, - f, - g, - 0.5f32, - amplifier.clone(), + amplifier, ); - let spline8 = SplineBuilder::new(ridges.clone(), amplifier.clone()) - .add_value(-1f32, continental, 0f32) - .add_spline(-0.4f32, SplineValue::Spline(spline6.clone()), 0f32) - .add_value(0f32, g + 0.07f32, 0f32) - .build(); - let spline9 = create_standard_spline( - ridges.clone(), - -0.02f32, - j, - j, - f, - g, - 0f32, - amplifier.clone(), - ); + let spline6_ref: ImmutableSplineRef = + create_standard_spline(ridges.clone(), continental, i, i, f, g, 0.5f32, amplifier).into(); + + let spline7_ref: ImmutableSplineRef = + create_standard_spline(ridges.clone(), continental, i, i, f, g, 0.5f32, amplifier).into(); - let mut builder = SplineBuilder::new(erosion, amplifier); + let spline8_ref: ImmutableSplineRef = SplineBuilder::new(ridges.clone(), amplifier) + .add_fixed_value(-1f32, continental) + .add_spline_value(-0.4f32, spline6_ref.clone()) + .add_fixed_value(0f32, g + 0.07f32) + .build() + .into(); + + let spline9 = create_standard_spline(ridges.clone(), -0.02f32, j, j, f, g, 0f32, amplifier); + + let builder = SplineBuilder::new(erosion, amplifier); let builder = builder - .add_spline(-0.85f32, SplineValue::Spline(spline), 0f32) - .add_spline(-0.7f32, SplineValue::Spline(spline2), 0f32) - .add_spline(-0.4f32, SplineValue::Spline(spline3), 0f32) - .add_spline(-0.35f32, SplineValue::Spline(spline4), 0f32) - .add_spline(-0.1f32, SplineValue::Spline(spline5), 0f32) - .add_spline(0.2f32, SplineValue::Spline(spline6), 0f32); + .add_spline_value(-0.85f32, spline.into()) + .add_spline_value(-0.7f32, spline2.into()) + .add_spline_value(-0.4f32, spline3.into()) + .add_spline_value(-0.35f32, spline4.into()) + .add_spline_value(-0.1f32, spline5.into()) + .add_spline_value(0.2f32, spline6_ref); let builder = if bl { builder - .add_spline(0.4f32, SplineValue::Spline(spline7.clone()), 0f32) - .add_spline(0.45f32, SplineValue::Spline(spline8.clone()), 0f32) - .add_spline(0.55f32, SplineValue::Spline(spline8), 0f32) - .add_spline(0.58f32, SplineValue::Spline(spline7), 0f32) + .add_spline_value(0.4f32, spline7_ref.clone()) + .add_spline_value(0.45f32, spline8_ref.clone()) + .add_spline_value(0.55f32, spline8_ref) + .add_spline_value(0.58f32, spline7_ref) } else { builder }; - builder - .add_spline(0.7f32, SplineValue::Spline(spline9), 0f32) - .build() + builder.add_spline_value(0.7f32, spline9.into()).build() } -pub fn create_offset_spline<'a>( - contentents: Arc>, - erosion: Arc>, - ridges: Arc>, +pub fn create_offset_spline( + contentents: SharedComponentReference, + erosion: SharedComponentReference, + ridges_folded: SharedComponentReference, amplified: bool, -) -> Spline<'a> { +) -> ImmutableSpline { let amplification = if amplified { FloatAmplifier::OffsetAmplifier } else { FloatAmplifier::Identity }; - let spline = create_continental_offset_spline( + let spline1_ref: ImmutableSplineRef = create_continental_offset_spline( erosion.clone(), - ridges.clone(), + ridges_folded.clone(), -0.15f32, 0f32, 0f32, - 0.132, + 0.1f32, 0f32, -0.03f32, false, false, - amplification.clone(), - ); + amplification, + ) + .into(); let spline2 = create_continental_offset_spline( erosion.clone(), - ridges.clone(), + ridges_folded.clone(), -0.1f32, 0.03f32, 0.1f32, @@ -418,11 +364,11 @@ pub fn create_offset_spline<'a>( -0.03f32, false, false, - amplification.clone(), + amplification, ); let spline3 = create_continental_offset_spline( erosion.clone(), - ridges.clone(), + ridges_folded.clone(), -0.1f32, 0.03f32, 0.1f32, @@ -431,11 +377,11 @@ pub fn create_offset_spline<'a>( -0.03f32, true, true, - amplification.clone(), + amplification, ); let spline4 = create_continental_offset_spline( erosion.clone(), - ridges.clone(), + ridges_folded.clone(), -0.05f32, 0.03f32, 0.1f32, @@ -444,30 +390,30 @@ pub fn create_offset_spline<'a>( 0.01f32, true, true, - amplification.clone(), + amplification, ); - SplineBuilder::new(contentents.clone(), amplification.clone()) - .add_value(-1.1f32, 0.044f32, 0f32) - .add_value(-1.02f32, -0.2222f32, 0f32) - .add_value(-0.51f32, -0.2222f32, 0f32) - .add_value(-0.44f32, -0.12f32, 0f32) - .add_value(-0.18f32, -0.12f32, 0f32) - .add_spline(-0.16f32, SplineValue::Spline(spline.clone()), 0f32) - .add_spline(-0.15f32, SplineValue::Spline(spline), 0f32) - .add_spline(-0.1f32, SplineValue::Spline(spline2), 0f32) - .add_spline(0.25f32, SplineValue::Spline(spline3), 0f32) - .add_spline(1f32, SplineValue::Spline(spline4), 0f32) + SplineBuilder::new(contentents.clone(), amplification) + .add_fixed_value(-1.1f32, 0.044f32) + .add_fixed_value(-1.02f32, -0.2222f32) + .add_fixed_value(-0.51f32, -0.2222f32) + .add_fixed_value(-0.44f32, -0.12f32) + .add_fixed_value(-0.18f32, -0.12f32) + .add_spline_value(-0.16f32, spline1_ref.clone()) + .add_spline_value(-0.15f32, spline1_ref) + .add_spline_value(-0.1f32, spline2.into()) + .add_spline_value(0.25f32, spline3.into()) + .add_spline_value(1f32, spline4.into()) .build() } -pub fn create_factor_spline<'a>( - continents: Arc>, - erosion: Arc>, - ridges: Arc>, - ridges_folded: Arc>, +pub fn create_factor_spline( + continents: SharedComponentReference, + erosion: SharedComponentReference, + ridges: SharedComponentReference, + ridges_folded: SharedComponentReference, amplified: bool, -) -> Spline<'a> { +) -> ImmutableSpline { let amplification = if amplified { FloatAmplifier::FactorAmplifier } else { @@ -475,76 +421,76 @@ pub fn create_factor_spline<'a>( }; SplineBuilder::new(continents, FloatAmplifier::Identity) - .add_value(-0.19f32, 3.95f32, 0f32) - .add_spline( + .add_fixed_value(-0.19f32, 3.95f32) + .add_spline_value( -0.15f32, - SplineValue::Spline(create_total_spline( + create_total_spline( erosion.clone(), ridges.clone(), ridges_folded.clone(), 6.25f32, true, FloatAmplifier::Identity, - )), - 0f32, + ) + .into(), ) - .add_spline( + .add_spline_value( -0.1f32, - SplineValue::Spline(create_total_spline( + create_total_spline( erosion.clone(), ridges.clone(), ridges_folded.clone(), 5.47f32, true, - amplification.clone(), - )), - 0f32, + amplification, + ) + .into(), ) - .add_spline( + .add_spline_value( 0.03f32, - SplineValue::Spline(create_total_spline( + create_total_spline( erosion.clone(), ridges.clone(), ridges_folded.clone(), 5.08f32, true, - amplification.clone(), - )), - 0f32, + amplification, + ) + .into(), ) - .add_spline( + .add_spline_value( 0.06f32, - SplineValue::Spline(create_total_spline( + create_total_spline( erosion, ridges, ridges_folded, 4.69f32, false, amplification, - )), - 0f32, + ) + .into(), ) .build() } -pub fn create_jaggedness_spline<'a>( - continents: Arc>, - erosion: Arc>, - ridges: Arc>, - ridges_folded: Arc>, +pub fn create_jaggedness_spline( + continents: SharedComponentReference, + erosion: SharedComponentReference, + ridges: SharedComponentReference, + ridges_folded: SharedComponentReference, amplified: bool, -) -> Spline<'a> { +) -> ImmutableSpline { let amplification = if amplified { FloatAmplifier::JaggednessAmplifier } else { FloatAmplifier::Identity }; - SplineBuilder::new(continents.clone(), amplification.clone()) - .add_value(-0.11f32, 0f32, 0f32) - .add_spline( + SplineBuilder::new(continents.clone(), amplification) + .add_fixed_value(-0.11f32, 0f32) + .add_spline_value( 0.03f32, - SplineValue::Spline(create_eroded_ridges_spline( + create_eroded_ridges_spline( erosion.clone(), ridges.clone(), ridges_folded.clone(), @@ -552,13 +498,13 @@ pub fn create_jaggedness_spline<'a>( 0.5f32, 0f32, 0f32, - amplification.clone(), - )), - 0f32, + amplification, + ) + .into(), ) - .add_spline( + .add_spline_value( 0.65f32, - SplineValue::Spline(create_eroded_ridges_spline( + create_eroded_ridges_spline( erosion, ridges, ridges_folded, @@ -567,87 +513,16917 @@ pub fn create_jaggedness_spline<'a>( 1f32, 0f32, amplification, - )), - 0f32, + ) + .into(), ) .build() } #[cfg(test)] mod test { - use crate::world_gen::noise::{ - density::{ - spline::FloatAmplifier, terrain_helpers::create_offset_spline, BuiltInNoiseFunctions, - NoisePos, UnblendedNoisePos, + use pumpkin_core::random::{legacy_rand::LegacyRand, RandomDeriver, RandomImpl}; + + use crate::world_gen::noise::density::{ + built_in_density_function::{ + CONTINENTS_OVERWORLD, EROSION_OVERWORLD, RIDGES_FOLDED_OVERWORLD, RIDGES_OVERWORLD, }, - BuiltInNoiseParams, + component_functions::{ComponentReference, NoEnvironment, SharedComponentReference}, + spline::{FloatAmplifier, ImmutableSplineRef, SplineFunction}, + terrain_helpers::{ + create_continental_offset_spline, create_eroded_ridges_spline, + create_folded_ridges_spline, create_standard_spline, get_offset_value, skew_map, + }, + test::{FakeEnvironment, OwnedConverter, TestConverter}, + NoisePos, UnblendedNoisePos, }; - use super::create_continental_offset_spline; + use super::{ + create_offset_spline, create_ridges_part_spline, create_ridges_spline, create_total_spline, + }; #[test] - fn test_offset_correctness() { - let noise_params = BuiltInNoiseParams::new(); - let noise_functions = BuiltInNoiseFunctions::new(&noise_params); - - let pos = NoisePos::Unblended(UnblendedNoisePos { x: 0, y: 0, z: 0 }); + fn test_offset_value() { + let values = [ + ((-0.5f32, -1.0f32, -0.5f32), 0.0f32), + ((-0.5f32, -1.0f32, -0.4f32), -0.2222f32), + ((-0.5f32, -1.0f32, -0.3f32), -0.2222f32), + ((-0.5f32, -1.0f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -1.0f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -1.0f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.9f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.9f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.9f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.9f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.9f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.9f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.79999995f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.79999995f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.79999995f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.79999995f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.79999995f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.6999999f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.6999999f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.6999999f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.6999999f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.6999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.5999999f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.5999999f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.5999999f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.5999999f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.5999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.4999999f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.4999999f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.4999999f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.4999999f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.4999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.39999992f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.39999992f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.39999992f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.39999992f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.39999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.29999992f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.29999992f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.29999992f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.29999992f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.29999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.19999993f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.19999993f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.19999993f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.19999993f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.19999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-0.5f32, -0.09999993f32, -0.4f32), -0.2222f32), + ((-0.5f32, -0.09999993f32, -0.3f32), -0.2222f32), + ((-0.5f32, -0.09999993f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, -0.09999993f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, -0.09999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-0.5f32, 7.4505806E-8f32, -0.4f32), -0.2222f32), + ((-0.5f32, 7.4505806E-8f32, -0.3f32), -0.2222f32), + ((-0.5f32, 7.4505806E-8f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, 7.4505806E-8f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, 7.4505806E-8f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-0.5f32, 0.100000076f32, -0.4f32), -0.2222f32), + ((-0.5f32, 0.100000076f32, -0.3f32), -0.2222f32), + ((-0.5f32, 0.100000076f32, -0.20000002f32), -0.2222f32), + ((-0.5f32, 0.100000076f32, -0.10000002f32), -0.2222f32), + ((-0.5f32, 0.100000076f32, -1.4901161E-8f32), -0.2222f32), + ((-0.5f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-0.5f32, 0.20000008f32, -0.4f32), -0.21474653f32), + ((-0.5f32, 0.20000008f32, -0.3f32), -0.21474653f32), + ((-0.5f32, 0.20000008f32, -0.20000002f32), -0.21474653f32), + ((-0.5f32, 0.20000008f32, -0.10000002f32), -0.21474653f32), + ((-0.5f32, 0.20000008f32, -1.4901161E-8f32), -0.21474653f32), + ((-0.5f32, 0.30000007f32, -0.5f32), 0.0f32), + ((-0.5f32, 0.30000007f32, -0.4f32), -0.14930873f32), + ((-0.5f32, 0.30000007f32, -0.3f32), -0.14930873f32), + ((-0.5f32, 0.30000007f32, -0.20000002f32), -0.14930873f32), + ((-0.5f32, 0.30000007f32, -0.10000002f32), -0.14930873f32), + ((-0.5f32, 0.30000007f32, -1.4901161E-8f32), -0.14930873f32), + ((-0.5f32, 0.40000007f32, -0.5f32), 0.0f32), + ((-0.5f32, 0.40000007f32, -0.4f32), -0.08387093f32), + ((-0.5f32, 0.40000007f32, -0.3f32), -0.08387093f32), + ((-0.5f32, 0.40000007f32, -0.20000002f32), -0.08387093f32), + ((-0.5f32, 0.40000007f32, -0.10000002f32), -0.08387093f32), + ((-0.5f32, 0.40000007f32, -1.4901161E-8f32), -0.08387093f32), + ((-0.5f32, 0.50000006f32, -0.5f32), 0.0f32), + ((-0.5f32, 0.50000006f32, -0.4f32), -0.018433183f32), + ((-0.5f32, 0.50000006f32, -0.3f32), -0.018433183f32), + ((-0.5f32, 0.50000006f32, -0.20000002f32), -0.018433183f32), + ((-0.5f32, 0.50000006f32, -0.10000002f32), -0.018433183f32), + ((-0.5f32, 0.50000006f32, -1.4901161E-8f32), -0.018433183f32), + ((-0.5f32, 0.6000001f32, -0.5f32), 0.04700464f32), + ((-0.5f32, 0.6000001f32, -0.4f32), 0.04700464f32), + ((-0.5f32, 0.6000001f32, -0.3f32), 0.04700464f32), + ((-0.5f32, 0.6000001f32, -0.20000002f32), 0.04700464f32), + ((-0.5f32, 0.6000001f32, -0.10000002f32), 0.04700464f32), + ((-0.5f32, 0.6000001f32, -1.4901161E-8f32), 0.04700464f32), + ((-0.5f32, 0.7000001f32, -0.5f32), 0.112442434f32), + ((-0.5f32, 0.7000001f32, -0.4f32), 0.112442434f32), + ((-0.5f32, 0.7000001f32, -0.3f32), 0.112442434f32), + ((-0.5f32, 0.7000001f32, -0.20000002f32), 0.112442434f32), + ((-0.5f32, 0.7000001f32, -0.10000002f32), 0.112442434f32), + ((-0.5f32, 0.7000001f32, -1.4901161E-8f32), 0.112442434f32), + ((-0.5f32, 0.80000013f32, -0.5f32), 0.17788026f32), + ((-0.5f32, 0.80000013f32, -0.4f32), 0.17788026f32), + ((-0.5f32, 0.80000013f32, -0.3f32), 0.17788026f32), + ((-0.5f32, 0.80000013f32, -0.20000002f32), 0.17788026f32), + ((-0.5f32, 0.80000013f32, -0.10000002f32), 0.17788026f32), + ((-0.5f32, 0.80000013f32, -1.4901161E-8f32), 0.17788026f32), + ((-0.5f32, 0.90000015f32, -0.5f32), 0.24331802f32), + ((-0.5f32, 0.90000015f32, -0.4f32), 0.24331802f32), + ((-0.5f32, 0.90000015f32, -0.3f32), 0.24331802f32), + ((-0.5f32, 0.90000015f32, -0.20000002f32), 0.24331802f32), + ((-0.5f32, 0.90000015f32, -0.10000002f32), 0.24331802f32), + ((-0.5f32, 0.90000015f32, -1.4901161E-8f32), 0.24331802f32), + ((-0.5f32, 1.0000001f32, -0.5f32), 0.3087558f32), + ((-0.5f32, 1.0000001f32, -0.4f32), 0.3087558f32), + ((-0.5f32, 1.0000001f32, -0.3f32), 0.3087558f32), + ((-0.5f32, 1.0000001f32, -0.20000002f32), 0.3087558f32), + ((-0.5f32, 1.0000001f32, -0.10000002f32), 0.3087558f32), + ((-0.5f32, 1.0000001f32, -1.4901161E-8f32), 0.3087558f32), + ((-0.4f32, -1.0f32, -0.5f32), 0.0f32), + ((-0.4f32, -1.0f32, -0.4f32), 0.0f32), + ((-0.4f32, -1.0f32, -0.3f32), -0.2222f32), + ((-0.4f32, -1.0f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -1.0f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -1.0f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.9f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.9f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.9f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.9f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.9f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.9f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.79999995f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.79999995f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.79999995f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.79999995f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.79999995f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.6999999f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.6999999f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.6999999f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.6999999f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.6999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.5999999f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.5999999f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.5999999f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.5999999f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.5999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.4999999f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.4999999f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.4999999f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.4999999f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.4999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.39999992f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.39999992f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.39999992f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.39999992f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.39999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.29999992f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.29999992f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.29999992f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.29999992f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.29999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.19999993f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.19999993f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.19999993f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.19999993f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.19999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-0.4f32, -0.09999993f32, -0.4f32), 0.0f32), + ((-0.4f32, -0.09999993f32, -0.3f32), -0.2222f32), + ((-0.4f32, -0.09999993f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, -0.09999993f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, -0.09999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-0.4f32, 7.4505806E-8f32, -0.4f32), 0.0f32), + ((-0.4f32, 7.4505806E-8f32, -0.3f32), -0.2222f32), + ((-0.4f32, 7.4505806E-8f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, 7.4505806E-8f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, 7.4505806E-8f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-0.4f32, 0.100000076f32, -0.4f32), 0.0f32), + ((-0.4f32, 0.100000076f32, -0.3f32), -0.2222f32), + ((-0.4f32, 0.100000076f32, -0.20000002f32), -0.2222f32), + ((-0.4f32, 0.100000076f32, -0.10000002f32), -0.2222f32), + ((-0.4f32, 0.100000076f32, -1.4901161E-8f32), -0.2222f32), + ((-0.4f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-0.4f32, 0.20000008f32, -0.4f32), 0.0f32), + ((-0.4f32, 0.20000008f32, -0.3f32), -0.18709676f32), + ((-0.4f32, 0.20000008f32, -0.20000002f32), -0.18709676f32), + ((-0.4f32, 0.20000008f32, -0.10000002f32), -0.18709676f32), + ((-0.4f32, 0.20000008f32, -1.4901161E-8f32), -0.18709676f32), + ((-0.4f32, 0.30000007f32, -0.5f32), 0.0f32), + ((-0.4f32, 0.30000007f32, -0.4f32), 0.0f32), + ((-0.4f32, 0.30000007f32, -0.3f32), -0.119354814f32), + ((-0.4f32, 0.30000007f32, -0.20000002f32), -0.119354814f32), + ((-0.4f32, 0.30000007f32, -0.10000002f32), -0.119354814f32), + ((-0.4f32, 0.30000007f32, -1.4901161E-8f32), -0.119354814f32), + ((-0.4f32, 0.40000007f32, -0.5f32), 0.0f32), + ((-0.4f32, 0.40000007f32, -0.4f32), 0.0f32), + ((-0.4f32, 0.40000007f32, -0.3f32), -0.05161287f32), + ((-0.4f32, 0.40000007f32, -0.20000002f32), -0.05161287f32), + ((-0.4f32, 0.40000007f32, -0.10000002f32), -0.05161287f32), + ((-0.4f32, 0.40000007f32, -1.4901161E-8f32), -0.05161287f32), + ((-0.4f32, 0.50000006f32, -0.5f32), 0.016129047f32), + ((-0.4f32, 0.50000006f32, -0.4f32), 0.016129047f32), + ((-0.4f32, 0.50000006f32, -0.3f32), 0.016129047f32), + ((-0.4f32, 0.50000006f32, -0.20000002f32), 0.016129047f32), + ((-0.4f32, 0.50000006f32, -0.10000002f32), 0.016129047f32), + ((-0.4f32, 0.50000006f32, -1.4901161E-8f32), 0.016129047f32), + ((-0.4f32, 0.6000001f32, -0.5f32), 0.08387101f32), + ((-0.4f32, 0.6000001f32, -0.4f32), 0.08387101f32), + ((-0.4f32, 0.6000001f32, -0.3f32), 0.08387101f32), + ((-0.4f32, 0.6000001f32, -0.20000002f32), 0.08387101f32), + ((-0.4f32, 0.6000001f32, -0.10000002f32), 0.08387101f32), + ((-0.4f32, 0.6000001f32, -1.4901161E-8f32), 0.08387101f32), + ((-0.4f32, 0.7000001f32, -0.5f32), 0.15161294f32), + ((-0.4f32, 0.7000001f32, -0.4f32), 0.15161294f32), + ((-0.4f32, 0.7000001f32, -0.3f32), 0.15161294f32), + ((-0.4f32, 0.7000001f32, -0.20000002f32), 0.15161294f32), + ((-0.4f32, 0.7000001f32, -0.10000002f32), 0.15161294f32), + ((-0.4f32, 0.7000001f32, -1.4901161E-8f32), 0.15161294f32), + ((-0.4f32, 0.80000013f32, -0.5f32), 0.2193549f32), + ((-0.4f32, 0.80000013f32, -0.4f32), 0.2193549f32), + ((-0.4f32, 0.80000013f32, -0.3f32), 0.2193549f32), + ((-0.4f32, 0.80000013f32, -0.20000002f32), 0.2193549f32), + ((-0.4f32, 0.80000013f32, -0.10000002f32), 0.2193549f32), + ((-0.4f32, 0.80000013f32, -1.4901161E-8f32), 0.2193549f32), + ((-0.4f32, 0.90000015f32, -0.5f32), 0.28709683f32), + ((-0.4f32, 0.90000015f32, -0.4f32), 0.28709683f32), + ((-0.4f32, 0.90000015f32, -0.3f32), 0.28709683f32), + ((-0.4f32, 0.90000015f32, -0.20000002f32), 0.28709683f32), + ((-0.4f32, 0.90000015f32, -0.10000002f32), 0.28709683f32), + ((-0.4f32, 0.90000015f32, -1.4901161E-8f32), 0.28709683f32), + ((-0.4f32, 1.0000001f32, -0.5f32), 0.35483873f32), + ((-0.4f32, 1.0000001f32, -0.4f32), 0.35483873f32), + ((-0.4f32, 1.0000001f32, -0.3f32), 0.35483873f32), + ((-0.4f32, 1.0000001f32, -0.20000002f32), 0.35483873f32), + ((-0.4f32, 1.0000001f32, -0.10000002f32), 0.35483873f32), + ((-0.4f32, 1.0000001f32, -1.4901161E-8f32), 0.35483873f32), + ((-0.3f32, -1.0f32, -0.5f32), 0.0f32), + ((-0.3f32, -1.0f32, -0.4f32), 0.0f32), + ((-0.3f32, -1.0f32, -0.3f32), 0.0f32), + ((-0.3f32, -1.0f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -1.0f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -1.0f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.9f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.9f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.9f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.9f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.9f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.9f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.79999995f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.79999995f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.79999995f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.79999995f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.79999995f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.6999999f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.6999999f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.6999999f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.6999999f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.6999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.5999999f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.5999999f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.5999999f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.5999999f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.5999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.4999999f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.4999999f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.4999999f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.4999999f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.4999999f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.39999992f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.39999992f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.39999992f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.39999992f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.39999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.29999992f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.29999992f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.29999992f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.29999992f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.29999992f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.19999993f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.19999993f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.19999993f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.19999993f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.19999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-0.3f32, -0.09999993f32, -0.4f32), 0.0f32), + ((-0.3f32, -0.09999993f32, -0.3f32), 0.0f32), + ((-0.3f32, -0.09999993f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, -0.09999993f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, -0.09999993f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-0.3f32, 7.4505806E-8f32, -0.4f32), 0.0f32), + ((-0.3f32, 7.4505806E-8f32, -0.3f32), 0.0f32), + ((-0.3f32, 7.4505806E-8f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, 7.4505806E-8f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, 7.4505806E-8f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-0.3f32, 0.100000076f32, -0.4f32), 0.0f32), + ((-0.3f32, 0.100000076f32, -0.3f32), 0.0f32), + ((-0.3f32, 0.100000076f32, -0.20000002f32), -0.2222f32), + ((-0.3f32, 0.100000076f32, -0.10000002f32), -0.2222f32), + ((-0.3f32, 0.100000076f32, -1.4901161E-8f32), -0.2222f32), + ((-0.3f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-0.3f32, 0.20000008f32, -0.4f32), 0.0f32), + ((-0.3f32, 0.20000008f32, -0.3f32), 0.0f32), + ((-0.3f32, 0.20000008f32, -0.20000002f32), -0.159447f32), + ((-0.3f32, 0.20000008f32, -0.10000002f32), -0.159447f32), + ((-0.3f32, 0.20000008f32, -1.4901161E-8f32), -0.159447f32), + ((-0.3f32, 0.30000007f32, -0.5f32), 0.0f32), + ((-0.3f32, 0.30000007f32, -0.4f32), 0.0f32), + ((-0.3f32, 0.30000007f32, -0.3f32), 0.0f32), + ((-0.3f32, 0.30000007f32, -0.20000002f32), -0.08940089f32), + ((-0.3f32, 0.30000007f32, -0.10000002f32), -0.08940089f32), + ((-0.3f32, 0.30000007f32, -1.4901161E-8f32), -0.08940089f32), + ((-0.3f32, 0.40000007f32, -0.5f32), 0.0f32), + ((-0.3f32, 0.40000007f32, -0.4f32), 0.0f32), + ((-0.3f32, 0.40000007f32, -0.3f32), 0.0f32), + ((-0.3f32, 0.40000007f32, -0.20000002f32), -0.01935479f32), + ((-0.3f32, 0.40000007f32, -0.10000002f32), -0.01935479f32), + ((-0.3f32, 0.40000007f32, -1.4901161E-8f32), -0.01935479f32), + ((-0.3f32, 0.50000006f32, -0.5f32), 0.050691247f32), + ((-0.3f32, 0.50000006f32, -0.4f32), 0.050691247f32), + ((-0.3f32, 0.50000006f32, -0.3f32), 0.050691247f32), + ((-0.3f32, 0.50000006f32, -0.20000002f32), 0.050691247f32), + ((-0.3f32, 0.50000006f32, -0.10000002f32), 0.050691247f32), + ((-0.3f32, 0.50000006f32, -1.4901161E-8f32), 0.050691247f32), + ((-0.3f32, 0.6000001f32, -0.5f32), 0.120737374f32), + ((-0.3f32, 0.6000001f32, -0.4f32), 0.120737374f32), + ((-0.3f32, 0.6000001f32, -0.3f32), 0.120737374f32), + ((-0.3f32, 0.6000001f32, -0.20000002f32), 0.120737374f32), + ((-0.3f32, 0.6000001f32, -0.10000002f32), 0.120737374f32), + ((-0.3f32, 0.6000001f32, -1.4901161E-8f32), 0.120737374f32), + ((-0.3f32, 0.7000001f32, -0.5f32), 0.19078344f32), + ((-0.3f32, 0.7000001f32, -0.4f32), 0.19078344f32), + ((-0.3f32, 0.7000001f32, -0.3f32), 0.19078344f32), + ((-0.3f32, 0.7000001f32, -0.20000002f32), 0.19078344f32), + ((-0.3f32, 0.7000001f32, -0.10000002f32), 0.19078344f32), + ((-0.3f32, 0.7000001f32, -1.4901161E-8f32), 0.19078344f32), + ((-0.3f32, 0.80000013f32, -0.5f32), 0.26082957f32), + ((-0.3f32, 0.80000013f32, -0.4f32), 0.26082957f32), + ((-0.3f32, 0.80000013f32, -0.3f32), 0.26082957f32), + ((-0.3f32, 0.80000013f32, -0.20000002f32), 0.26082957f32), + ((-0.3f32, 0.80000013f32, -0.10000002f32), 0.26082957f32), + ((-0.3f32, 0.80000013f32, -1.4901161E-8f32), 0.26082957f32), + ((-0.3f32, 0.90000015f32, -0.5f32), 0.33087564f32), + ((-0.3f32, 0.90000015f32, -0.4f32), 0.33087564f32), + ((-0.3f32, 0.90000015f32, -0.3f32), 0.33087564f32), + ((-0.3f32, 0.90000015f32, -0.20000002f32), 0.33087564f32), + ((-0.3f32, 0.90000015f32, -0.10000002f32), 0.33087564f32), + ((-0.3f32, 0.90000015f32, -1.4901161E-8f32), 0.33087564f32), + ((-0.3f32, 1.0000001f32, -0.5f32), 0.40092167f32), + ((-0.3f32, 1.0000001f32, -0.4f32), 0.40092167f32), + ((-0.3f32, 1.0000001f32, -0.3f32), 0.40092167f32), + ((-0.3f32, 1.0000001f32, -0.20000002f32), 0.40092167f32), + ((-0.3f32, 1.0000001f32, -0.10000002f32), 0.40092167f32), + ((-0.3f32, 1.0000001f32, -1.4901161E-8f32), 0.40092167f32), + ((-0.20000002f32, -1.0f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -1.0f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -1.0f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -1.0f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -1.0f32, -0.10000002f32), -0.2222f32), + ((-0.20000002f32, -1.0f32, -1.4901161E-8f32), -0.2222f32), + ((-0.20000002f32, -0.9f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.9f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.9f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.9f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.9f32, -0.10000002f32), -0.2222f32), + ((-0.20000002f32, -0.9f32, -1.4901161E-8f32), -0.2222f32), + ((-0.20000002f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.79999995f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.79999995f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.79999995f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.79999995f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.79999995f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.6999999f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.6999999f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.6999999f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.6999999f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.6999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.5999999f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.5999999f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.5999999f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.5999999f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.5999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.4999999f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.4999999f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.4999999f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.4999999f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.4999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.39999992f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.39999992f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.39999992f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.39999992f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.39999992f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.29999992f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.29999992f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.29999992f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.29999992f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.29999992f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.19999993f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.19999993f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.19999993f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.19999993f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.19999993f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-0.20000002f32, -0.09999993f32, -0.4f32), 0.0f32), + ((-0.20000002f32, -0.09999993f32, -0.3f32), 0.0f32), + ((-0.20000002f32, -0.09999993f32, -0.20000002f32), 0.0f32), + ((-0.20000002f32, -0.09999993f32, -0.10000002f32), -0.2222f32), + ( + (-0.20000002f32, -0.09999993f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-0.20000002f32, 7.4505806E-8f32, -0.4f32), 0.0f32), + ((-0.20000002f32, 7.4505806E-8f32, -0.3f32), 0.0f32), + ((-0.20000002f32, 7.4505806E-8f32, -0.20000002f32), 0.0f32), + ( + (-0.20000002f32, 7.4505806E-8f32, -0.10000002f32), + -0.2222f32, + ), + ( + (-0.20000002f32, 7.4505806E-8f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.20000002f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-0.20000002f32, 0.100000076f32, -0.4f32), 0.0f32), + ((-0.20000002f32, 0.100000076f32, -0.3f32), 0.0f32), + ((-0.20000002f32, 0.100000076f32, -0.20000002f32), 0.0f32), + ( + (-0.20000002f32, 0.100000076f32, -0.10000002f32), + -0.20414744f32, + ), + ( + (-0.20000002f32, 0.100000076f32, -1.4901161E-8f32), + -0.20414744f32, + ), + ((-0.20000002f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-0.20000002f32, 0.20000008f32, -0.4f32), 0.0f32), + ((-0.20000002f32, 0.20000008f32, -0.3f32), 0.0f32), + ((-0.20000002f32, 0.20000008f32, -0.20000002f32), 0.0f32), + ( + (-0.20000002f32, 0.20000008f32, -0.10000002f32), + -0.13179725f32, + ), + ( + (-0.20000002f32, 0.20000008f32, -1.4901161E-8f32), + -0.13179725f32, + ), + ((-0.20000002f32, 0.30000007f32, -0.5f32), 0.0f32), + ((-0.20000002f32, 0.30000007f32, -0.4f32), 0.0f32), + ((-0.20000002f32, 0.30000007f32, -0.3f32), 0.0f32), + ((-0.20000002f32, 0.30000007f32, -0.20000002f32), 0.0f32), + ( + (-0.20000002f32, 0.30000007f32, -0.10000002f32), + -0.05944702f32, + ), + ( + (-0.20000002f32, 0.30000007f32, -1.4901161E-8f32), + -0.05944702f32, + ), + ((-0.20000002f32, 0.40000007f32, -0.5f32), 0.012903243f32), + ((-0.20000002f32, 0.40000007f32, -0.4f32), 0.012903243f32), + ((-0.20000002f32, 0.40000007f32, -0.3f32), 0.012903243f32), + ( + (-0.20000002f32, 0.40000007f32, -0.20000002f32), + 0.012903243f32, + ), + ( + (-0.20000002f32, 0.40000007f32, -0.10000002f32), + 0.012903243f32, + ), + ( + (-0.20000002f32, 0.40000007f32, -1.4901161E-8f32), + 0.012903243f32, + ), + ((-0.20000002f32, 0.50000006f32, -0.5f32), 0.08525342f32), + ((-0.20000002f32, 0.50000006f32, -0.4f32), 0.08525342f32), + ((-0.20000002f32, 0.50000006f32, -0.3f32), 0.08525342f32), + ( + (-0.20000002f32, 0.50000006f32, -0.20000002f32), + 0.08525342f32, + ), + ( + (-0.20000002f32, 0.50000006f32, -0.10000002f32), + 0.08525342f32, + ), + ( + (-0.20000002f32, 0.50000006f32, -1.4901161E-8f32), + 0.08525342f32, + ), + ((-0.20000002f32, 0.6000001f32, -0.5f32), 0.15760368f32), + ((-0.20000002f32, 0.6000001f32, -0.4f32), 0.15760368f32), + ((-0.20000002f32, 0.6000001f32, -0.3f32), 0.15760368f32), + ( + (-0.20000002f32, 0.6000001f32, -0.20000002f32), + 0.15760368f32, + ), + ( + (-0.20000002f32, 0.6000001f32, -0.10000002f32), + 0.15760368f32, + ), + ( + (-0.20000002f32, 0.6000001f32, -1.4901161E-8f32), + 0.15760368f32, + ), + ((-0.20000002f32, 0.7000001f32, -0.5f32), 0.22995391f32), + ((-0.20000002f32, 0.7000001f32, -0.4f32), 0.22995391f32), + ((-0.20000002f32, 0.7000001f32, -0.3f32), 0.22995391f32), + ( + (-0.20000002f32, 0.7000001f32, -0.20000002f32), + 0.22995391f32, + ), + ( + (-0.20000002f32, 0.7000001f32, -0.10000002f32), + 0.22995391f32, + ), + ( + (-0.20000002f32, 0.7000001f32, -1.4901161E-8f32), + 0.22995391f32, + ), + ((-0.20000002f32, 0.80000013f32, -0.5f32), 0.30230418f32), + ((-0.20000002f32, 0.80000013f32, -0.4f32), 0.30230418f32), + ((-0.20000002f32, 0.80000013f32, -0.3f32), 0.30230418f32), + ( + (-0.20000002f32, 0.80000013f32, -0.20000002f32), + 0.30230418f32, + ), + ( + (-0.20000002f32, 0.80000013f32, -0.10000002f32), + 0.30230418f32, + ), + ( + (-0.20000002f32, 0.80000013f32, -1.4901161E-8f32), + 0.30230418f32, + ), + ((-0.20000002f32, 0.90000015f32, -0.5f32), 0.3746544f32), + ((-0.20000002f32, 0.90000015f32, -0.4f32), 0.3746544f32), + ((-0.20000002f32, 0.90000015f32, -0.3f32), 0.3746544f32), + ( + (-0.20000002f32, 0.90000015f32, -0.20000002f32), + 0.3746544f32, + ), + ( + (-0.20000002f32, 0.90000015f32, -0.10000002f32), + 0.3746544f32, + ), + ( + (-0.20000002f32, 0.90000015f32, -1.4901161E-8f32), + 0.3746544f32, + ), + ((-0.20000002f32, 1.0000001f32, -0.5f32), 0.4470046f32), + ((-0.20000002f32, 1.0000001f32, -0.4f32), 0.4470046f32), + ((-0.20000002f32, 1.0000001f32, -0.3f32), 0.4470046f32), + ((-0.20000002f32, 1.0000001f32, -0.20000002f32), 0.4470046f32), + ((-0.20000002f32, 1.0000001f32, -0.10000002f32), 0.4470046f32), + ( + (-0.20000002f32, 1.0000001f32, -1.4901161E-8f32), + 0.4470046f32, + ), + ((-0.10000002f32, -1.0f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -1.0f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -1.0f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -1.0f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -1.0f32, -0.10000002f32), 0.0f32), + ((-0.10000002f32, -1.0f32, -1.4901161E-8f32), -0.2222f32), + ((-0.10000002f32, -0.9f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.9f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.9f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.9f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.9f32, -0.10000002f32), 0.0f32), + ((-0.10000002f32, -0.9f32, -1.4901161E-8f32), -0.2222f32), + ((-0.10000002f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.79999995f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.79999995f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.79999995f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.79999995f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.79999995f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.6999999f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.6999999f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.6999999f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.6999999f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.6999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.5999999f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.5999999f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.5999999f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.5999999f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.5999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.4999999f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.4999999f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.4999999f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.4999999f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.4999999f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.39999992f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.39999992f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.39999992f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.39999992f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.39999992f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.29999992f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.29999992f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.29999992f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.29999992f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.29999992f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.19999993f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.19999993f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.19999993f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.19999993f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.19999993f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-0.10000002f32, -0.09999993f32, -0.4f32), 0.0f32), + ((-0.10000002f32, -0.09999993f32, -0.3f32), 0.0f32), + ((-0.10000002f32, -0.09999993f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, -0.09999993f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, -0.09999993f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-0.10000002f32, 7.4505806E-8f32, -0.4f32), 0.0f32), + ((-0.10000002f32, 7.4505806E-8f32, -0.3f32), 0.0f32), + ((-0.10000002f32, 7.4505806E-8f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, 7.4505806E-8f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, 7.4505806E-8f32, -1.4901161E-8f32), + -0.2222f32, + ), + ((-0.10000002f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-0.10000002f32, 0.100000076f32, -0.4f32), 0.0f32), + ((-0.10000002f32, 0.100000076f32, -0.3f32), 0.0f32), + ((-0.10000002f32, 0.100000076f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, 0.100000076f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, 0.100000076f32, -1.4901161E-8f32), + -0.1788018f32, + ), + ((-0.10000002f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-0.10000002f32, 0.20000008f32, -0.4f32), 0.0f32), + ((-0.10000002f32, 0.20000008f32, -0.3f32), 0.0f32), + ((-0.10000002f32, 0.20000008f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, 0.20000008f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, 0.20000008f32, -1.4901161E-8f32), + -0.104147464f32, + ), + ((-0.10000002f32, 0.30000007f32, -0.5f32), 0.0f32), + ((-0.10000002f32, 0.30000007f32, -0.4f32), 0.0f32), + ((-0.10000002f32, 0.30000007f32, -0.3f32), 0.0f32), + ((-0.10000002f32, 0.30000007f32, -0.20000002f32), 0.0f32), + ((-0.10000002f32, 0.30000007f32, -0.10000002f32), 0.0f32), + ( + (-0.10000002f32, 0.30000007f32, -1.4901161E-8f32), + -0.029493064f32, + ), + ((-0.10000002f32, 0.40000007f32, -0.5f32), 0.045161307f32), + ((-0.10000002f32, 0.40000007f32, -0.4f32), 0.045161307f32), + ((-0.10000002f32, 0.40000007f32, -0.3f32), 0.045161307f32), + ( + (-0.10000002f32, 0.40000007f32, -0.20000002f32), + 0.045161307f32, + ), + ( + (-0.10000002f32, 0.40000007f32, -0.10000002f32), + 0.045161307f32, + ), + ( + (-0.10000002f32, 0.40000007f32, -1.4901161E-8f32), + 0.045161307f32, + ), + ((-0.10000002f32, 0.50000006f32, -0.5f32), 0.11981565f32), + ((-0.10000002f32, 0.50000006f32, -0.4f32), 0.11981565f32), + ((-0.10000002f32, 0.50000006f32, -0.3f32), 0.11981565f32), + ( + (-0.10000002f32, 0.50000006f32, -0.20000002f32), + 0.11981565f32, + ), + ( + (-0.10000002f32, 0.50000006f32, -0.10000002f32), + 0.11981565f32, + ), + ( + (-0.10000002f32, 0.50000006f32, -1.4901161E-8f32), + 0.11981565f32, + ), + ((-0.10000002f32, 0.6000001f32, -0.5f32), 0.19447008f32), + ((-0.10000002f32, 0.6000001f32, -0.4f32), 0.19447008f32), + ((-0.10000002f32, 0.6000001f32, -0.3f32), 0.19447008f32), + ( + (-0.10000002f32, 0.6000001f32, -0.20000002f32), + 0.19447008f32, + ), + ( + (-0.10000002f32, 0.6000001f32, -0.10000002f32), + 0.19447008f32, + ), + ( + (-0.10000002f32, 0.6000001f32, -1.4901161E-8f32), + 0.19447008f32, + ), + ((-0.10000002f32, 0.7000001f32, -0.5f32), 0.26912445f32), + ((-0.10000002f32, 0.7000001f32, -0.4f32), 0.26912445f32), + ((-0.10000002f32, 0.7000001f32, -0.3f32), 0.26912445f32), + ( + (-0.10000002f32, 0.7000001f32, -0.20000002f32), + 0.26912445f32, + ), + ( + (-0.10000002f32, 0.7000001f32, -0.10000002f32), + 0.26912445f32, + ), + ( + (-0.10000002f32, 0.7000001f32, -1.4901161E-8f32), + 0.26912445f32, + ), + ((-0.10000002f32, 0.80000013f32, -0.5f32), 0.34377885f32), + ((-0.10000002f32, 0.80000013f32, -0.4f32), 0.34377885f32), + ((-0.10000002f32, 0.80000013f32, -0.3f32), 0.34377885f32), + ( + (-0.10000002f32, 0.80000013f32, -0.20000002f32), + 0.34377885f32, + ), + ( + (-0.10000002f32, 0.80000013f32, -0.10000002f32), + 0.34377885f32, + ), + ( + (-0.10000002f32, 0.80000013f32, -1.4901161E-8f32), + 0.34377885f32, + ), + ((-0.10000002f32, 0.90000015f32, -0.5f32), 0.41843322f32), + ((-0.10000002f32, 0.90000015f32, -0.4f32), 0.41843322f32), + ((-0.10000002f32, 0.90000015f32, -0.3f32), 0.41843322f32), + ( + (-0.10000002f32, 0.90000015f32, -0.20000002f32), + 0.41843322f32, + ), + ( + (-0.10000002f32, 0.90000015f32, -0.10000002f32), + 0.41843322f32, + ), + ( + (-0.10000002f32, 0.90000015f32, -1.4901161E-8f32), + 0.41843322f32, + ), + ((-0.10000002f32, 1.0000001f32, -0.5f32), 0.49308756f32), + ((-0.10000002f32, 1.0000001f32, -0.4f32), 0.49308756f32), + ((-0.10000002f32, 1.0000001f32, -0.3f32), 0.49308756f32), + ( + (-0.10000002f32, 1.0000001f32, -0.20000002f32), + 0.49308756f32, + ), + ( + (-0.10000002f32, 1.0000001f32, -0.10000002f32), + 0.49308756f32, + ), + ( + (-0.10000002f32, 1.0000001f32, -1.4901161E-8f32), + 0.49308756f32, + ), + ((-1.4901161E-8f32, -1.0f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -1.0f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -1.0f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -1.0f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -1.0f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -1.0f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.9f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.79999995f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.6999999f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.5999999f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.4999999f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.39999992f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.29999992f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.19999993f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, -0.09999993f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, 7.4505806E-8f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, 7.4505806E-8f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, 7.4505806E-8f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, 7.4505806E-8f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, 7.4505806E-8f32, -0.10000002f32), 0.0f32), + ( + (-1.4901161E-8f32, 7.4505806E-8f32, -1.4901161E-8f32), + 0.0f32, + ), + ((-1.4901161E-8f32, 0.100000076f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, 0.100000076f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, 0.100000076f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, 0.100000076f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, 0.100000076f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, 0.100000076f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -0.5f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -0.4f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -0.3f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -0.20000002f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -0.10000002f32), 0.0f32), + ((-1.4901161E-8f32, 0.20000008f32, -1.4901161E-8f32), 0.0f32), + ((-1.4901161E-8f32, 0.30000007f32, -0.5f32), 4.608333E-4f32), + ((-1.4901161E-8f32, 0.30000007f32, -0.4f32), 4.608333E-4f32), + ((-1.4901161E-8f32, 0.30000007f32, -0.3f32), 4.608333E-4f32), + ( + (-1.4901161E-8f32, 0.30000007f32, -0.20000002f32), + 4.608333E-4f32, + ), + ( + (-1.4901161E-8f32, 0.30000007f32, -0.10000002f32), + 4.608333E-4f32, + ), + ( + (-1.4901161E-8f32, 0.30000007f32, -1.4901161E-8f32), + 4.608333E-4f32, + ), + ((-1.4901161E-8f32, 0.40000007f32, -0.5f32), 0.07741937f32), + ((-1.4901161E-8f32, 0.40000007f32, -0.4f32), 0.07741937f32), + ((-1.4901161E-8f32, 0.40000007f32, -0.3f32), 0.07741937f32), + ( + (-1.4901161E-8f32, 0.40000007f32, -0.20000002f32), + 0.07741937f32, + ), + ( + (-1.4901161E-8f32, 0.40000007f32, -0.10000002f32), + 0.07741937f32, + ), + ( + (-1.4901161E-8f32, 0.40000007f32, -1.4901161E-8f32), + 0.07741937f32, + ), + ((-1.4901161E-8f32, 0.50000006f32, -0.5f32), 0.15437785f32), + ((-1.4901161E-8f32, 0.50000006f32, -0.4f32), 0.15437785f32), + ((-1.4901161E-8f32, 0.50000006f32, -0.3f32), 0.15437785f32), + ( + (-1.4901161E-8f32, 0.50000006f32, -0.20000002f32), + 0.15437785f32, + ), + ( + (-1.4901161E-8f32, 0.50000006f32, -0.10000002f32), + 0.15437785f32, + ), + ( + (-1.4901161E-8f32, 0.50000006f32, -1.4901161E-8f32), + 0.15437785f32, + ), + ((-1.4901161E-8f32, 0.6000001f32, -0.5f32), 0.23133644f32), + ((-1.4901161E-8f32, 0.6000001f32, -0.4f32), 0.23133644f32), + ((-1.4901161E-8f32, 0.6000001f32, -0.3f32), 0.23133644f32), + ( + (-1.4901161E-8f32, 0.6000001f32, -0.20000002f32), + 0.23133644f32, + ), + ( + (-1.4901161E-8f32, 0.6000001f32, -0.10000002f32), + 0.23133644f32, + ), + ( + (-1.4901161E-8f32, 0.6000001f32, -1.4901161E-8f32), + 0.23133644f32, + ), + ((-1.4901161E-8f32, 0.7000001f32, -0.5f32), 0.30829495f32), + ((-1.4901161E-8f32, 0.7000001f32, -0.4f32), 0.30829495f32), + ((-1.4901161E-8f32, 0.7000001f32, -0.3f32), 0.30829495f32), + ( + (-1.4901161E-8f32, 0.7000001f32, -0.20000002f32), + 0.30829495f32, + ), + ( + (-1.4901161E-8f32, 0.7000001f32, -0.10000002f32), + 0.30829495f32, + ), + ( + (-1.4901161E-8f32, 0.7000001f32, -1.4901161E-8f32), + 0.30829495f32, + ), + ((-1.4901161E-8f32, 0.80000013f32, -0.5f32), 0.38525352f32), + ((-1.4901161E-8f32, 0.80000013f32, -0.4f32), 0.38525352f32), + ((-1.4901161E-8f32, 0.80000013f32, -0.3f32), 0.38525352f32), + ( + (-1.4901161E-8f32, 0.80000013f32, -0.20000002f32), + 0.38525352f32, + ), + ( + (-1.4901161E-8f32, 0.80000013f32, -0.10000002f32), + 0.38525352f32, + ), + ( + (-1.4901161E-8f32, 0.80000013f32, -1.4901161E-8f32), + 0.38525352f32, + ), + ((-1.4901161E-8f32, 0.90000015f32, -0.5f32), 0.462212f32), + ((-1.4901161E-8f32, 0.90000015f32, -0.4f32), 0.462212f32), + ((-1.4901161E-8f32, 0.90000015f32, -0.3f32), 0.462212f32), + ( + (-1.4901161E-8f32, 0.90000015f32, -0.20000002f32), + 0.462212f32, + ), + ( + (-1.4901161E-8f32, 0.90000015f32, -0.10000002f32), + 0.462212f32, + ), + ( + (-1.4901161E-8f32, 0.90000015f32, -1.4901161E-8f32), + 0.462212f32, + ), + ((-1.4901161E-8f32, 1.0000001f32, -0.5f32), 0.5391705f32), + ((-1.4901161E-8f32, 1.0000001f32, -0.4f32), 0.5391705f32), + ((-1.4901161E-8f32, 1.0000001f32, -0.3f32), 0.5391705f32), + ( + (-1.4901161E-8f32, 1.0000001f32, -0.20000002f32), + 0.5391705f32, + ), + ( + (-1.4901161E-8f32, 1.0000001f32, -0.10000002f32), + 0.5391705f32, + ), + ( + (-1.4901161E-8f32, 1.0000001f32, -1.4901161E-8f32), + 0.5391705f32, + ), + ]; - let spline = create_continental_offset_spline( - noise_functions.erosion_overworld.clone(), - noise_functions.ridges_folded_overworld.clone(), - 1f32, - 1f32, - 1f32, - 1f32, - 1f32, - 1f32, - true, - true, - FloatAmplifier::Identity, - ); + for ((x, y, z), result) in values { + assert_eq!(get_offset_value(x, y, z), result); + } + } - assert_eq!(spline.apply(&pos), 1f32); - - let pos = NoisePos::Unblended(UnblendedNoisePos { - x: 10, - y: 10, - z: 10, - }); - - let spline = create_continental_offset_spline( - noise_functions.erosion_overworld.clone(), - noise_functions.ridges_folded_overworld.clone(), - 2f32, - 2f32, - 2f32, - 2f32, - 2f32, - 2f32, - true, - true, - FloatAmplifier::Identity, - ); + #[test] + fn test_skew_map() { + let values = [ + (-1.0f32, f32::INFINITY), + (-0.9f32, 40.059994f32), + (-0.79999995f32, 18.359995f32), + (-0.6999999f32, 11.126663f32), + (-0.5999999f32, 7.5099974f32), + (-0.4999999f32, 5.3399982f32), + (-0.39999992f32, 3.8933315f32), + (-0.29999992f32, 2.8600001f32), + (-0.19999993f32, 2.0849996f32), + (-0.09999993f32, 1.482222f32), + (7.4505806E-8f32, 1.0000001f32), + (0.100000076f32, 0.6054543f32), + (0.20000008f32, 0.27666664f32), + (0.30000007f32, -0.0015385151f32), + (0.40000007f32, -0.24000007f32), + (0.50000006f32, -0.44666666f32), + (0.6000001f32, -0.6275001f32), + (0.7000001f32, -0.78705895f32), + (0.80000013f32, -0.92888904f32), + (0.90000015f32, -1.0557896f32), + (1.0000001f32, -1.1700001f32), + ]; - assert_eq!(spline.apply(&pos), 2f32); + for (value, result) in values { + assert_eq!(skew_map(value), result); + } + } - let pos = NoisePos::Unblended(UnblendedNoisePos { x: 0, y: 0, z: 0 }); + #[test] + fn test_create_ridges_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; - let spline = create_offset_spline( - noise_functions.continents_overworld.clone(), - noise_functions.erosion_overworld.clone(), - noise_functions.ridges_folded_overworld.clone(), + let values = [ + ((-100, -100), 2.8477935E-8), + ((-100, -90), 2.9421175E-8), + ((-100, -80), 2.953465E-8), + ((-100, -70), 2.9572217E-8), + ((-100, -60), 2.9592139E-8), + ((-100, -50), 2.9759779E-8), + ((-100, -40), 2.9594814E-8), + ((-100, -30), 4.1828697E-4), + ((-100, -20), 2.441617E-4), + ((-100, -10), 2.9801354E-8), + ((-100, 0), 2.9799308E-8), + ((-100, 10), 2.9755787E-8), + ((-100, 20), 2.9588357E-8), + ((-100, 30), 2.907906E-8), + ((-100, 40), 2.8314574E-8), + ((-100, 50), 2.6729724E-8), + ((-100, 60), 2.7000734E-8), + ((-100, 70), 2.660159E-8), + ((-100, 80), 2.4869763E-8), + ((-100, 90), 2.2899068E-8), + ((-100, 100), 2.014161E-8), + ((-90, -100), 2.5623542E-8), + ((-90, -90), 2.6155236E-8), + ((-90, -80), 2.7647168E-8), + ((-90, -70), 2.7973673E-8), + ((-90, -60), 2.8644253E-8), + ((-90, -50), 2.869978E-8), + ((-90, -40), 2.9231881E-8), + ((-90, -30), 2.9375043E-8), + ((-90, -20), 2.8943603E-8), + ((-90, -10), 2.9426687E-8), + ((-90, 0), 2.9260104E-8), + ((-90, 10), 2.904137E-8), + ((-90, 20), 2.7603893E-8), + ((-90, 30), 2.764989E-8), + ((-90, 40), 2.6193437E-8), + ((-90, 50), 2.4490602E-8), + ((-90, 60), 2.5621688E-8), + ((-90, 70), 2.4620386E-8), + ((-90, 80), 2.2685676E-8), + ((-90, 90), 1.9192312E-8), + ((-90, 100), 1.8943878E-8), + ((-80, -100), 2.0955286E-8), + ((-80, -90), 2.0643254E-8), + ((-80, -80), 2.3475874E-8), + ((-80, -70), 2.6119807E-8), + ((-80, -60), 2.6292632E-8), + ((-80, -50), 2.688907E-8), + ((-80, -40), 2.8145903E-8), + ((-80, -30), 2.7218043E-8), + ((-80, -20), 2.7008975E-8), + ((-80, -10), 2.7962752E-8), + ((-80, 0), 2.8498809E-8), + ((-80, 10), 2.853816E-8), + ((-80, 20), 2.7134293E-8), + ((-80, 30), 2.4145672E-8), + ((-80, 40), 2.313179E-8), + ((-80, 50), 2.0786214E-8), + ((-80, 60), 1.883024E-8), + ((-80, 70), 1.7269919E-8), + ((-80, 80), 2.0617332E-8), + ((-80, 90), 1.8206858E-8), + ((-80, 100), 1.6814932E-8), + ((-70, -100), 1.5697411E-8), + ((-70, -90), 1.881628E-8), + ((-70, -80), 2.0452672E-8), + ((-70, -70), 2.3734193E-8), + ((-70, -60), 2.4436767E-8), + ((-70, -50), 2.3752877E-8), + ((-70, -40), 2.5358732E-8), + ((-70, -30), 2.566211E-8), + ((-70, -20), 2.3430925E-8), + ((-70, -10), 2.4686809E-8), + ((-70, 0), 2.5551257E-8), + ((-70, 10), 2.5841018E-8), + ((-70, 20), 2.39439E-8), + ((-70, 30), 1.8338397E-8), + ((-70, 40), 1.9379236E-8), + ((-70, 50), 1.725146E-8), + ((-70, 60), 1.2672998E-8), + ((-70, 70), 1.441972E-8), + ((-70, 80), 1.2832E-8), + ((-70, 90), 1.4738533E-8), + ((-70, 100), 1.4453501E-8), + ((-60, -100), 1.326884E-8), + ((-60, -90), 1.4473903E-8), + ((-60, -80), 1.6339591E-8), + ((-60, -70), 1.8043991E-8), + ((-60, -60), 2.1850791E-8), + ((-60, -50), 1.952893E-8), + ((-60, -40), 2.0770532E-8), + ((-60, -30), 2.1941322E-8), + ((-60, -20), 1.8191166E-8), + ((-60, -10), 1.899582E-8), + ((-60, 0), 1.6704568E-8), + ((-60, 10), 1.703442E-8), + ((-60, 20), 1.531812E-8), + ((-60, 30), 9.570761E-9), + ((-60, 40), 1.0039969E-8), + ((-60, 50), 8.110198E-9), + ((-60, 60), 7.454145E-9), + ((-60, 70), 5.27241E-9), + ((-60, 80), 6.8627255E-9), + ((-60, 90), 9.639968E-9), + ((-60, 100), 1.0100898E-8), + ((-50, -100), 7.740988E-9), + ((-50, -90), 9.695534E-9), + ((-50, -80), 1.4176498E-8), + ((-50, -70), 1.3164881E-8), + ((-50, -60), 1.3867257E-8), + ((-50, -50), 1.3216399E-8), + ((-50, -40), 1.19279E-8), + ((-50, -30), 1.06547375E-8), + ((-50, -20), 1.26689725E-8), + ((-50, -10), 1.4371157E-8), + ((-50, 0), 8.357909E-9), + ((-50, 10), 9.041843E-9), + ((-50, 20), 2.8660507E-9), + ((-50, 30), 3.5975143E-9), + ((-50, 40), 6.1586345E-9), + ((-50, 50), 6.9691537E-9), + ((-50, 60), 4.881403E-9), + ((-50, 70), 3.2929866E-9), + ((-50, 80), -2.0132167E-4), + ((-50, 90), 2.4167723E-10), + ((-50, 100), 9.5578934E-11), + ((-40, -100), 3.96348E-9), + ((-40, -90), 4.7890127E-9), + ((-40, -80), 1.0002485E-8), + ((-40, -70), 1.09926415E-8), + ((-40, -60), 9.654244E-9), + ((-40, -50), 8.474768E-9), + ((-40, -40), 4.632465E-9), + ((-40, -30), 2.950939E-9), + ((-40, -20), 1.0483288E-9), + ((-40, -10), 5.394538E-9), + ((-40, 0), 1.8524393E-10), + ((-40, 10), 7.566242E-11), + ((-40, 20), -0.05434511), + ((-40, 30), 6.359355E-10), + ((-40, 40), 1.7443635E-9), + ((-40, 50), 1.1218677E-9), + ((-40, 60), -0.05718465), + ((-40, 70), -0.2222), + ((-40, 80), -0.2222), + ((-40, 90), -0.2222), + ((-40, 100), -0.2222), + ((-30, -100), 5.2898386E-10), + ((-30, -90), 3.0276166E-9), + ((-30, -80), 4.8754467E-9), + ((-30, -70), 5.305538E-9), + ((-30, -60), 6.3437686E-9), + ((-30, -50), 3.4709022E-9), + ((-30, -40), -0.0013300264), + ((-30, -30), -0.2222), + ((-30, -20), -0.2222), + ((-30, -10), 2.487388E-11), + ((-30, 0), -0.1278581), + ((-30, 10), -0.2222), + ((-30, 20), -0.2222), + ((-30, 30), -0.2222), + ((-30, 40), -0.2222), + ((-30, 50), -0.2222), + ((-30, 60), -0.2222), + ((-30, 70), -0.2222), + ((-30, 80), -0.13529345), + ((-30, 90), -0.21922092), + ((-30, 100), -0.2222), + ((-20, -100), -0.05537056), + ((-20, -90), 4.362144E-11), + ((-20, -80), 5.9424754E-10), + ((-20, -70), 9.598848E-10), + ((-20, -60), 1.4902506E-9), + ((-20, -50), 1.3627571E-11), + ((-20, -40), -0.2222), + ((-20, -30), -0.2222), + ((-20, -20), -0.2222), + ((-20, -10), -0.2222), + ((-20, 0), -0.2222), + ((-20, 10), -0.2222), + ((-20, 20), 1.0100046E-12), + ((-20, 30), -0.221999), + ((-20, 40), 1.2945522E-9), + ((-20, 50), 5.3399196E-9), + ((-20, 60), 5.9649015E-9), + ((-20, 70), 3.0647274E-10), + ((-20, 80), 7.8995144E-10), + ((-20, 90), 1.694016E-9), + ((-20, 100), 4.1338766E-11), + ((-10, -100), -0.2222), + ((-10, -90), -0.2222), + ((-10, -80), -0.2222), + ((-10, -70), -0.006202223), + ((-10, -60), -0.2222), + ((-10, -50), -0.2222), + ((-10, -40), -0.2222), + ((-10, -30), -0.2222), + ((-10, -20), -0.2222), + ((-10, -10), 2.724796E-10), + ((-10, 0), 1.628972E-11), + ((-10, 10), 1.215722E-9), + ((-10, 20), 1.3321679E-9), + ((-10, 30), 5.7749086E-9), + ((-10, 40), 5.468249E-9), + ((-10, 50), 1.4257979E-8), + ((-10, 60), 2.3868212E-8), + ((-10, 70), 1.6978554E-8), + ((-10, 80), 9.911973E-9), + ((-10, 90), 1.06328795E-8), + ((-10, 100), 3.8184833E-9), + ((0, -100), -0.2222), + ((0, -90), -0.2222), + ((0, -80), -0.2222), + ((0, -70), -0.2222), + ((0, -60), -0.2222), + ((0, -50), -0.2222), + ((0, -40), -2.7082162E-5), + ((0, -30), -0.21585968), + ((0, -20), -0.2222), + ((0, -10), 5.88328E-13), + ((0, 0), 2.099143E-9), + ((0, 10), 5.015324E-9), + ((0, 20), 9.049539E-9), + ((0, 30), 1.6418609E-8), + ((0, 40), 1.8904561E-8), + ((0, 50), 2.3320354E-8), + ((0, 60), 2.620363E-8), + ((0, 70), 2.0293689E-8), + ((0, 80), 2.5067742E-8), + ((0, 90), 2.0545425E-8), + ((0, 100), 1.6975857E-8), + ((10, -100), -0.2222), + ((10, -90), -0.2099127), + ((10, -80), -0.2222), + ((10, -70), -0.2222), + ((10, -60), -0.22206965), + ((10, -50), 1.2756785E-10), + ((10, -40), 2.1985875E-9), + ((10, -30), 3.7900465E-9), + ((10, -20), 4.57191E-9), + ((10, -10), 7.1460473E-9), + ((10, 0), 9.860966E-9), + ((10, 10), 1.7195873E-8), + ((10, 20), 2.149125E-8), + ((10, 30), 2.5583146E-8), + ((10, 40), 2.9350172E-8), + ((10, 50), 2.7192652E-8), + ((10, 60), 2.337591E-8), + ((10, 70), 1.7757051E-8), + ((10, 80), 2.4523862E-8), + ((10, 90), 2.421915E-8), + ((10, 100), 2.5471177E-8), + ((20, -100), -0.026743041), + ((20, -90), 3.701109E-12), + ((20, -80), 6.015668E-10), + ((20, -70), 1.757392E-10), + ((20, -60), 3.1415082E-10), + ((20, -50), 2.2531796E-9), + ((20, -40), 6.227851E-9), + ((20, -30), 1.0961541E-8), + ((20, -20), 1.344854E-8), + ((20, -10), 1.6549272E-8), + ((20, 0), 1.9368597E-8), + ((20, 10), 2.7064296E-8), + ((20, 20), 2.8985074E-8), + ((20, 30), 0.0036852886), + ((20, 40), 0.0539809), + ((20, 50), 0.0021372417), + ((20, 60), 2.6740215E-8), + ((20, 70), 2.916563E-8), + ((20, 80), 2.9167515E-8), + ((20, 90), 2.952707E-8), + ((20, 100), 2.9662866E-8), + ((30, -100), 9.415155E-10), + ((30, -90), 1.1704835E-9), + ((30, -80), 2.3105915E-9), + ((30, -70), 2.2496456E-9), + ((30, -60), 4.6038107E-9), + ((30, -50), 9.231984E-9), + ((30, -40), 1.5865178E-8), + ((30, -30), 2.090136E-8), + ((30, -20), 2.4485336E-8), + ((30, -10), 2.5506537E-8), + ((30, 0), 2.7404838E-8), + ((30, 10), 0.015096264), + ((30, 20), 0.07279182), + ((30, 30), 0.078368366), + ((30, 40), 0.09613082), + ((30, 50), 0.06028792), + ((30, 60), 0.02723657), + ((30, 70), 0.056825884), + ((30, 80), 0.048749786), + ((30, 90), 0.049322363), + ((30, 100), 0.068311006), + ((40, -100), 5.113369E-9), + ((40, -90), 5.611211E-9), + ((40, -80), 5.793919E-9), + ((40, -70), 6.3468795E-9), + ((40, -60), 1.2419873E-8), + ((40, -50), 1.8519973E-8), + ((40, -40), 2.1883215E-8), + ((40, -30), 2.7525791E-8), + ((40, -20), 2.849611E-8), + ((40, -10), 2.9346142E-8), + ((40, 0), 2.979914E-8), + ((40, 10), 0.05700566), + ((40, 20), 0.09781591), + ((40, 30), 0.07276361), + ((40, 40), 0.05831618), + ((40, 50), 0.08932926), + ((40, 60), 0.06354418), + ((40, 70), 0.08133913), + ((40, 80), 0.092552625), + ((40, 90), 0.08024895), + ((40, 100), 0.09823503), + ((50, -100), 9.931215E-9), + ((50, -90), 1.5000806E-8), + ((50, -80), 1.38834775E-8), + ((50, -70), 1.319409E-8), + ((50, -60), 1.4360927E-8), + ((50, -50), 2.262236E-8), + ((50, -40), 2.615886E-8), + ((50, -30), 2.8377613E-8), + ((50, -20), 0.0060256915), + ((50, -10), 0.02681369), + ((50, 0), 0.0625092), + ((50, 10), 0.08518137), + ((50, 20), 0.08074804), + ((50, 30), 0.056999013), + ((50, 40), 0.050000902), + ((50, 50), 0.039098933), + ((50, 60), 0.024522444), + ((50, 70), 0.039843414), + ((50, 80), 0.06813977), + ((50, 90), 0.08117486), + ((50, 100), 0.09765588), + ((60, -100), 1.2560949E-8), + ((60, -90), 1.8038051E-8), + ((60, -80), 1.7835823E-8), + ((60, -70), 1.6850986E-8), + ((60, -60), 2.0095776E-8), + ((60, -50), 2.2213623E-8), + ((60, -40), 2.4400702E-8), + ((60, -30), 2.8550161E-8), + ((60, -20), 0.0122648785), + ((60, -10), 0.057307955), + ((60, 0), 0.063739665), + ((60, 10), 0.09191626), + ((60, 20), 0.06397862), + ((60, 30), 0.029510833), + ((60, 40), 0.022276945), + ((60, 50), 0.008596192), + ((60, 60), 9.073515E-4), + ((60, 70), 0.01206646), + ((60, 80), 0.036487218), + ((60, 90), 0.060221568), + ((60, 100), 0.07330302), + ((70, -100), 1.2279612E-8), + ((70, -90), 1.5604508E-8), + ((70, -80), 1.7923854E-8), + ((70, -70), 1.9603634E-8), + ((70, -60), 2.3482578E-8), + ((70, -50), 2.5044821E-8), + ((70, -40), 2.8634219E-8), + ((70, -30), 2.9438601E-8), + ((70, -20), 0.026957614), + ((70, -10), 0.053010616), + ((70, 0), 0.08705943), + ((70, 10), 0.07123009), + ((70, 20), 0.05596709), + ((70, 30), 0.02099134), + ((70, 40), 8.0636E-4), + ((70, 50), -2.8625852E-4), + ((70, 60), -1.8850603E-4), + ((70, 70), 0.010176085), + ((70, 80), 0.021705516), + ((70, 90), 0.042132284), + ((70, 100), 0.066540554), + ((80, -100), 1.0967985E-8), + ((80, -90), 1.3114312E-8), + ((80, -80), 1.6625528E-8), + ((80, -70), 1.8970738E-8), + ((80, -60), 2.3452605E-8), + ((80, -50), 2.719583E-8), + ((80, -40), 2.8690268E-8), + ((80, -30), -3.257227E-4), + ((80, -20), 0.04783322), + ((80, -10), 0.06973693), + ((80, 0), 0.084938176), + ((80, 10), 0.051958688), + ((80, 20), 0.038630944), + ((80, 30), 0.021653533), + ((80, 40), 0.015261582), + ((80, 50), 0.016427841), + ((80, 60), 0.010141701), + ((80, 70), 0.012156198), + ((80, 80), 0.029815394), + ((80, 90), 0.058820862), + ((80, 100), 0.08758333), + ((90, -100), 1.0518976E-8), + ((90, -90), 1.1329515E-8), + ((90, -80), 1.4873088E-8), + ((90, -70), 1.5370892E-8), + ((90, -60), 1.8482575E-8), + ((90, -50), 2.4565391E-8), + ((90, -40), 2.7285648E-8), + ((90, -30), 2.9660525E-8), + ((90, -20), 0.030253895), + ((90, -10), 0.06902423), + ((90, 0), 0.07849499), + ((90, 10), 0.08036745), + ((90, 20), 0.046044968), + ((90, 30), 0.044540975), + ((90, 40), 0.040963612), + ((90, 50), 0.04599631), + ((90, 60), 0.041517425), + ((90, 70), 0.04300323), + ((90, 80), 0.04129118), + ((90, 90), 0.06918509), + ((90, 100), 0.09034656), + ((100, -100), 8.271921E-9), + ((100, -90), 1.0203889E-8), + ((100, -80), 1.1338757E-8), + ((100, -70), 1.39994265E-8), + ((100, -60), 1.6544481E-8), + ((100, -50), 1.9844514E-8), + ((100, -40), 2.1032369E-8), + ((100, -30), 2.530143E-8), + ((100, -20), 2.9269913E-8), + ((100, -10), 2.9794156E-8), + ((100, 0), 0.047164306), + ((100, 10), 0.07856759), + ((100, 20), 0.09781857), + ((100, 30), 0.09724875), + ((100, 40), 0.08650395), + ((100, 50), 0.0819612), + ((100, 60), 0.09101133), + ((100, 70), 0.082009576), + ((100, 80), 0.067832805), + ((100, 90), 0.09361232), + ((100, 100), 0.044551715), + ]; + let spline = create_ridges_spline( + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + 0.1f32, true, + FloatAmplifier::Identity, ); + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), value); + } - assert_eq!(spline.apply(&pos), -0.1f32); + let values = [ + ((-100, -100), 5.695587E-8f32), + ((-100, -90), 5.884235E-8f32), + ((-100, -80), 5.90693E-8f32), + ((-100, -70), 5.9144433E-8f32), + ((-100, -60), 5.9184277E-8f32), + ((-100, -50), 5.9519557E-8f32), + ((-100, -40), 5.9189627E-8f32), + ((-100, -30), 4.2355031E-4f32), + ((-100, -20), 2.459766E-4f32), + ((-100, -10), 5.960271E-8f32), + ((-100, 0), 5.9598616E-8f32), + ((-100, 10), 5.9511574E-8f32), + ((-100, 20), 5.9176713E-8f32), + ((-100, 30), 5.815812E-8f32), + ((-100, 40), 5.6629148E-8f32), + ((-100, 50), 5.345945E-8f32), + ((-100, 60), 5.4001468E-8f32), + ((-100, 70), 5.320318E-8f32), + ((-100, 80), 4.9739526E-8f32), + ((-100, 90), 4.5798135E-8f32), + ((-100, 100), 4.028322E-8f32), + ((-90, -100), 5.1247085E-8f32), + ((-90, -90), 5.2310472E-8f32), + ((-90, -80), 5.5294336E-8f32), + ((-90, -70), 5.5947346E-8f32), + ((-90, -60), 5.7288506E-8f32), + ((-90, -50), 5.739956E-8f32), + ((-90, -40), 5.8463762E-8f32), + ((-90, -30), 5.8750086E-8f32), + ((-90, -20), 5.7887206E-8f32), + ((-90, -10), 5.8853374E-8f32), + ((-90, 0), 5.8520207E-8f32), + ((-90, 10), 5.808274E-8f32), + ((-90, 20), 5.5207785E-8f32), + ((-90, 30), 5.529978E-8f32), + ((-90, 40), 5.2386874E-8f32), + ((-90, 50), 4.8981203E-8f32), + ((-90, 60), 5.1243376E-8f32), + ((-90, 70), 4.924077E-8f32), + ((-90, 80), 4.537135E-8f32), + ((-90, 90), 3.8384623E-8f32), + ((-90, 100), 3.7887755E-8f32), + ((-80, -100), 4.191057E-8f32), + ((-80, -90), 4.128651E-8f32), + ((-80, -80), 4.6951747E-8f32), + ((-80, -70), 5.2239614E-8f32), + ((-80, -60), 5.2585264E-8f32), + ((-80, -50), 5.377814E-8f32), + ((-80, -40), 5.6291807E-8f32), + ((-80, -30), 5.4436086E-8f32), + ((-80, -20), 5.401795E-8f32), + ((-80, -10), 5.5925504E-8f32), + ((-80, 0), 5.6997617E-8f32), + ((-80, 10), 5.707632E-8f32), + ((-80, 20), 5.4268586E-8f32), + ((-80, 30), 4.8291344E-8f32), + ((-80, 40), 4.626358E-8f32), + ((-80, 50), 4.1572427E-8f32), + ((-80, 60), 3.766048E-8f32), + ((-80, 70), 3.4539838E-8f32), + ((-80, 80), 4.1234664E-8f32), + ((-80, 90), 3.6413716E-8f32), + ((-80, 100), 3.3629863E-8f32), + ((-70, -100), 3.1394823E-8f32), + ((-70, -90), 3.763256E-8f32), + ((-70, -80), 4.0905345E-8f32), + ((-70, -70), 4.7468387E-8f32), + ((-70, -60), 4.8873535E-8f32), + ((-70, -50), 4.7505754E-8f32), + ((-70, -40), 5.0717464E-8f32), + ((-70, -30), 5.132422E-8f32), + ((-70, -20), 4.686185E-8f32), + ((-70, -10), 4.9373618E-8f32), + ((-70, 0), 5.1102514E-8f32), + ((-70, 10), 5.1682036E-8f32), + ((-70, 20), 4.78878E-8f32), + ((-70, 30), 3.6676795E-8f32), + ((-70, 40), 3.8758472E-8f32), + ((-70, 50), 3.450292E-8f32), + ((-70, 60), 2.5345996E-8f32), + ((-70, 70), 2.883944E-8f32), + ((-70, 80), 2.5664E-8f32), + ((-70, 90), 2.9477066E-8f32), + ((-70, 100), 2.8907001E-8f32), + ((-60, -100), 2.653768E-8f32), + ((-60, -90), 2.8947806E-8f32), + ((-60, -80), 3.2679182E-8f32), + ((-60, -70), 3.6087982E-8f32), + ((-60, -60), 4.3701583E-8f32), + ((-60, -50), 3.905786E-8f32), + ((-60, -40), 4.1541064E-8f32), + ((-60, -30), 4.3882643E-8f32), + ((-60, -20), 3.6382332E-8f32), + ((-60, -10), 3.799164E-8f32), + ((-60, 0), 3.3409137E-8f32), + ((-60, 10), 3.406884E-8f32), + ((-60, 20), 3.063624E-8f32), + ((-60, 30), 1.9141522E-8f32), + ((-60, 40), 2.0079938E-8f32), + ((-60, 50), 1.6220396E-8f32), + ((-60, 60), 1.490829E-8f32), + ((-60, 70), 1.054482E-8f32), + ((-60, 80), 1.3725451E-8f32), + ((-60, 90), 1.9279936E-8f32), + ((-60, 100), 2.0201796E-8f32), + ((-50, -100), 1.5481977E-8f32), + ((-50, -90), 1.9391068E-8f32), + ((-50, -80), 2.8352996E-8f32), + ((-50, -70), 2.6329761E-8f32), + ((-50, -60), 2.7734513E-8f32), + ((-50, -50), 2.6432797E-8f32), + ((-50, -40), 2.38558E-8f32), + ((-50, -30), 2.1309475E-8f32), + ((-50, -20), 2.5337945E-8f32), + ((-50, -10), 2.8742313E-8f32), + ((-50, 0), 1.6715818E-8f32), + ((-50, 10), 1.8083686E-8f32), + ((-50, 20), 5.7321015E-9f32), + ((-50, 30), 7.1950286E-9f32), + ((-50, 40), 1.2317269E-8f32), + ((-50, 50), 1.3938307E-8f32), + ((-50, 60), 9.762806E-9f32), + ((-50, 70), 6.585973E-9f32), + ((-50, 80), -2.0132167E-4f32), + ((-50, 90), 4.8335447E-10f32), + ((-50, 100), 1.9115787E-10f32), + ((-40, -100), 7.92696E-9f32), + ((-40, -90), 9.5780255E-9f32), + ((-40, -80), 2.000497E-8f32), + ((-40, -70), 2.1985283E-8f32), + ((-40, -60), 1.9308487E-8f32), + ((-40, -50), 1.6949537E-8f32), + ((-40, -40), 9.26493E-9f32), + ((-40, -30), 5.901878E-9f32), + ((-40, -20), 2.0966575E-9f32), + ((-40, -10), 1.0789076E-8f32), + ((-40, 0), 3.7048786E-10f32), + ((-40, 10), 1.5132484E-10f32), + ((-40, 20), -0.05434511f32), + ((-40, 30), 1.271871E-9f32), + ((-40, 40), 3.488727E-9f32), + ((-40, 50), 2.2437354E-9f32), + ((-40, 60), -0.05718465f32), + ((-40, 70), -0.2222f32), + ((-40, 80), -0.2222f32), + ((-40, 90), -0.2222f32), + ((-40, 100), -0.2222f32), + ((-30, -100), 1.0579677E-9f32), + ((-30, -90), 6.055233E-9f32), + ((-30, -80), 9.750893E-9f32), + ((-30, -70), 1.0611076E-8f32), + ((-30, -60), 1.2687537E-8f32), + ((-30, -50), 6.9418045E-9f32), + ((-30, -40), -0.0013300264f32), + ((-30, -30), -0.2222f32), + ((-30, -20), -0.2222f32), + ((-30, -10), 4.974776E-11f32), + ((-30, 0), -0.1278581f32), + ((-30, 10), -0.2222f32), + ((-30, 20), -0.2222f32), + ((-30, 30), -0.2222f32), + ((-30, 40), -0.2222f32), + ((-30, 50), -0.2222f32), + ((-30, 60), -0.2222f32), + ((-30, 70), -0.2222f32), + ((-30, 80), -0.13529345f32), + ((-30, 90), -0.21922092f32), + ((-30, 100), -0.2222f32), + ((-20, -100), -0.05537056f32), + ((-20, -90), 8.724288E-11f32), + ((-20, -80), 1.1884951E-9f32), + ((-20, -70), 1.9197697E-9f32), + ((-20, -60), 2.9805012E-9f32), + ((-20, -50), 2.7255143E-11f32), + ((-20, -40), -0.2222f32), + ((-20, -30), -0.2222f32), + ((-20, -20), -0.2222f32), + ((-20, -10), -0.2222f32), + ((-20, 0), -0.2222f32), + ((-20, 10), -0.2222f32), + ((-20, 20), 2.0200092E-12f32), + ((-20, 30), -0.221999f32), + ((-20, 40), 2.5891045E-9f32), + ((-20, 50), 1.0679839E-8f32), + ((-20, 60), 1.1929803E-8f32), + ((-20, 70), 6.1294547E-10f32), + ((-20, 80), 1.5799029E-9f32), + ((-20, 90), 3.388032E-9f32), + ((-20, 100), 8.267753E-11f32), + ((-10, -100), -0.2222f32), + ((-10, -90), -0.2222f32), + ((-10, -80), -0.2222f32), + ((-10, -70), -0.006202223f32), + ((-10, -60), -0.2222f32), + ((-10, -50), -0.2222f32), + ((-10, -40), -0.2222f32), + ((-10, -30), -0.2222f32), + ((-10, -20), -0.2222f32), + ((-10, -10), 5.449592E-10f32), + ((-10, 0), 3.257944E-11f32), + ((-10, 10), 2.431444E-9f32), + ((-10, 20), 2.6643359E-9f32), + ((-10, 30), 1.1549817E-8f32), + ((-10, 40), 1.0936498E-8f32), + ((-10, 50), 2.8515958E-8f32), + ((-10, 60), 4.7736425E-8f32), + ((-10, 70), 3.3957107E-8f32), + ((-10, 80), 1.9823945E-8f32), + ((-10, 90), 2.1265759E-8f32), + ((-10, 100), 7.636967E-9f32), + ((0, -100), -0.2222f32), + ((0, -90), -0.2222f32), + ((0, -80), -0.2222f32), + ((0, -70), -0.2222f32), + ((0, -60), -0.2222f32), + ((0, -50), -0.2222f32), + ((0, -40), -2.7082162E-5f32), + ((0, -30), -0.21585968f32), + ((0, -20), -0.2222f32), + ((0, -10), 1.176656E-12f32), + ((0, 0), 4.198286E-9f32), + ((0, 10), 1.0030648E-8f32), + ((0, 20), 1.8099078E-8f32), + ((0, 30), 3.2837217E-8f32), + ((0, 40), 3.7809123E-8f32), + ((0, 50), 4.6640707E-8f32), + ((0, 60), 5.240726E-8f32), + ((0, 70), 4.0587377E-8f32), + ((0, 80), 5.0135483E-8f32), + ((0, 90), 4.109085E-8f32), + ((0, 100), 3.3951714E-8f32), + ((10, -100), -0.2222f32), + ((10, -90), -0.2099127f32), + ((10, -80), -0.2222f32), + ((10, -70), -0.2222f32), + ((10, -60), -0.22206965f32), + ((10, -50), 2.551357E-10f32), + ((10, -40), 4.397175E-9f32), + ((10, -30), 7.580093E-9f32), + ((10, -20), 9.14382E-9f32), + ((10, -10), 1.4292095E-8f32), + ((10, 0), 1.9721933E-8f32), + ((10, 10), 3.4391746E-8f32), + ((10, 20), 4.29825E-8f32), + ((10, 30), 5.1166293E-8f32), + ((10, 40), 5.8700344E-8f32), + ((10, 50), 5.4385303E-8f32), + ((10, 60), 4.675182E-8f32), + ((10, 70), 3.5514102E-8f32), + ((10, 80), 4.9047724E-8f32), + ((10, 90), 4.84383E-8f32), + ((10, 100), 5.0942354E-8f32), + ((20, -100), -0.026743041f32), + ((20, -90), 7.402218E-12f32), + ((20, -80), 1.2031336E-9f32), + ((20, -70), 3.514784E-10f32), + ((20, -60), 6.2830163E-10f32), + ((20, -50), 4.5063593E-9f32), + ((20, -40), 1.2455702E-8f32), + ((20, -30), 2.1923082E-8f32), + ((20, -20), 2.689708E-8f32), + ((20, -10), 3.3098544E-8f32), + ((20, 0), 3.8737195E-8f32), + ((20, 10), 5.412859E-8f32), + ((20, 20), 5.7970148E-8f32), + ((20, 30), 0.004082742f32), + ((20, 40), 0.10993963f32), + ((20, 50), 0.0022723493f32), + ((20, 60), 5.348043E-8f32), + ((20, 70), 5.833126E-8f32), + ((20, 80), 5.833503E-8f32), + ((20, 90), 5.905414E-8f32), + ((20, 100), 5.9325732E-8f32), + ((30, -100), 1.883031E-9f32), + ((30, -90), 2.340967E-9f32), + ((30, -80), 4.621183E-9f32), + ((30, -70), 4.499291E-9f32), + ((30, -60), 9.207621E-9f32), + ((30, -50), 1.8463968E-8f32), + ((30, -40), 3.1730355E-8f32), + ((30, -30), 4.180272E-8f32), + ((30, -20), 4.8970673E-8f32), + ((30, -10), 5.1013075E-8f32), + ((30, 0), 5.4809675E-8f32), + ((30, 10), 0.021245107f32), + ((30, 20), 0.15461163f32), + ((30, 30), 0.16635494f32), + ((30, 40), 0.1956933f32), + ((30, 50), 0.125502f32), + ((30, 60), 0.0454505f32), + ((30, 70), 0.11700109f32), + ((30, 80), 0.09687484f32), + ((30, 90), 0.098305956f32), + ((30, 100), 0.1445496f32), + ((40, -100), 1.0226738E-8f32), + ((40, -90), 1.1222422E-8f32), + ((40, -80), 1.1587838E-8f32), + ((40, -70), 1.2693759E-8f32), + ((40, -60), 2.4839746E-8f32), + ((40, -50), 3.7039946E-8f32), + ((40, -40), 4.376643E-8f32), + ((40, -30), 5.5051583E-8f32), + ((40, -20), 5.699222E-8f32), + ((40, -10), 5.8692283E-8f32), + ((40, 0), 5.959828E-8f32), + ((40, 10), 0.117445365f32), + ((40, 20), 0.1976749f32), + ((40, 30), 0.15454988f32), + ((40, 40), 0.12067541f32), + ((40, 50), 0.18615633f32), + ((40, 60), 0.13336352f32), + ((40, 70), 0.17219193f32), + ((40, 80), 0.19097134f32), + ((40, 90), 0.17008683f32), + ((40, 100), 0.19814269f32), + ((50, -100), 1.986243E-8f32), + ((50, -90), 3.0001612E-8f32), + ((50, -80), 2.7766955E-8f32), + ((50, -70), 2.638818E-8f32), + ((50, -60), 2.8721853E-8f32), + ((50, -50), 4.524472E-8f32), + ((50, -40), 5.231772E-8f32), + ((50, -30), 5.6755226E-8f32), + ((50, -20), 0.007071222f32), + ((50, -10), 0.044527233f32), + ((50, 0), 0.1308815f32), + ((50, 10), 0.17924443f32), + ((50, 20), 0.171056f32), + ((50, 30), 0.11742895f32), + ((50, 40), 0.100002244f32), + ((50, 50), 0.07300641f32), + ((50, 60), 0.039613634f32), + ((50, 70), 0.07481807f32), + ((50, 80), 0.14415564f32), + ((50, 90), 0.17187755f32), + ((50, 100), 0.19749363f32), + ((60, -100), 2.5121897E-8f32), + ((60, -90), 3.6076102E-8f32), + ((60, -80), 3.5671647E-8f32), + ((60, -70), 3.3701973E-8f32), + ((60, -60), 4.019155E-8f32), + ((60, -50), 4.4427246E-8f32), + ((60, -40), 4.8801404E-8f32), + ((60, -30), 5.7100323E-8f32), + ((60, -20), 0.016408712f32), + ((60, -10), 0.118191816f32), + ((60, 0), 0.1338304f32), + ((60, 10), 0.19006152f32), + ((60, 20), 0.13440025f32), + ((60, 30), 0.05049737f32), + ((60, 40), 0.034953773f32), + ((60, 50), 0.010686001f32), + ((60, 60), 9.3192887E-4f32), + ((60, 70), 0.01608308f32), + ((60, 80), 0.06671151f32), + ((60, 90), 0.12534031f32), + ((60, 100), 0.1557267f32), + ((70, -100), 2.4559224E-8f32), + ((70, -90), 3.1209016E-8f32), + ((70, -80), 3.584771E-8f32), + ((70, -70), 3.920727E-8f32), + ((70, -60), 4.6965155E-8f32), + ((70, -50), 5.0089643E-8f32), + ((70, -40), 5.7268437E-8f32), + ((70, -30), 5.8877202E-8f32), + ((70, -20), 0.04484091f32), + ((70, -10), 0.10752107f32), + ((70, 0), 0.18246908f32), + ((70, 10), 0.15116146f32), + ((70, 20), 0.11487521f32), + ((70, 30), 0.032360524f32), + ((70, 40), 8.2579E-4f32), + ((70, 50), -2.8622872E-4f32), + ((70, 60), -1.8847623E-4f32), + ((70, 70), 0.013071927f32), + ((70, 80), 0.033794176f32), + ((70, 90), 0.0804281f32), + ((70, 100), 0.1404463f32), + ((80, -100), 2.193597E-8f32), + ((80, -90), 2.6228625E-8f32), + ((80, -80), 3.3251055E-8f32), + ((80, -70), 3.7941476E-8f32), + ((80, -60), 4.690521E-8f32), + ((80, -50), 5.439166E-8f32), + ((80, -40), 5.7380536E-8f32), + ((80, -30), -3.256929E-4f32), + ((80, -20), 0.09458507f32), + ((80, -10), 0.14780462f32), + ((80, 0), 0.17881581f32), + ((80, 10), 0.104895204f32), + ((80, 20), 0.07187125f32), + ((80, 30), 0.033689234f32), + ((80, 40), 0.021538133f32), + ((80, 50), 0.023637377f32), + ((80, 60), 0.013018714f32), + ((80, 70), 0.01623013f32), + ((80, 80), 0.051183194f32), + ((80, 90), 0.12191488f32), + ((80, 100), 0.183341f32), + ((90, -100), 2.1037952E-8f32), + ((90, -90), 2.265903E-8f32), + ((90, -80), 2.9746175E-8f32), + ((90, -70), 3.0741784E-8f32), + ((90, -60), 3.696515E-8f32), + ((90, -50), 4.9130783E-8f32), + ((90, -40), 5.4571295E-8f32), + ((90, -30), 5.932105E-8f32), + ((90, -20), 0.052174564f32), + ((90, -10), 0.1461835f32), + ((90, 0), 0.16661009f32), + ((90, 10), 0.17031777f32), + ((90, 20), 0.09012478f32), + ((90, 30), 0.08638496f32), + ((90, 40), 0.077556595f32), + ((90, 50), 0.090003595f32), + ((90, 60), 0.078915626f32), + ((90, 70), 0.08257657f32), + ((90, 80), 0.07836004f32), + ((90, 90), 0.14655045f32), + ((90, 100), 0.18773082f32), + ((100, -100), 1.6543842E-8f32), + ((100, -90), 2.0407779E-8f32), + ((100, -80), 2.2677513E-8f32), + ((100, -70), 2.7998853E-8f32), + ((100, -60), 3.3088963E-8f32), + ((100, -50), 3.9689027E-8f32), + ((100, -40), 4.2064737E-8f32), + ((100, -30), 5.060286E-8f32), + ((100, -20), 5.8539825E-8f32), + ((100, -10), 5.9588313E-8f32), + ((100, 0), 0.09291531f32), + ((100, 10), 0.16675612f32), + ((100, 20), 0.19767791f32), + ((100, 30), 0.19702585f32), + ((100, 40), 0.18153131f32), + ((100, 50), 0.1733732f32), + ((100, 60), 0.1887327f32), + ((100, 70), 0.17346446f32), + ((100, 80), 0.1434478f32), + ((100, 90), 0.19244039f32), + ((100, 100), 0.08641162f32), + ]; - let spline = create_offset_spline( - noise_functions.continents_overworld, - noise_functions.erosion_overworld.clone(), - noise_functions.ridges_folded_overworld.clone(), + let spline = create_ridges_spline( + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + 0.1f32, false, + FloatAmplifier::OffsetAmplifier, ); + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), value); + } + } + + #[test] + fn test_create_standard_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let values = [ + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + -0.5855955f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + -0.5855955f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + -0.5855955f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + -0.5855955f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + -1.054043f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + -1.054043f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + -1.054043f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + -1.054043f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -0.6609869f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + -0.6396386f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + -0.6396386f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.2500136f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + -0.6396386f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + -0.6396386f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.5890267f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + -0.53155243f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -0.9811153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.5890267f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.2725821f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 1.1114353f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.06985277f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.1303201f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + -1.2500136f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + 0.045165043f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.2027293f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, -100), + -1.1303201f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (100, 100), + -1.2027293f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, -100), + -1.1114353f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 0.6609869f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (100, 100), + 0.06985277f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, -100), + 0.9811153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (100, 100), + -0.2725821f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-100, 100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, -100), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (100, 100), + 1.0f32, + ), + ]; + + for ((i, j, k, l, m, n), (x, z), result) in values { + let spline = create_standard_spline( + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + k, + l, + m, + n, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_total_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let spline = create_total_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + 0.1f32, + false, + FloatAmplifier::Identity, + ); + + let results = [ + ((-100, -100), 3.9559398f32), + ((-100, -80), 4.807647f32), + ((-100, -60), 5.374414f32), + ((-100, -40), 6.039576f32), + ((-100, -20), 6.2145243f32), + ((-100, 0), 6.2519383f32), + ((-100, 20), 5.668728f32), + ((-100, 40), 5.430271f32), + ((-100, 60), 5.3465686f32), + ((-100, 80), 5.7992992f32), + ((-100, 100), 6.184176f32), + ((-80, -100), 4.2855577f32), + ((-80, -80), 5.410581f32), + ((-80, -60), 6.0751333f32), + ((-80, -40), 6.064536f32), + ((-80, -20), 6.294022f32), + ((-80, 0), 5.9999614f32), + ((-80, 20), 5.593004f32), + ((-80, 40), 5.134943f32), + ((-80, 60), 4.980488f32), + ((-80, 80), 5.261717f32), + ((-80, 100), 5.8683443f32), + ((-60, -100), 5.3242173f32), + ((-60, -80), 6.1496606f32), + ((-60, -60), 6.2368507f32), + ((-60, -40), 6.2986646f32), + ((-60, -20), 5.810248f32), + ((-60, 0), 5.273079f32), + ((-60, 20), 5.040388f32), + ((-60, 40), 4.3643947f32), + ((-60, 60), 4.333951f32), + ((-60, 80), 4.4810057f32), + ((-60, 100), 5.1953006f32), + ((-40, -100), 5.7455482f32), + ((-40, -80), 6.260874f32), + ((-40, -60), 6.145445f32), + ((-40, -40), 5.577779f32), + ((-40, -20), 4.6068044f32), + ((-40, 0), 3.8860993f32), + ((-40, 20), 3.6332812f32), + ((-40, 40), 3.6844056f32), + ((-40, 60), 3.6776288f32), + ((-40, 80), 4.0753975f32), + ((-40, 100), 4.052621f32), + ((-20, -100), 5.9622307f32), + ((-20, -80), 6.1761384f32), + ((-20, -60), 5.989888f32), + ((-20, -40), 5.1478043f32), + ((-20, -20), 3.3569198f32), + ((-20, 0), 3.5856972f32), + ((-20, 20), 4.7114053f32), + ((-20, 40), 5.187414f32), + ((-20, 60), 5.3671384f32), + ((-20, 80), 5.118062f32), + ((-20, 100), 5.00394f32), + ((0, -100), 5.6509624f32), + ((0, -80), 3.9915285f32), + ((0, -60), 3.0518057f32), + ((0, -40), 3.6596267f32), + ((0, -20), 3.7325847f32), + ((0, 0), 5.0374494f32), + ((0, 20), 5.4231296f32), + ((0, 40), 5.573647f32), + ((0, 60), 5.7088904f32), + ((0, 80), 5.8659945f32), + ((0, 100), 6.062538f32), + ((20, -100), 2.6716564f32), + ((20, -80), 3.0382447f32), + ((20, -60), 3.2207258f32), + ((20, -40), 3.914099f32), + ((20, -20), 4.7410517f32), + ((20, 0), 5.3999853f32), + ((20, 20), 5.6645765f32), + ((20, 40), 5.8144393f32), + ((20, 60), 5.7998343f32), + ((20, 80), 6.048253f32), + ((20, 100), 6.258326f32), + ((40, -100), 2.7401226f32), + ((40, -80), 2.915509f32), + ((40, -60), 3.5286994f32), + ((40, -40), 4.3014565f32), + ((40, -20), 5.0878124f32), + ((40, 0), 5.541592f32), + ((40, 20), 5.8015866f32), + ((40, 40), 5.959838f32), + ((40, 60), 6.0048213f32), + ((40, 80), 6.170586f32), + ((40, 100), 6.3f32), + ((60, -100), 3.086289f32), + ((60, -80), 3.4860597f32), + ((60, -60), 3.699067f32), + ((60, -40), 4.0114455f32), + ((60, -20), 5.0421495f32), + ((60, 0), 5.3703775f32), + ((60, 20), 5.722691f32), + ((60, 40), 5.930701f32), + ((60, 60), 6.1620193f32), + ((60, 80), 6.3f32), + ((60, 100), 6.3f32), + ((80, -100), 3.215626f32), + ((80, -80), 3.7482586f32), + ((80, -60), 4.0281653f32), + ((80, -40), 4.536797f32), + ((80, -20), 5.225231f32), + ((80, 0), 5.6602106f32), + ((80, 20), 5.8967495f32), + ((80, 40), 6.143576f32), + ((80, 60), 6.280398f32), + ((80, 80), 6.3f32), + ((80, 100), 6.3f32), + ((100, -100), 3.8355258f32), + ((100, -80), 4.377617f32), + ((100, -60), 4.545309f32), + ((100, -40), 4.9803877f32), + ((100, -20), 5.34028f32), + ((100, 0), 5.9103274f32), + ((100, 20), 6.028236f32), + ((100, 40), 6.257579f32), + ((100, 60), 6.3f32), + ((100, 80), 6.3f32), + ((100, 100), 6.3f32), + ]; + + for ((x, z), result) in results { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + + let spline = create_total_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + 0.1f32, + true, + FloatAmplifier::Identity, + ); + + let results = [ + ((-100, -100), 3.9559398f32), + ((-100, -80), 4.807647f32), + ((-100, -60), 5.374414f32), + ((-100, -40), 6.039576f32), + ((-100, -20), 6.2145243f32), + ((-100, 0), 6.2519383f32), + ((-100, 20), 5.668728f32), + ((-100, 40), 5.430271f32), + ((-100, 60), 5.3465686f32), + ((-100, 80), 5.7992992f32), + ((-100, 100), 6.184176f32), + ((-80, -100), 4.2855577f32), + ((-80, -80), 5.410581f32), + ((-80, -60), 6.0751333f32), + ((-80, -40), 6.064536f32), + ((-80, -20), 6.294022f32), + ((-80, 0), 5.9999614f32), + ((-80, 20), 5.593004f32), + ((-80, 40), 5.134943f32), + ((-80, 60), 4.980488f32), + ((-80, 80), 5.261717f32), + ((-80, 100), 5.8683443f32), + ((-60, -100), 5.3242173f32), + ((-60, -80), 6.1496606f32), + ((-60, -60), 6.2368507f32), + ((-60, -40), 6.2986646f32), + ((-60, -20), 5.810248f32), + ((-60, 0), 5.273079f32), + ((-60, 20), 5.040388f32), + ((-60, 40), 4.3643947f32), + ((-60, 60), 4.333951f32), + ((-60, 80), 4.4810057f32), + ((-60, 100), 5.1953006f32), + ((-40, -100), 5.7455482f32), + ((-40, -80), 6.260874f32), + ((-40, -60), 6.145445f32), + ((-40, -40), 5.577779f32), + ((-40, -20), 4.6068044f32), + ((-40, 0), 3.8860993f32), + ((-40, 20), 3.6332812f32), + ((-40, 40), 3.6844056f32), + ((-40, 60), 3.6776288f32), + ((-40, 80), 4.0753975f32), + ((-40, 100), 4.052621f32), + ((-20, -100), 5.9622307f32), + ((-20, -80), 6.1761384f32), + ((-20, -60), 5.989888f32), + ((-20, -40), 5.1478043f32), + ((-20, -20), 3.3569198f32), + ((-20, 0), 3.5856972f32), + ((-20, 20), 4.7114053f32), + ((-20, 40), 5.187414f32), + ((-20, 60), 5.3671384f32), + ((-20, 80), 5.118062f32), + ((-20, 100), 5.00394f32), + ((0, -100), 5.6509624f32), + ((0, -80), 3.9915285f32), + ((0, -60), 3.0518057f32), + ((0, -40), 3.6596267f32), + ((0, -20), 3.7325847f32), + ((0, 0), 5.0374494f32), + ((0, 20), 5.4231296f32), + ((0, 40), 5.573647f32), + ((0, 60), 5.7088904f32), + ((0, 80), 5.8659945f32), + ((0, 100), 6.062538f32), + ((20, -100), 2.6716564f32), + ((20, -80), 3.0382447f32), + ((20, -60), 3.2207258f32), + ((20, -40), 3.914099f32), + ((20, -20), 4.7410517f32), + ((20, 0), 5.3999853f32), + ((20, 20), 5.6645765f32), + ((20, 40), 5.8144393f32), + ((20, 60), 5.7998343f32), + ((20, 80), 6.048253f32), + ((20, 100), 6.258326f32), + ((40, -100), 2.7401226f32), + ((40, -80), 2.915509f32), + ((40, -60), 3.5286994f32), + ((40, -40), 4.3014565f32), + ((40, -20), 5.0878124f32), + ((40, 0), 5.541592f32), + ((40, 20), 5.8015866f32), + ((40, 40), 5.959838f32), + ((40, 60), 6.0048213f32), + ((40, 80), 6.170586f32), + ((40, 100), 6.3f32), + ((60, -100), 3.086289f32), + ((60, -80), 3.4860597f32), + ((60, -60), 3.699067f32), + ((60, -40), 4.0114455f32), + ((60, -20), 5.0421495f32), + ((60, 0), 5.3703775f32), + ((60, 20), 5.722691f32), + ((60, 40), 5.930701f32), + ((60, 60), 6.1620193f32), + ((60, 80), 6.3f32), + ((60, 100), 6.3f32), + ((80, -100), 3.215626f32), + ((80, -80), 3.7482586f32), + ((80, -60), 4.0281653f32), + ((80, -40), 4.536797f32), + ((80, -20), 5.225231f32), + ((80, 0), 5.6602106f32), + ((80, 20), 5.8967495f32), + ((80, 40), 6.143576f32), + ((80, 60), 6.280398f32), + ((80, 80), 6.3f32), + ((80, 100), 6.3f32), + ((100, -100), 3.8355258f32), + ((100, -80), 4.377617f32), + ((100, -60), 4.545309f32), + ((100, -40), 4.9803877f32), + ((100, -20), 5.34028f32), + ((100, 0), 5.9103274f32), + ((100, 20), 6.028236f32), + ((100, 40), 6.257579f32), + ((100, 60), 6.3f32), + ((100, 80), 6.3f32), + ((100, 100), 6.3f32), + ]; + + for ((x, z), result) in results { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_folded_ridges_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let results = [ + ((-1.0f32, -1.0f32), (-100, -100), 0.0f32), + ((-1.0f32, -1.0f32), (-100, -80), 0.0f32), + ((-1.0f32, -1.0f32), (-100, -60), 0.0f32), + ((-1.0f32, -1.0f32), (-100, -40), 0.0f32), + ((-1.0f32, -1.0f32), (-100, -20), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 20), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 40), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 60), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 80), 0.0f32), + ((-1.0f32, -1.0f32), (-100, 100), 0.0f32), + ((-1.0f32, -1.0f32), (-80, -100), 0.0f32), + ((-1.0f32, -1.0f32), (-80, -80), 0.0f32), + ((-1.0f32, -1.0f32), (-80, -60), 0.0f32), + ((-1.0f32, -1.0f32), (-80, -40), 0.0f32), + ((-1.0f32, -1.0f32), (-80, -20), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 20), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 40), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 60), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 80), 0.0f32), + ((-1.0f32, -1.0f32), (-80, 100), 0.0f32), + ((-1.0f32, -1.0f32), (-60, -100), 0.0f32), + ((-1.0f32, -1.0f32), (-60, -80), 0.0f32), + ((-1.0f32, -1.0f32), (-60, -60), 0.0f32), + ((-1.0f32, -1.0f32), (-60, -40), 0.0f32), + ((-1.0f32, -1.0f32), (-60, -20), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 20), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 40), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 60), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 80), 0.0f32), + ((-1.0f32, -1.0f32), (-60, 100), 0.0f32), + ((-1.0f32, -1.0f32), (-40, -100), 0.0f32), + ((-1.0f32, -1.0f32), (-40, -80), 0.0f32), + ((-1.0f32, -1.0f32), (-40, -60), 0.0f32), + ((-1.0f32, -1.0f32), (-40, -40), 0.0f32), + ((-1.0f32, -1.0f32), (-40, -20), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 20), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 40), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 60), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 80), 0.0f32), + ((-1.0f32, -1.0f32), (-40, 100), 0.0f32), + ((-1.0f32, -1.0f32), (-20, -100), 0.0f32), + ((-1.0f32, -1.0f32), (-20, -80), 0.0f32), + ((-1.0f32, -1.0f32), (-20, -60), 0.0f32), + ((-1.0f32, -1.0f32), (-20, -40), 0.0f32), + ((-1.0f32, -1.0f32), (-20, -20), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 20), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 40), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 60), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 80), 0.0f32), + ((-1.0f32, -1.0f32), (-20, 100), 0.0f32), + ((-1.0f32, -1.0f32), (0, -100), 0.0f32), + ((-1.0f32, -1.0f32), (0, -80), 0.0f32), + ((-1.0f32, -1.0f32), (0, -60), 0.0f32), + ((-1.0f32, -1.0f32), (0, -40), 0.0f32), + ((-1.0f32, -1.0f32), (0, -20), 0.0f32), + ((-1.0f32, -1.0f32), (0, 0), 0.0f32), + ((-1.0f32, -1.0f32), (0, 20), 0.0f32), + ((-1.0f32, -1.0f32), (0, 40), 0.0f32), + ((-1.0f32, -1.0f32), (0, 60), 0.0f32), + ((-1.0f32, -1.0f32), (0, 80), 0.0f32), + ((-1.0f32, -1.0f32), (0, 100), 0.0f32), + ((-1.0f32, -1.0f32), (20, -100), 0.0f32), + ((-1.0f32, -1.0f32), (20, -80), 0.0f32), + ((-1.0f32, -1.0f32), (20, -60), 0.0f32), + ((-1.0f32, -1.0f32), (20, -40), 0.0f32), + ((-1.0f32, -1.0f32), (20, -20), 0.0f32), + ((-1.0f32, -1.0f32), (20, 0), 0.0f32), + ((-1.0f32, -1.0f32), (20, 20), 0.0f32), + ((-1.0f32, -1.0f32), (20, 40), 0.0f32), + ((-1.0f32, -1.0f32), (20, 60), 0.0f32), + ((-1.0f32, -1.0f32), (20, 80), 0.0f32), + ((-1.0f32, -1.0f32), (20, 100), 0.0f32), + ((-1.0f32, -1.0f32), (40, -100), 0.0f32), + ((-1.0f32, -1.0f32), (40, -80), 0.0f32), + ((-1.0f32, -1.0f32), (40, -60), 0.0f32), + ((-1.0f32, -1.0f32), (40, -40), 0.0f32), + ((-1.0f32, -1.0f32), (40, -20), 0.0f32), + ((-1.0f32, -1.0f32), (40, 0), 0.0f32), + ((-1.0f32, -1.0f32), (40, 20), 0.0f32), + ((-1.0f32, -1.0f32), (40, 40), 0.0f32), + ((-1.0f32, -1.0f32), (40, 60), 0.0f32), + ((-1.0f32, -1.0f32), (40, 80), 0.0f32), + ((-1.0f32, -1.0f32), (40, 100), 0.0f32), + ((-1.0f32, -1.0f32), (60, -100), 0.0f32), + ((-1.0f32, -1.0f32), (60, -80), 0.0f32), + ((-1.0f32, -1.0f32), (60, -60), 0.0f32), + ((-1.0f32, -1.0f32), (60, -40), 0.0f32), + ((-1.0f32, -1.0f32), (60, -20), 0.0f32), + ((-1.0f32, -1.0f32), (60, 0), 0.0f32), + ((-1.0f32, -1.0f32), (60, 20), 0.0f32), + ((-1.0f32, -1.0f32), (60, 40), 0.0f32), + ((-1.0f32, -1.0f32), (60, 60), 0.0f32), + ((-1.0f32, -1.0f32), (60, 80), 0.0f32), + ((-1.0f32, -1.0f32), (60, 100), 0.0f32), + ((-1.0f32, -1.0f32), (80, -100), 0.0f32), + ((-1.0f32, -1.0f32), (80, -80), 0.0f32), + ((-1.0f32, -1.0f32), (80, -60), 0.0f32), + ((-1.0f32, -1.0f32), (80, -40), 0.0f32), + ((-1.0f32, -1.0f32), (80, -20), 0.0f32), + ((-1.0f32, -1.0f32), (80, 0), 0.0f32), + ((-1.0f32, -1.0f32), (80, 20), 0.0f32), + ((-1.0f32, -1.0f32), (80, 40), 0.0f32), + ((-1.0f32, -1.0f32), (80, 60), 0.0f32), + ((-1.0f32, -1.0f32), (80, 80), 0.0f32), + ((-1.0f32, -1.0f32), (80, 100), 0.0f32), + ((-1.0f32, -1.0f32), (100, -100), 0.0f32), + ((-1.0f32, -1.0f32), (100, -80), 0.0f32), + ((-1.0f32, -1.0f32), (100, -60), 0.0f32), + ((-1.0f32, -1.0f32), (100, -40), 0.0f32), + ((-1.0f32, -1.0f32), (100, -20), 0.0f32), + ((-1.0f32, -1.0f32), (100, 0), 0.0f32), + ((-1.0f32, -1.0f32), (100, 20), 0.0f32), + ((-1.0f32, -1.0f32), (100, 40), 0.0f32), + ((-1.0f32, -1.0f32), (100, 60), 0.0f32), + ((-1.0f32, -1.0f32), (100, 80), 0.0f32), + ((-1.0f32, -1.0f32), (100, 100), 0.0f32), + ((-1.0f32, 1.0f32), (-100, -100), 0.297652f32), + ((-1.0f32, 1.0f32), (-100, -80), 0.28439626f32), + ((-1.0f32, 1.0f32), (-100, -60), 0.28112307f32), + ((-1.0f32, 1.0f32), (-100, -40), 0.28095382f32), + ((-1.0f32, 1.0f32), (-100, -20), 0.24100831f32), + ((-1.0f32, 1.0f32), (-100, 0), 0.2526898f32), + ((-1.0f32, 1.0f32), (-100, 20), 0.2813595f32), + ((-1.0f32, 1.0f32), (-100, 40), 0.29286346f32), + ((-1.0f32, 1.0f32), (-100, 60), 0.21068382f32), + ((-1.0f32, 1.0f32), (-100, 80), 0.063217856f32), + ((-1.0f32, 1.0f32), (-100, 100), 0.0f32), + ((-1.0f32, 1.0f32), (-80, -100), 0.0f32), + ((-1.0f32, 1.0f32), (-80, -80), 0.008730456f32), + ((-1.0f32, 1.0f32), (-80, -60), 0.15711506f32), + ((-1.0f32, 1.0f32), (-80, -40), 0.28587654f32), + ((-1.0f32, 1.0f32), (-80, -20), 0.21130508f32), + ((-1.0f32, 1.0f32), (-80, 0), 0.29809594f32), + ((-1.0f32, 1.0f32), (-80, 20), 0.2206994f32), + ((-1.0f32, 1.0f32), (-80, 40), 0.0027657598f32), + ((-1.0f32, 1.0f32), (-80, 60), 0.0f32), + ((-1.0f32, 1.0f32), (-80, 80), 0.0f32), + ((-1.0f32, 1.0f32), (-80, 100), 0.0f32), + ((-1.0f32, 1.0f32), (-60, -100), 0.0f32), + ((-1.0f32, 1.0f32), (-60, -80), 0.0f32), + ((-1.0f32, 1.0f32), (-60, -60), 0.0f32), + ((-1.0f32, 1.0f32), (-60, -40), 0.0f32), + ((-1.0f32, 1.0f32), (-60, -20), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 20), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 40), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 60), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 80), 0.0f32), + ((-1.0f32, 1.0f32), (-60, 100), 0.0f32), + ((-1.0f32, 1.0f32), (-40, -100), 0.0f32), + ((-1.0f32, 1.0f32), (-40, -80), 0.0f32), + ((-1.0f32, 1.0f32), (-40, -60), 0.0f32), + ((-1.0f32, 1.0f32), (-40, -40), 0.0f32), + ((-1.0f32, 1.0f32), (-40, -20), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 20), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 40), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 60), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 80), 0.0f32), + ((-1.0f32, 1.0f32), (-40, 100), 0.0f32), + ((-1.0f32, 1.0f32), (-20, -100), 0.0f32), + ((-1.0f32, 1.0f32), (-20, -80), 0.0f32), + ((-1.0f32, 1.0f32), (-20, -60), 0.0f32), + ((-1.0f32, 1.0f32), (-20, -40), 0.0f32), + ((-1.0f32, 1.0f32), (-20, -20), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 20), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 40), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 60), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 80), 0.0f32), + ((-1.0f32, 1.0f32), (-20, 100), 0.0f32), + ((-1.0f32, 1.0f32), (0, -100), 0.0f32), + ((-1.0f32, 1.0f32), (0, -80), 0.0f32), + ((-1.0f32, 1.0f32), (0, -60), 0.0f32), + ((-1.0f32, 1.0f32), (0, -40), 0.0f32), + ((-1.0f32, 1.0f32), (0, -20), 0.0f32), + ((-1.0f32, 1.0f32), (0, 0), 0.0f32), + ((-1.0f32, 1.0f32), (0, 20), 0.0f32), + ((-1.0f32, 1.0f32), (0, 40), 0.0f32), + ((-1.0f32, 1.0f32), (0, 60), 0.31608355f32), + ((-1.0f32, 1.0f32), (0, 80), 0.15622428f32), + ((-1.0f32, 1.0f32), (0, 100), 0.0f32), + ((-1.0f32, 1.0f32), (20, -100), 0.0f32), + ((-1.0f32, 1.0f32), (20, -80), 0.0f32), + ((-1.0f32, 1.0f32), (20, -60), 0.0f32), + ((-1.0f32, 1.0f32), (20, -40), 0.0f32), + ((-1.0f32, 1.0f32), (20, -20), 0.0f32), + ((-1.0f32, 1.0f32), (20, 0), 0.0f32), + ((-1.0f32, 1.0f32), (20, 20), 0.6269908f32), + ((-1.0f32, 1.0f32), (20, 40), 0.16064115f32), + ((-1.0f32, 1.0f32), (20, 60), 0.40093344f32), + ((-1.0f32, 1.0f32), (20, 80), 0.62168556f32), + ((-1.0f32, 1.0f32), (20, 100), 0.579518f32), + ((-1.0f32, 1.0f32), (40, -100), 0.0f32), + ((-1.0f32, 1.0f32), (40, -80), 0.0f32), + ((-1.0f32, 1.0f32), (40, -60), 0.0f32), + ((-1.0f32, 1.0f32), (40, -40), 0.0f32), + ((-1.0f32, 1.0f32), (40, -20), 0.62588596f32), + ((-1.0f32, 1.0f32), (40, 0), 0.5309059f32), + ((-1.0f32, 1.0f32), (40, 20), 4.5912433E-4f32), + ((-1.0f32, 1.0f32), (40, 40), 0.13530377f32), + ((-1.0f32, 1.0f32), (40, 60), 0.10672425f32), + ((-1.0f32, 1.0f32), (40, 80), 0.0052022375f32), + ((-1.0f32, 1.0f32), (40, 100), 3.0043628E-4f32), + ((-1.0f32, 1.0f32), (60, -100), 0.0f32), + ((-1.0f32, 1.0f32), (60, -80), 0.0f32), + ((-1.0f32, 1.0f32), (60, -60), 0.0f32), + ((-1.0f32, 1.0f32), (60, -40), 0.08376785f32), + ((-1.0f32, 1.0f32), (60, -20), 0.43452874f32), + ((-1.0f32, 1.0f32), (60, 0), 0.1057023f32), + ((-1.0f32, 1.0f32), (60, 20), 0.10445799f32), + ((-1.0f32, 1.0f32), (60, 40), 0.36914507f32), + ((-1.0f32, 1.0f32), (60, 60), 0.5024393f32), + ((-1.0f32, 1.0f32), (60, 80), 0.27316388f32), + ((-1.0f32, 1.0f32), (60, 100), 0.06046915f32), + ((-1.0f32, 1.0f32), (80, -100), 0.0f32), + ((-1.0f32, 1.0f32), (80, -80), 0.0f32), + ((-1.0f32, 1.0f32), (80, -60), 0.01727397f32), + ((-1.0f32, 1.0f32), (80, -40), 0.6299955f32), + ((-1.0f32, 1.0f32), (80, -20), 0.19864634f32), + ((-1.0f32, 1.0f32), (80, 0), 0.02047487f32), + ((-1.0f32, 1.0f32), (80, 20), 0.25879034f32), + ((-1.0f32, 1.0f32), (80, 40), 0.41536066f32), + ((-1.0f32, 1.0f32), (80, 60), 0.44784027f32), + ((-1.0f32, 1.0f32), (80, 80), 0.31828198f32), + ((-1.0f32, 1.0f32), (80, 100), 0.014104452f32), + ((-1.0f32, 1.0f32), (100, -100), 0.0f32), + ((-1.0f32, 1.0f32), (100, -80), 0.0f32), + ((-1.0f32, 1.0f32), (100, -60), 0.0f32), + ((-1.0f32, 1.0f32), (100, -40), 0.0f32), + ((-1.0f32, 1.0f32), (100, -20), 0.6171453f32), + ((-1.0f32, 1.0f32), (100, 0), 0.20290473f32), + ((-1.0f32, 1.0f32), (100, 20), 4.5798905E-4f32), + ((-1.0f32, 1.0f32), (100, 40), 0.01657176f32), + ((-1.0f32, 1.0f32), (100, 60), 0.00752043f32), + ((-1.0f32, 1.0f32), (100, 80), 0.0851554f32), + ((-1.0f32, 1.0f32), (100, 100), 0.21973094f32), + ((1.0f32, -1.0f32), (-100, -100), 0.0f32), + ((1.0f32, -1.0f32), (-100, -80), 0.015603749f32), + ((1.0f32, -1.0f32), (-100, -60), 0.018876947f32), + ((1.0f32, -1.0f32), (-100, -40), 0.019046182f32), + ((1.0f32, -1.0f32), (-100, -20), 0.058991697f32), + ((1.0f32, -1.0f32), (-100, 0), 0.047310222f32), + ((1.0f32, -1.0f32), (-100, 20), 0.01864053f32), + ((1.0f32, -1.0f32), (-100, 40), 0.0f32), + ((1.0f32, -1.0f32), (-100, 60), 0.0f32), + ((1.0f32, -1.0f32), (-100, 80), 0.0f32), + ((1.0f32, -1.0f32), (-100, 100), 0.0f32), + ((1.0f32, -1.0f32), (-80, -100), 0.0f32), + ((1.0f32, -1.0f32), (-80, -80), 0.0f32), + ((1.0f32, -1.0f32), (-80, -60), 0.0f32), + ((1.0f32, -1.0f32), (-80, -40), 0.0f32), + ((1.0f32, -1.0f32), (-80, -20), 0.0f32), + ((1.0f32, -1.0f32), (-80, 0), 0.0f32), + ((1.0f32, -1.0f32), (-80, 20), 0.0f32), + ((1.0f32, -1.0f32), (-80, 40), 0.0f32), + ((1.0f32, -1.0f32), (-80, 60), 0.0f32), + ((1.0f32, -1.0f32), (-80, 80), 0.0f32), + ((1.0f32, -1.0f32), (-80, 100), 0.0f32), + ((1.0f32, -1.0f32), (-60, -100), 0.0f32), + ((1.0f32, -1.0f32), (-60, -80), 0.0f32), + ((1.0f32, -1.0f32), (-60, -60), 0.0f32), + ((1.0f32, -1.0f32), (-60, -40), 0.0f32), + ((1.0f32, -1.0f32), (-60, -20), 0.0f32), + ((1.0f32, -1.0f32), (-60, 0), 0.0f32), + ((1.0f32, -1.0f32), (-60, 20), 0.0f32), + ((1.0f32, -1.0f32), (-60, 40), 0.0f32), + ((1.0f32, -1.0f32), (-60, 60), 0.0f32), + ((1.0f32, -1.0f32), (-60, 80), 0.0f32), + ((1.0f32, -1.0f32), (-60, 100), 0.0f32), + ((1.0f32, -1.0f32), (-40, -100), 0.0f32), + ((1.0f32, -1.0f32), (-40, -80), 0.0f32), + ((1.0f32, -1.0f32), (-40, -60), 0.0f32), + ((1.0f32, -1.0f32), (-40, -40), 0.0f32), + ((1.0f32, -1.0f32), (-40, -20), 0.0f32), + ((1.0f32, -1.0f32), (-40, 0), 0.0f32), + ((1.0f32, -1.0f32), (-40, 20), 0.0f32), + ((1.0f32, -1.0f32), (-40, 40), 0.0f32), + ((1.0f32, -1.0f32), (-40, 60), 0.0f32), + ((1.0f32, -1.0f32), (-40, 80), 0.0f32), + ((1.0f32, -1.0f32), (-40, 100), 0.0f32), + ((1.0f32, -1.0f32), (-20, -100), 0.0f32), + ((1.0f32, -1.0f32), (-20, -80), 0.0f32), + ((1.0f32, -1.0f32), (-20, -60), 0.0f32), + ((1.0f32, -1.0f32), (-20, -40), 0.0f32), + ((1.0f32, -1.0f32), (-20, -20), 0.0f32), + ((1.0f32, -1.0f32), (-20, 0), 0.0f32), + ((1.0f32, -1.0f32), (-20, 20), 0.0f32), + ((1.0f32, -1.0f32), (-20, 40), 0.0f32), + ((1.0f32, -1.0f32), (-20, 60), 0.0f32), + ((1.0f32, -1.0f32), (-20, 80), 0.0f32), + ((1.0f32, -1.0f32), (-20, 100), 0.0f32), + ((1.0f32, -1.0f32), (0, -100), 0.0f32), + ((1.0f32, -1.0f32), (0, -80), 0.0f32), + ((1.0f32, -1.0f32), (0, -60), 0.0f32), + ((1.0f32, -1.0f32), (0, -40), 0.0f32), + ((1.0f32, -1.0f32), (0, -20), 0.0f32), + ((1.0f32, -1.0f32), (0, 0), 0.0f32), + ((1.0f32, -1.0f32), (0, 20), 0.0f32), + ((1.0f32, -1.0f32), (0, 40), 0.0f32), + ((1.0f32, -1.0f32), (0, 60), 0.0f32), + ((1.0f32, -1.0f32), (0, 80), 0.0f32), + ((1.0f32, -1.0f32), (0, 100), 0.0f32), + ((1.0f32, -1.0f32), (20, -100), 0.0f32), + ((1.0f32, -1.0f32), (20, -80), 0.0f32), + ((1.0f32, -1.0f32), (20, -60), 0.0f32), + ((1.0f32, -1.0f32), (20, -40), 0.0f32), + ((1.0f32, -1.0f32), (20, -20), 0.0f32), + ((1.0f32, -1.0f32), (20, 0), 0.0f32), + ((1.0f32, -1.0f32), (20, 20), 0.003009146f32), + ((1.0f32, -1.0f32), (20, 40), 0.46935886f32), + ((1.0f32, -1.0f32), (20, 60), 0.0f32), + ((1.0f32, -1.0f32), (20, 80), 0.008314434f32), + ((1.0f32, -1.0f32), (20, 100), 0.05048198f32), + ((1.0f32, -1.0f32), (40, -100), 0.0f32), + ((1.0f32, -1.0f32), (40, -80), 0.0f32), + ((1.0f32, -1.0f32), (40, -60), 0.0f32), + ((1.0f32, -1.0f32), (40, -40), 0.0f32), + ((1.0f32, -1.0f32), (40, -20), 0.0f32), + ((1.0f32, -1.0f32), (40, 0), 0.09909409f32), + ((1.0f32, -1.0f32), (40, 20), 0.62954086f32), + ((1.0f32, -1.0f32), (40, 40), 0.49469623f32), + ((1.0f32, -1.0f32), (40, 60), 0.52327573f32), + ((1.0f32, -1.0f32), (40, 80), 0.62479776f32), + ((1.0f32, -1.0f32), (40, 100), 0.6296996f32), + ((1.0f32, -1.0f32), (60, -100), 0.0f32), + ((1.0f32, -1.0f32), (60, -80), 0.0f32), + ((1.0f32, -1.0f32), (60, -60), 0.0f32), + ((1.0f32, -1.0f32), (60, -40), 0.0f32), + ((1.0f32, -1.0f32), (60, -20), 0.19547126f32), + ((1.0f32, -1.0f32), (60, 0), 0.5242977f32), + ((1.0f32, -1.0f32), (60, 20), 0.525542f32), + ((1.0f32, -1.0f32), (60, 40), 0.26085493f32), + ((1.0f32, -1.0f32), (60, 60), 0.12756069f32), + ((1.0f32, -1.0f32), (60, 80), 0.3568361f32), + ((1.0f32, -1.0f32), (60, 100), 0.56953084f32), + ((1.0f32, -1.0f32), (80, -100), 0.0f32), + ((1.0f32, -1.0f32), (80, -80), 0.0f32), + ((1.0f32, -1.0f32), (80, -60), 0.0f32), + ((1.0f32, -1.0f32), (80, -40), 4.4467743E-6f32), + ((1.0f32, -1.0f32), (80, -20), 0.43135366f32), + ((1.0f32, -1.0f32), (80, 0), 0.60952514f32), + ((1.0f32, -1.0f32), (80, 20), 0.37120965f32), + ((1.0f32, -1.0f32), (80, 40), 0.21463935f32), + ((1.0f32, -1.0f32), (80, 60), 0.18215972f32), + ((1.0f32, -1.0f32), (80, 80), 0.31171802f32), + ((1.0f32, -1.0f32), (80, 100), 0.61589557f32), + ((1.0f32, -1.0f32), (100, -100), 0.0f32), + ((1.0f32, -1.0f32), (100, -80), 0.0f32), + ((1.0f32, -1.0f32), (100, -60), 0.0f32), + ((1.0f32, -1.0f32), (100, -40), 0.0f32), + ((1.0f32, -1.0f32), (100, -20), 0.012854669f32), + ((1.0f32, -1.0f32), (100, 0), 0.42709526f32), + ((1.0f32, -1.0f32), (100, 20), 0.629542f32), + ((1.0f32, -1.0f32), (100, 40), 0.61342824f32), + ((1.0f32, -1.0f32), (100, 60), 0.62247956f32), + ((1.0f32, -1.0f32), (100, 80), 0.54484457f32), + ((1.0f32, -1.0f32), (100, 100), 0.41026905f32), + ((1.0f32, 1.0f32), (-100, -100), 0.297652f32), + ((1.0f32, 1.0f32), (-100, -80), 0.3f32), + ((1.0f32, 1.0f32), (-100, -60), 0.3f32), + ((1.0f32, 1.0f32), (-100, -40), 0.3f32), + ((1.0f32, 1.0f32), (-100, -20), 0.3f32), + ((1.0f32, 1.0f32), (-100, 0), 0.3f32), + ((1.0f32, 1.0f32), (-100, 20), 0.3f32), + ((1.0f32, 1.0f32), (-100, 40), 0.29286346f32), + ((1.0f32, 1.0f32), (-100, 60), 0.21068382f32), + ((1.0f32, 1.0f32), (-100, 80), 0.063217856f32), + ((1.0f32, 1.0f32), (-100, 100), 0.0f32), + ((1.0f32, 1.0f32), (-80, -100), 0.0f32), + ((1.0f32, 1.0f32), (-80, -80), 0.008730456f32), + ((1.0f32, 1.0f32), (-80, -60), 0.15711506f32), + ((1.0f32, 1.0f32), (-80, -40), 0.28587654f32), + ((1.0f32, 1.0f32), (-80, -20), 0.21130508f32), + ((1.0f32, 1.0f32), (-80, 0), 0.29809594f32), + ((1.0f32, 1.0f32), (-80, 20), 0.2206994f32), + ((1.0f32, 1.0f32), (-80, 40), 0.0027657598f32), + ((1.0f32, 1.0f32), (-80, 60), 0.0f32), + ((1.0f32, 1.0f32), (-80, 80), 0.0f32), + ((1.0f32, 1.0f32), (-80, 100), 0.0f32), + ((1.0f32, 1.0f32), (-60, -100), 0.0f32), + ((1.0f32, 1.0f32), (-60, -80), 0.0f32), + ((1.0f32, 1.0f32), (-60, -60), 0.0f32), + ((1.0f32, 1.0f32), (-60, -40), 0.0f32), + ((1.0f32, 1.0f32), (-60, -20), 0.0f32), + ((1.0f32, 1.0f32), (-60, 0), 0.0f32), + ((1.0f32, 1.0f32), (-60, 20), 0.0f32), + ((1.0f32, 1.0f32), (-60, 40), 0.0f32), + ((1.0f32, 1.0f32), (-60, 60), 0.0f32), + ((1.0f32, 1.0f32), (-60, 80), 0.0f32), + ((1.0f32, 1.0f32), (-60, 100), 0.0f32), + ((1.0f32, 1.0f32), (-40, -100), 0.0f32), + ((1.0f32, 1.0f32), (-40, -80), 0.0f32), + ((1.0f32, 1.0f32), (-40, -60), 0.0f32), + ((1.0f32, 1.0f32), (-40, -40), 0.0f32), + ((1.0f32, 1.0f32), (-40, -20), 0.0f32), + ((1.0f32, 1.0f32), (-40, 0), 0.0f32), + ((1.0f32, 1.0f32), (-40, 20), 0.0f32), + ((1.0f32, 1.0f32), (-40, 40), 0.0f32), + ((1.0f32, 1.0f32), (-40, 60), 0.0f32), + ((1.0f32, 1.0f32), (-40, 80), 0.0f32), + ((1.0f32, 1.0f32), (-40, 100), 0.0f32), + ((1.0f32, 1.0f32), (-20, -100), 0.0f32), + ((1.0f32, 1.0f32), (-20, -80), 0.0f32), + ((1.0f32, 1.0f32), (-20, -60), 0.0f32), + ((1.0f32, 1.0f32), (-20, -40), 0.0f32), + ((1.0f32, 1.0f32), (-20, -20), 0.0f32), + ((1.0f32, 1.0f32), (-20, 0), 0.0f32), + ((1.0f32, 1.0f32), (-20, 20), 0.0f32), + ((1.0f32, 1.0f32), (-20, 40), 0.0f32), + ((1.0f32, 1.0f32), (-20, 60), 0.0f32), + ((1.0f32, 1.0f32), (-20, 80), 0.0f32), + ((1.0f32, 1.0f32), (-20, 100), 0.0f32), + ((1.0f32, 1.0f32), (0, -100), 0.0f32), + ((1.0f32, 1.0f32), (0, -80), 0.0f32), + ((1.0f32, 1.0f32), (0, -60), 0.0f32), + ((1.0f32, 1.0f32), (0, -40), 0.0f32), + ((1.0f32, 1.0f32), (0, -20), 0.0f32), + ((1.0f32, 1.0f32), (0, 0), 0.0f32), + ((1.0f32, 1.0f32), (0, 20), 0.0f32), + ((1.0f32, 1.0f32), (0, 40), 0.0f32), + ((1.0f32, 1.0f32), (0, 60), 0.31608355f32), + ((1.0f32, 1.0f32), (0, 80), 0.15622428f32), + ((1.0f32, 1.0f32), (0, 100), 0.0f32), + ((1.0f32, 1.0f32), (20, -100), 0.0f32), + ((1.0f32, 1.0f32), (20, -80), 0.0f32), + ((1.0f32, 1.0f32), (20, -60), 0.0f32), + ((1.0f32, 1.0f32), (20, -40), 0.0f32), + ((1.0f32, 1.0f32), (20, -20), 0.0f32), + ((1.0f32, 1.0f32), (20, 0), 0.0f32), + ((1.0f32, 1.0f32), (20, 20), 0.63f32), + ((1.0f32, 1.0f32), (20, 40), 0.63f32), + ((1.0f32, 1.0f32), (20, 60), 0.40093344f32), + ((1.0f32, 1.0f32), (20, 80), 0.63f32), + ((1.0f32, 1.0f32), (20, 100), 0.63f32), + ((1.0f32, 1.0f32), (40, -100), 0.0f32), + ((1.0f32, 1.0f32), (40, -80), 0.0f32), + ((1.0f32, 1.0f32), (40, -60), 0.0f32), + ((1.0f32, 1.0f32), (40, -40), 0.0f32), + ((1.0f32, 1.0f32), (40, -20), 0.62588596f32), + ((1.0f32, 1.0f32), (40, 0), 0.63f32), + ((1.0f32, 1.0f32), (40, 20), 0.63f32), + ((1.0f32, 1.0f32), (40, 40), 0.63f32), + ((1.0f32, 1.0f32), (40, 60), 0.63f32), + ((1.0f32, 1.0f32), (40, 80), 0.63f32), + ((1.0f32, 1.0f32), (40, 100), 0.63f32), + ((1.0f32, 1.0f32), (60, -100), 0.0f32), + ((1.0f32, 1.0f32), (60, -80), 0.0f32), + ((1.0f32, 1.0f32), (60, -60), 0.0f32), + ((1.0f32, 1.0f32), (60, -40), 0.08376785f32), + ((1.0f32, 1.0f32), (60, -20), 0.63f32), + ((1.0f32, 1.0f32), (60, 0), 0.63f32), + ((1.0f32, 1.0f32), (60, 20), 0.63f32), + ((1.0f32, 1.0f32), (60, 40), 0.63f32), + ((1.0f32, 1.0f32), (60, 60), 0.63f32), + ((1.0f32, 1.0f32), (60, 80), 0.63f32), + ((1.0f32, 1.0f32), (60, 100), 0.63f32), + ((1.0f32, 1.0f32), (80, -100), 0.0f32), + ((1.0f32, 1.0f32), (80, -80), 0.0f32), + ((1.0f32, 1.0f32), (80, -60), 0.01727397f32), + ((1.0f32, 1.0f32), (80, -40), 0.63f32), + ((1.0f32, 1.0f32), (80, -20), 0.63f32), + ((1.0f32, 1.0f32), (80, 0), 0.63f32), + ((1.0f32, 1.0f32), (80, 20), 0.63f32), + ((1.0f32, 1.0f32), (80, 40), 0.63f32), + ((1.0f32, 1.0f32), (80, 60), 0.63f32), + ((1.0f32, 1.0f32), (80, 80), 0.63f32), + ((1.0f32, 1.0f32), (80, 100), 0.63f32), + ((1.0f32, 1.0f32), (100, -100), 0.0f32), + ((1.0f32, 1.0f32), (100, -80), 0.0f32), + ((1.0f32, 1.0f32), (100, -60), 0.0f32), + ((1.0f32, 1.0f32), (100, -40), 0.0f32), + ((1.0f32, 1.0f32), (100, -20), 0.63f32), + ((1.0f32, 1.0f32), (100, 0), 0.63f32), + ((1.0f32, 1.0f32), (100, 20), 0.63f32), + ((1.0f32, 1.0f32), (100, 40), 0.63f32), + ((1.0f32, 1.0f32), (100, 60), 0.63f32), + ((1.0f32, 1.0f32), (100, 80), 0.63f32), + ((1.0f32, 1.0f32), (100, 100), 0.63f32), + ]; + + for ((i, j), (x, z), result) in results { + let spline = create_folded_ridges_spline( + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_ridges_part_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let spline = create_ridges_part_spline( + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + 0.1f32, + FloatAmplifier::Identity, + ); + + let results = [ + ((-100, -100), 0.030000001f32), + ((-100, -80), 0.030000001f32), + ((-100, -60), 0.030000001f32), + ((-100, -40), 0.030000001f32), + ((-100, -20), 0.030000001f32), + ((-100, 0), 0.030000001f32), + ((-100, 20), 0.030000001f32), + ((-100, 40), 0.030000001f32), + ((-100, 60), 0.030000001f32), + ((-100, 80), 0.030000001f32), + ((-100, 100), 0.030000001f32), + ((-80, -100), 0.030000001f32), + ((-80, -80), 0.030000001f32), + ((-80, -60), 0.030000001f32), + ((-80, -40), 0.030000001f32), + ((-80, -20), 0.030000001f32), + ((-80, 0), 0.030000001f32), + ((-80, 20), 0.030000001f32), + ((-80, 40), 0.030000001f32), + ((-80, 60), 0.030000001f32), + ((-80, 80), 0.030000001f32), + ((-80, 100), 0.030000001f32), + ((-60, -100), 0.030000001f32), + ((-60, -80), 0.030000001f32), + ((-60, -60), 0.030000001f32), + ((-60, -40), 0.030000001f32), + ((-60, -20), 0.030000001f32), + ((-60, 0), 0.030000001f32), + ((-60, 20), 0.030000001f32), + ((-60, 40), 0.030000001f32), + ((-60, 60), 0.030000001f32), + ((-60, 80), 0.030000001f32), + ((-60, 100), 0.030000001f32), + ((-40, -100), 0.030000001f32), + ((-40, -80), 0.030000001f32), + ((-40, -60), 0.030000001f32), + ((-40, -40), 0.030000001f32), + ((-40, -20), 0.030000001f32), + ((-40, 0), 0.030000001f32), + ((-40, 20), 0.030000001f32), + ((-40, 40), 0.030000001f32), + ((-40, 60), 0.030000001f32), + ((-40, 80), 0.030000001f32), + ((-40, 100), 0.030000001f32), + ((-20, -100), 0.030000001f32), + ((-20, -80), 0.030000001f32), + ((-20, -60), 0.030000001f32), + ((-20, -40), 0.030000001f32), + ((-20, -20), 0.063f32), + ((-20, 0), 0.063f32), + ((-20, 20), 0.063f32), + ((-20, 40), 0.063f32), + ((-20, 60), 0.063f32), + ((-20, 80), 0.063f32), + ((-20, 100), 0.063f32), + ((0, -100), 0.030000001f32), + ((0, -80), 0.062803626f32), + ((0, -60), 0.063f32), + ((0, -40), 0.063f32), + ((0, -20), 0.063f32), + ((0, 0), 0.063f32), + ((0, 20), 0.063f32), + ((0, 40), 0.063f32), + ((0, 60), 0.063f32), + ((0, 80), 0.063f32), + ((0, 100), 0.063f32), + ((20, -100), 0.063f32), + ((20, -80), 0.063f32), + ((20, -60), 0.063f32), + ((20, -40), 0.063f32), + ((20, -20), 0.063f32), + ((20, 0), 0.063f32), + ((20, 20), 0.063f32), + ((20, 40), 0.063f32), + ((20, 60), 0.063f32), + ((20, 80), 0.063f32), + ((20, 100), 0.063f32), + ((40, -100), 0.063f32), + ((40, -80), 0.063f32), + ((40, -60), 0.063f32), + ((40, -40), 0.063f32), + ((40, -20), 0.063f32), + ((40, 0), 0.063f32), + ((40, 20), 0.063f32), + ((40, 40), 0.063f32), + ((40, 60), 0.063f32), + ((40, 80), 0.063f32), + ((40, 100), 0.063f32), + ((60, -100), 0.063f32), + ((60, -80), 0.063f32), + ((60, -60), 0.063f32), + ((60, -40), 0.063f32), + ((60, -20), 0.063f32), + ((60, 0), 0.063f32), + ((60, 20), 0.063f32), + ((60, 40), 0.063f32), + ((60, 60), 0.063f32), + ((60, 80), 0.063f32), + ((60, 100), 0.063f32), + ((80, -100), 0.063f32), + ((80, -80), 0.063f32), + ((80, -60), 0.063f32), + ((80, -40), 0.063f32), + ((80, -20), 0.063f32), + ((80, 0), 0.063f32), + ((80, 20), 0.063f32), + ((80, 40), 0.063f32), + ((80, 60), 0.063f32), + ((80, 80), 0.063f32), + ((80, 100), 0.063f32), + ((100, -100), 0.063f32), + ((100, -80), 0.063f32), + ((100, -60), 0.063f32), + ((100, -40), 0.063f32), + ((100, -20), 0.063f32), + ((100, 0), 0.063f32), + ((100, 20), 0.063f32), + ((100, 40), 0.063f32), + ((100, 60), 0.063f32), + ((100, 80), 0.063f32), + ((100, 100), 0.063f32), + ]; + + for ((x, z), result) in results { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_eroded_ridges_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let results = [ + ((-1.0f32, -1.0f32), (-1000, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, -800), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, -600), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, -400), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, -200), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 200), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 400), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 600), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 800), 0.0f32), + ((-1.0f32, -1.0f32), (-1000, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (-800, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (-800, -800), 0.0f32), + ((-1.0f32, -1.0f32), (-800, -600), 0.0f32), + ((-1.0f32, -1.0f32), (-800, -400), 0.0f32), + ((-1.0f32, -1.0f32), (-800, -200), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 200), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 400), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 600), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 800), 0.0f32), + ((-1.0f32, -1.0f32), (-800, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (-600, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (-600, -800), 0.0f32), + ((-1.0f32, -1.0f32), (-600, -600), 0.0f32), + ((-1.0f32, -1.0f32), (-600, -400), 0.0f32), + ((-1.0f32, -1.0f32), (-600, -200), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 200), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 400), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 600), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 800), 0.0f32), + ((-1.0f32, -1.0f32), (-600, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (-400, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (-400, -800), 0.0f32), + ((-1.0f32, -1.0f32), (-400, -600), 0.0f32), + ((-1.0f32, -1.0f32), (-400, -400), 0.0f32), + ((-1.0f32, -1.0f32), (-400, -200), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 200), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 400), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 600), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 800), 0.0f32), + ((-1.0f32, -1.0f32), (-400, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (-200, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (-200, -800), 0.0f32), + ((-1.0f32, -1.0f32), (-200, -600), 0.0f32), + ((-1.0f32, -1.0f32), (-200, -400), 0.0f32), + ((-1.0f32, -1.0f32), (-200, -200), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 0), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 200), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 400), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 600), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 800), 0.0f32), + ((-1.0f32, -1.0f32), (-200, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (0, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (0, -800), 0.0f32), + ((-1.0f32, -1.0f32), (0, -600), 0.0f32), + ((-1.0f32, -1.0f32), (0, -400), 0.0f32), + ((-1.0f32, -1.0f32), (0, -200), 0.0f32), + ((-1.0f32, -1.0f32), (0, 0), 0.0f32), + ((-1.0f32, -1.0f32), (0, 200), 0.0f32), + ((-1.0f32, -1.0f32), (0, 400), 0.0f32), + ((-1.0f32, -1.0f32), (0, 600), 0.0f32), + ((-1.0f32, -1.0f32), (0, 800), 0.0f32), + ((-1.0f32, -1.0f32), (0, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (200, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (200, -800), 0.0f32), + ((-1.0f32, -1.0f32), (200, -600), 0.0f32), + ((-1.0f32, -1.0f32), (200, -400), 0.0f32), + ((-1.0f32, -1.0f32), (200, -200), 0.0f32), + ((-1.0f32, -1.0f32), (200, 0), 0.0f32), + ((-1.0f32, -1.0f32), (200, 200), 0.0f32), + ((-1.0f32, -1.0f32), (200, 400), 0.0f32), + ((-1.0f32, -1.0f32), (200, 600), 0.0f32), + ((-1.0f32, -1.0f32), (200, 800), 0.0f32), + ((-1.0f32, -1.0f32), (200, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (400, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (400, -800), 0.0f32), + ((-1.0f32, -1.0f32), (400, -600), 0.0f32), + ((-1.0f32, -1.0f32), (400, -400), 0.0f32), + ((-1.0f32, -1.0f32), (400, -200), 0.0f32), + ((-1.0f32, -1.0f32), (400, 0), 0.0f32), + ((-1.0f32, -1.0f32), (400, 200), 0.0f32), + ((-1.0f32, -1.0f32), (400, 400), 0.0f32), + ((-1.0f32, -1.0f32), (400, 600), 0.0f32), + ((-1.0f32, -1.0f32), (400, 800), 0.0f32), + ((-1.0f32, -1.0f32), (400, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (600, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (600, -800), 0.0f32), + ((-1.0f32, -1.0f32), (600, -600), 0.0f32), + ((-1.0f32, -1.0f32), (600, -400), 0.0f32), + ((-1.0f32, -1.0f32), (600, -200), 0.0f32), + ((-1.0f32, -1.0f32), (600, 0), 0.0f32), + ((-1.0f32, -1.0f32), (600, 200), 0.0f32), + ((-1.0f32, -1.0f32), (600, 400), 0.0f32), + ((-1.0f32, -1.0f32), (600, 600), 0.0f32), + ((-1.0f32, -1.0f32), (600, 800), 0.0f32), + ((-1.0f32, -1.0f32), (600, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (800, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (800, -800), 0.0f32), + ((-1.0f32, -1.0f32), (800, -600), 0.0f32), + ((-1.0f32, -1.0f32), (800, -400), 0.0f32), + ((-1.0f32, -1.0f32), (800, -200), 0.0f32), + ((-1.0f32, -1.0f32), (800, 0), 0.0f32), + ((-1.0f32, -1.0f32), (800, 200), 0.0f32), + ((-1.0f32, -1.0f32), (800, 400), 0.0f32), + ((-1.0f32, -1.0f32), (800, 600), 0.0f32), + ((-1.0f32, -1.0f32), (800, 800), 0.0f32), + ((-1.0f32, -1.0f32), (800, 1000), 0.0f32), + ((-1.0f32, -1.0f32), (1000, -1000), 0.0f32), + ((-1.0f32, -1.0f32), (1000, -800), 0.0f32), + ((-1.0f32, -1.0f32), (1000, -600), 0.0f32), + ((-1.0f32, -1.0f32), (1000, -400), 0.0f32), + ((-1.0f32, -1.0f32), (1000, -200), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 0), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 200), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 400), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 600), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 800), 0.0f32), + ((-1.0f32, -1.0f32), (1000, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, -800), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, -600), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, -400), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, -200), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 200), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 400), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 600), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 800), 0.0f32), + ((-1.0f32, 1.0f32), (-1000, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (-800, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (-800, -800), 0.0f32), + ((-1.0f32, 1.0f32), (-800, -600), 0.0f32), + ((-1.0f32, 1.0f32), (-800, -400), 0.0f32), + ((-1.0f32, 1.0f32), (-800, -200), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 200), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 400), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 600), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 800), 0.0f32), + ((-1.0f32, 1.0f32), (-800, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (-600, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (-600, -800), 0.0f32), + ((-1.0f32, 1.0f32), (-600, -600), 0.0f32), + ((-1.0f32, 1.0f32), (-600, -400), 0.0f32), + ((-1.0f32, 1.0f32), (-600, -200), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 200), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 400), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 600), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 800), 0.0f32), + ((-1.0f32, 1.0f32), (-600, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (-400, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (-400, -800), 0.0f32), + ((-1.0f32, 1.0f32), (-400, -600), 0.0f32), + ((-1.0f32, 1.0f32), (-400, -400), 0.0f32), + ((-1.0f32, 1.0f32), (-400, -200), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 200), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 400), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 600), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 800), 0.0f32), + ((-1.0f32, 1.0f32), (-400, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (-200, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (-200, -800), 0.0f32), + ((-1.0f32, 1.0f32), (-200, -600), 0.0f32), + ((-1.0f32, 1.0f32), (-200, -400), 0.0f32), + ((-1.0f32, 1.0f32), (-200, -200), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 0), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 200), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 400), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 600), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 800), 0.0f32), + ((-1.0f32, 1.0f32), (-200, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (0, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (0, -800), 0.0f32), + ((-1.0f32, 1.0f32), (0, -600), 0.0f32), + ((-1.0f32, 1.0f32), (0, -400), 0.0f32), + ((-1.0f32, 1.0f32), (0, -200), 0.0f32), + ((-1.0f32, 1.0f32), (0, 0), 0.0f32), + ((-1.0f32, 1.0f32), (0, 200), 0.0f32), + ((-1.0f32, 1.0f32), (0, 400), 0.0f32), + ((-1.0f32, 1.0f32), (0, 600), 0.0f32), + ((-1.0f32, 1.0f32), (0, 800), 0.0f32), + ((-1.0f32, 1.0f32), (0, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (200, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (200, -800), 0.0f32), + ((-1.0f32, 1.0f32), (200, -600), 0.0f32), + ((-1.0f32, 1.0f32), (200, -400), 0.0f32), + ((-1.0f32, 1.0f32), (200, -200), 0.0f32), + ((-1.0f32, 1.0f32), (200, 0), 0.0f32), + ((-1.0f32, 1.0f32), (200, 200), 0.0f32), + ((-1.0f32, 1.0f32), (200, 400), 0.0f32), + ((-1.0f32, 1.0f32), (200, 600), 0.0f32), + ((-1.0f32, 1.0f32), (200, 800), 0.0f32), + ((-1.0f32, 1.0f32), (200, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (400, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (400, -800), 0.0f32), + ((-1.0f32, 1.0f32), (400, -600), 0.0f32), + ((-1.0f32, 1.0f32), (400, -400), 0.0f32), + ((-1.0f32, 1.0f32), (400, -200), 0.0f32), + ((-1.0f32, 1.0f32), (400, 0), 0.0f32), + ((-1.0f32, 1.0f32), (400, 200), 0.0f32), + ((-1.0f32, 1.0f32), (400, 400), 0.012229209f32), + ((-1.0f32, 1.0f32), (400, 600), 1.3459583E-5f32), + ((-1.0f32, 1.0f32), (400, 800), 0.0f32), + ((-1.0f32, 1.0f32), (400, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (600, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (600, -800), 0.0f32), + ((-1.0f32, 1.0f32), (600, -600), 0.0f32), + ((-1.0f32, 1.0f32), (600, -400), 0.0f32), + ((-1.0f32, 1.0f32), (600, -200), 0.0f32), + ((-1.0f32, 1.0f32), (600, 0), 0.0f32), + ((-1.0f32, 1.0f32), (600, 200), 0.20826949f32), + ((-1.0f32, 1.0f32), (600, 400), 0.0f32), + ((-1.0f32, 1.0f32), (600, 600), 0.02679144f32), + ((-1.0f32, 1.0f32), (600, 800), 0.0f32), + ((-1.0f32, 1.0f32), (600, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (800, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (800, -800), 0.0f32), + ((-1.0f32, 1.0f32), (800, -600), 0.0f32), + ((-1.0f32, 1.0f32), (800, -400), 0.0f32), + ((-1.0f32, 1.0f32), (800, -200), 0.0f32), + ((-1.0f32, 1.0f32), (800, 0), 0.16502488f32), + ((-1.0f32, 1.0f32), (800, 200), 0.0f32), + ((-1.0f32, 1.0f32), (800, 400), 0.0f32), + ((-1.0f32, 1.0f32), (800, 600), 0.0f32), + ((-1.0f32, 1.0f32), (800, 800), 0.0f32), + ((-1.0f32, 1.0f32), (800, 1000), 0.0f32), + ((-1.0f32, 1.0f32), (1000, -1000), 0.0f32), + ((-1.0f32, 1.0f32), (1000, -800), 0.0f32), + ((-1.0f32, 1.0f32), (1000, -600), 0.0f32), + ((-1.0f32, 1.0f32), (1000, -400), 0.0f32), + ((-1.0f32, 1.0f32), (1000, -200), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 0), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 200), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 400), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 600), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 800), 0.0f32), + ((-1.0f32, 1.0f32), (1000, 1000), 0.0f32), + ((1.0f32, -1.0f32), (-1000, -1000), 0.0f32), + ((1.0f32, -1.0f32), (-1000, -800), 0.0f32), + ((1.0f32, -1.0f32), (-1000, -600), 0.0f32), + ((1.0f32, -1.0f32), (-1000, -400), 0.0f32), + ((1.0f32, -1.0f32), (-1000, -200), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 0), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 200), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 400), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 600), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 800), 0.0f32), + ((1.0f32, -1.0f32), (-1000, 1000), 0.0f32), + ((1.0f32, -1.0f32), (-800, -1000), 0.0f32), + ((1.0f32, -1.0f32), (-800, -800), 0.0f32), + ((1.0f32, -1.0f32), (-800, -600), 0.0f32), + ((1.0f32, -1.0f32), (-800, -400), 0.0f32), + ((1.0f32, -1.0f32), (-800, -200), 0.0f32), + ((1.0f32, -1.0f32), (-800, 0), 0.0f32), + ((1.0f32, -1.0f32), (-800, 200), 0.0f32), + ((1.0f32, -1.0f32), (-800, 400), 0.0f32), + ((1.0f32, -1.0f32), (-800, 600), 0.0f32), + ((1.0f32, -1.0f32), (-800, 800), 0.0f32), + ((1.0f32, -1.0f32), (-800, 1000), 0.0f32), + ((1.0f32, -1.0f32), (-600, -1000), 0.0f32), + ((1.0f32, -1.0f32), (-600, -800), 0.0f32), + ((1.0f32, -1.0f32), (-600, -600), 0.0f32), + ((1.0f32, -1.0f32), (-600, -400), 0.0f32), + ((1.0f32, -1.0f32), (-600, -200), 0.0f32), + ((1.0f32, -1.0f32), (-600, 0), 0.0f32), + ((1.0f32, -1.0f32), (-600, 200), 0.0f32), + ((1.0f32, -1.0f32), (-600, 400), 0.0f32), + ((1.0f32, -1.0f32), (-600, 600), 0.0f32), + ((1.0f32, -1.0f32), (-600, 800), 0.0f32), + ((1.0f32, -1.0f32), (-600, 1000), 0.0f32), + ((1.0f32, -1.0f32), (-400, -1000), 0.0f32), + ((1.0f32, -1.0f32), (-400, -800), 0.0f32), + ((1.0f32, -1.0f32), (-400, -600), 0.0f32), + ((1.0f32, -1.0f32), (-400, -400), 0.0f32), + ((1.0f32, -1.0f32), (-400, -200), 0.0f32), + ((1.0f32, -1.0f32), (-400, 0), 0.0f32), + ((1.0f32, -1.0f32), (-400, 200), 0.0f32), + ((1.0f32, -1.0f32), (-400, 400), 0.0f32), + ((1.0f32, -1.0f32), (-400, 600), 0.0f32), + ((1.0f32, -1.0f32), (-400, 800), 0.0f32), + ((1.0f32, -1.0f32), (-400, 1000), 0.0f32), + ((1.0f32, -1.0f32), (-200, -1000), 0.0f32), + ((1.0f32, -1.0f32), (-200, -800), 0.0f32), + ((1.0f32, -1.0f32), (-200, -600), 0.0f32), + ((1.0f32, -1.0f32), (-200, -400), 0.0f32), + ((1.0f32, -1.0f32), (-200, -200), 0.0f32), + ((1.0f32, -1.0f32), (-200, 0), 0.0f32), + ((1.0f32, -1.0f32), (-200, 200), 0.0f32), + ((1.0f32, -1.0f32), (-200, 400), 0.0f32), + ((1.0f32, -1.0f32), (-200, 600), 0.0f32), + ((1.0f32, -1.0f32), (-200, 800), 0.0f32), + ((1.0f32, -1.0f32), (-200, 1000), 0.0f32), + ((1.0f32, -1.0f32), (0, -1000), 0.0f32), + ((1.0f32, -1.0f32), (0, -800), 0.0f32), + ((1.0f32, -1.0f32), (0, -600), 0.0f32), + ((1.0f32, -1.0f32), (0, -400), 0.0f32), + ((1.0f32, -1.0f32), (0, -200), 0.0f32), + ((1.0f32, -1.0f32), (0, 0), 0.0f32), + ((1.0f32, -1.0f32), (0, 200), 0.0f32), + ((1.0f32, -1.0f32), (0, 400), 0.0f32), + ((1.0f32, -1.0f32), (0, 600), 0.0f32), + ((1.0f32, -1.0f32), (0, 800), 0.0f32), + ((1.0f32, -1.0f32), (0, 1000), 0.0f32), + ((1.0f32, -1.0f32), (200, -1000), 0.0f32), + ((1.0f32, -1.0f32), (200, -800), 0.0f32), + ((1.0f32, -1.0f32), (200, -600), 0.0f32), + ((1.0f32, -1.0f32), (200, -400), 0.0f32), + ((1.0f32, -1.0f32), (200, -200), 0.0f32), + ((1.0f32, -1.0f32), (200, 0), 0.0f32), + ((1.0f32, -1.0f32), (200, 200), 0.0f32), + ((1.0f32, -1.0f32), (200, 400), 0.0f32), + ((1.0f32, -1.0f32), (200, 600), 0.0f32), + ((1.0f32, -1.0f32), (200, 800), 0.0f32), + ((1.0f32, -1.0f32), (200, 1000), 0.0038900226f32), + ((1.0f32, -1.0f32), (400, -1000), 0.0f32), + ((1.0f32, -1.0f32), (400, -800), 0.0f32), + ((1.0f32, -1.0f32), (400, -600), 0.0f32), + ((1.0f32, -1.0f32), (400, -400), 0.0f32), + ((1.0f32, -1.0f32), (400, -200), 0.0f32), + ((1.0f32, -1.0f32), (400, 0), 0.0f32), + ((1.0f32, -1.0f32), (400, 200), 0.0f32), + ((1.0f32, -1.0f32), (400, 400), 0.1930701f32), + ((1.0f32, -1.0f32), (400, 600), 0.11269083f32), + ((1.0f32, -1.0f32), (400, 800), 0.0f32), + ((1.0f32, -1.0f32), (400, 1000), 0.0f32), + ((1.0f32, -1.0f32), (600, -1000), 0.0f32), + ((1.0f32, -1.0f32), (600, -800), 0.0f32), + ((1.0f32, -1.0f32), (600, -600), 0.0f32), + ((1.0f32, -1.0f32), (600, -400), 0.0f32), + ((1.0f32, -1.0f32), (600, -200), 0.0f32), + ((1.0f32, -1.0f32), (600, 0), 0.0f32), + ((1.0f32, -1.0f32), (600, 200), 4.689248E-5f32), + ((1.0f32, -1.0f32), (600, 400), 0.0f32), + ((1.0f32, -1.0f32), (600, 600), 0.008269365f32), + ((1.0f32, -1.0f32), (600, 800), 0.0f32), + ((1.0f32, -1.0f32), (600, 1000), 0.0f32), + ((1.0f32, -1.0f32), (800, -1000), 0.0f32), + ((1.0f32, -1.0f32), (800, -800), 0.0f32), + ((1.0f32, -1.0f32), (800, -600), 0.0f32), + ((1.0f32, -1.0f32), (800, -400), 0.0f32), + ((1.0f32, -1.0f32), (800, -200), 0.0f32), + ((1.0f32, -1.0f32), (800, 0), 0.34966952f32), + ((1.0f32, -1.0f32), (800, 200), 0.0f32), + ((1.0f32, -1.0f32), (800, 400), 0.0f32), + ((1.0f32, -1.0f32), (800, 600), 0.0f32), + ((1.0f32, -1.0f32), (800, 800), 0.0f32), + ((1.0f32, -1.0f32), (800, 1000), 0.0f32), + ((1.0f32, -1.0f32), (1000, -1000), 0.0f32), + ((1.0f32, -1.0f32), (1000, -800), 0.0f32), + ((1.0f32, -1.0f32), (1000, -600), 0.0f32), + ((1.0f32, -1.0f32), (1000, -400), 0.0f32), + ((1.0f32, -1.0f32), (1000, -200), 0.0f32), + ((1.0f32, -1.0f32), (1000, 0), 0.0f32), + ((1.0f32, -1.0f32), (1000, 200), 0.0f32), + ((1.0f32, -1.0f32), (1000, 400), 0.0f32), + ((1.0f32, -1.0f32), (1000, 600), 0.0f32), + ((1.0f32, -1.0f32), (1000, 800), 0.18537328f32), + ((1.0f32, -1.0f32), (1000, 1000), 0.0f32), + ((1.0f32, 1.0f32), (-1000, -1000), 0.0f32), + ((1.0f32, 1.0f32), (-1000, -800), 0.0f32), + ((1.0f32, 1.0f32), (-1000, -600), 0.0f32), + ((1.0f32, 1.0f32), (-1000, -400), 0.0f32), + ((1.0f32, 1.0f32), (-1000, -200), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 0), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 200), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 400), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 600), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 800), 0.0f32), + ((1.0f32, 1.0f32), (-1000, 1000), 0.0f32), + ((1.0f32, 1.0f32), (-800, -1000), 0.0f32), + ((1.0f32, 1.0f32), (-800, -800), 0.0f32), + ((1.0f32, 1.0f32), (-800, -600), 0.0f32), + ((1.0f32, 1.0f32), (-800, -400), 0.0f32), + ((1.0f32, 1.0f32), (-800, -200), 0.0f32), + ((1.0f32, 1.0f32), (-800, 0), 0.0f32), + ((1.0f32, 1.0f32), (-800, 200), 0.0f32), + ((1.0f32, 1.0f32), (-800, 400), 0.0f32), + ((1.0f32, 1.0f32), (-800, 600), 0.0f32), + ((1.0f32, 1.0f32), (-800, 800), 0.0f32), + ((1.0f32, 1.0f32), (-800, 1000), 0.0f32), + ((1.0f32, 1.0f32), (-600, -1000), 0.0f32), + ((1.0f32, 1.0f32), (-600, -800), 0.0f32), + ((1.0f32, 1.0f32), (-600, -600), 0.0f32), + ((1.0f32, 1.0f32), (-600, -400), 0.0f32), + ((1.0f32, 1.0f32), (-600, -200), 0.0f32), + ((1.0f32, 1.0f32), (-600, 0), 0.0f32), + ((1.0f32, 1.0f32), (-600, 200), 0.0f32), + ((1.0f32, 1.0f32), (-600, 400), 0.0f32), + ((1.0f32, 1.0f32), (-600, 600), 0.0f32), + ((1.0f32, 1.0f32), (-600, 800), 0.0f32), + ((1.0f32, 1.0f32), (-600, 1000), 0.0f32), + ((1.0f32, 1.0f32), (-400, -1000), 0.0f32), + ((1.0f32, 1.0f32), (-400, -800), 0.0f32), + ((1.0f32, 1.0f32), (-400, -600), 0.0f32), + ((1.0f32, 1.0f32), (-400, -400), 0.0f32), + ((1.0f32, 1.0f32), (-400, -200), 0.0f32), + ((1.0f32, 1.0f32), (-400, 0), 0.0f32), + ((1.0f32, 1.0f32), (-400, 200), 0.0f32), + ((1.0f32, 1.0f32), (-400, 400), 0.0f32), + ((1.0f32, 1.0f32), (-400, 600), 0.0f32), + ((1.0f32, 1.0f32), (-400, 800), 0.0f32), + ((1.0f32, 1.0f32), (-400, 1000), 0.0f32), + ((1.0f32, 1.0f32), (-200, -1000), 0.0f32), + ((1.0f32, 1.0f32), (-200, -800), 0.0f32), + ((1.0f32, 1.0f32), (-200, -600), 0.0f32), + ((1.0f32, 1.0f32), (-200, -400), 0.0f32), + ((1.0f32, 1.0f32), (-200, -200), 0.0f32), + ((1.0f32, 1.0f32), (-200, 0), 0.0f32), + ((1.0f32, 1.0f32), (-200, 200), 0.0f32), + ((1.0f32, 1.0f32), (-200, 400), 0.0f32), + ((1.0f32, 1.0f32), (-200, 600), 0.0f32), + ((1.0f32, 1.0f32), (-200, 800), 0.0f32), + ((1.0f32, 1.0f32), (-200, 1000), 0.0f32), + ((1.0f32, 1.0f32), (0, -1000), 0.0f32), + ((1.0f32, 1.0f32), (0, -800), 0.0f32), + ((1.0f32, 1.0f32), (0, -600), 0.0f32), + ((1.0f32, 1.0f32), (0, -400), 0.0f32), + ((1.0f32, 1.0f32), (0, -200), 0.0f32), + ((1.0f32, 1.0f32), (0, 0), 0.0f32), + ((1.0f32, 1.0f32), (0, 200), 0.0f32), + ((1.0f32, 1.0f32), (0, 400), 0.0f32), + ((1.0f32, 1.0f32), (0, 600), 0.0f32), + ((1.0f32, 1.0f32), (0, 800), 0.0f32), + ((1.0f32, 1.0f32), (0, 1000), 0.0f32), + ((1.0f32, 1.0f32), (200, -1000), 0.0f32), + ((1.0f32, 1.0f32), (200, -800), 0.0f32), + ((1.0f32, 1.0f32), (200, -600), 0.0f32), + ((1.0f32, 1.0f32), (200, -400), 0.0f32), + ((1.0f32, 1.0f32), (200, -200), 0.0f32), + ((1.0f32, 1.0f32), (200, 0), 0.0f32), + ((1.0f32, 1.0f32), (200, 200), 0.0f32), + ((1.0f32, 1.0f32), (200, 400), 0.0f32), + ((1.0f32, 1.0f32), (200, 600), 0.0f32), + ((1.0f32, 1.0f32), (200, 800), 0.0f32), + ((1.0f32, 1.0f32), (200, 1000), 0.0038900226f32), + ((1.0f32, 1.0f32), (400, -1000), 0.0f32), + ((1.0f32, 1.0f32), (400, -800), 0.0f32), + ((1.0f32, 1.0f32), (400, -600), 0.0f32), + ((1.0f32, 1.0f32), (400, -400), 0.0f32), + ((1.0f32, 1.0f32), (400, -200), 0.0f32), + ((1.0f32, 1.0f32), (400, 0), 0.0f32), + ((1.0f32, 1.0f32), (400, 200), 0.0f32), + ((1.0f32, 1.0f32), (400, 400), 0.20529935f32), + ((1.0f32, 1.0f32), (400, 600), 0.11270429f32), + ((1.0f32, 1.0f32), (400, 800), 0.0f32), + ((1.0f32, 1.0f32), (400, 1000), 0.0f32), + ((1.0f32, 1.0f32), (600, -1000), 0.0f32), + ((1.0f32, 1.0f32), (600, -800), 0.0f32), + ((1.0f32, 1.0f32), (600, -600), 0.0f32), + ((1.0f32, 1.0f32), (600, -400), 0.0f32), + ((1.0f32, 1.0f32), (600, -200), 0.0f32), + ((1.0f32, 1.0f32), (600, 0), 0.0f32), + ((1.0f32, 1.0f32), (600, 200), 0.20831639f32), + ((1.0f32, 1.0f32), (600, 400), 0.0f32), + ((1.0f32, 1.0f32), (600, 600), 0.035060797f32), + ((1.0f32, 1.0f32), (600, 800), 0.0f32), + ((1.0f32, 1.0f32), (600, 1000), 0.0f32), + ((1.0f32, 1.0f32), (800, -1000), 0.0f32), + ((1.0f32, 1.0f32), (800, -800), 0.0f32), + ((1.0f32, 1.0f32), (800, -600), 0.0f32), + ((1.0f32, 1.0f32), (800, -400), 0.0f32), + ((1.0f32, 1.0f32), (800, -200), 0.0f32), + ((1.0f32, 1.0f32), (800, 0), 0.5146944f32), + ((1.0f32, 1.0f32), (800, 200), 0.0f32), + ((1.0f32, 1.0f32), (800, 400), 0.0f32), + ((1.0f32, 1.0f32), (800, 600), 0.0f32), + ((1.0f32, 1.0f32), (800, 800), 0.0f32), + ((1.0f32, 1.0f32), (800, 1000), 0.0f32), + ((1.0f32, 1.0f32), (1000, -1000), 0.0f32), + ((1.0f32, 1.0f32), (1000, -800), 0.0f32), + ((1.0f32, 1.0f32), (1000, -600), 0.0f32), + ((1.0f32, 1.0f32), (1000, -400), 0.0f32), + ((1.0f32, 1.0f32), (1000, -200), 0.0f32), + ((1.0f32, 1.0f32), (1000, 0), 0.0f32), + ((1.0f32, 1.0f32), (1000, 200), 0.0f32), + ((1.0f32, 1.0f32), (1000, 400), 0.0f32), + ((1.0f32, 1.0f32), (1000, 600), 0.0f32), + ((1.0f32, 1.0f32), (1000, 800), 0.18537328f32), + ((1.0f32, 1.0f32), (1000, 1000), 0.0f32), + ]; + + for ((i, j), (x, z), result) in results { + let spline = create_eroded_ridges_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + j, + i, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_continental_offset_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let results = [ + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ]; + + for ((i, j, k, l, m, n), (x, z), result) in results { + let spline = create_continental_offset_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + k, + l, + m, + n, + true, + true, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + + let results = [ + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.043868598f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199959f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.47096622f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ]; + + for ((i, j, k, l, m, n), (x, z), result) in results { + let spline = create_continental_offset_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + k, + l, + m, + n, + false, + true, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + + let results = [ + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ]; + + for ((i, j, k, l, m, n), (x, z), result) in results { + let spline = create_continental_offset_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + k, + l, + m, + n, + true, + false, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + + let results = [ + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (-1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -1.0040534f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1310996f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1351529f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.6898031f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + 0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.51958543f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.78766453f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.42596012f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.8736998f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + -0.9794922f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.35584128f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + -0.9767942f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -1.0f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + -0.98354554f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.5485881f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.93069726f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + -0.58472735f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + -1.1105918f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.465841f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + -0.56152153f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.83679414f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + -1.1146451f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.122376435f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.87450993f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1146451f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1105918f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 0.98354554f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 0.9794922f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + -0.4380532f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.853009f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.17856482f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + -0.9207117f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + -0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 0.6898031f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 0), + -0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (0, 1000), + -0.08574474f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + -0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 0), + -0.05308062f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + -0.17199956f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 0), + 0.56152153f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, -1000), + 1.1351529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, -1000), + 0.38430876f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 0), + 0.58472735f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (-1000, 1000), + -0.9021386f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, -1000), + 1.1310996f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 0), + -0.12501879f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, -1000), + 0.91990167f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 0), + 0.9767942f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, -1000), + 1.0040534f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, -1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, -1000), + 0.5480529f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 0), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (-1000, 1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, -1000), + 1.0f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 0), + 0.8495294f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (0, 1000), + 0.59859234f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, -1000), + 0.97689915f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 0), + 0.4723193f32, + ), + ( + (1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32, 1.0f32), + (1000, 1000), + 0.65087116f32, + ), + ]; + + for ((i, j, k, l, m, n), (x, z), result) in results { + let spline = create_continental_offset_spline( + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + i, + j, + k, + l, + m, + n, + false, + false, + FloatAmplifier::Identity, + ); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), result); + } + } + + #[test] + fn test_create_offset_spline_owned() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = OwnedConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let spline = create_offset_spline( + CONTINENTS_OVERWORLD.clone(), + EROSION_OVERWORLD.clone(), + RIDGES_FOLDED_OVERWORLD.clone(), + false, + ); + + let func_ref: SharedComponentReference = + SplineFunction::::new(spline.into()).into(); + let mut converted = func_ref.convert_to_dyn(&mut converter); + + let values = [ + ((-1000, -1000), -0.12f32), + ((-1000, -800), -0.12f32), + ((-1000, -600), 0.21642008f32), + ((-1000, -400), 0.01f32), + ((-1000, -200), 0.004557855f32), + ((-1000, 0), 0.01f32), + ((-1000, 200), 0.009997683f32), + ((-1000, 400), 0.026355354f32), + ((-1000, 600), 0.007802739f32), + ((-1000, 800), -0.12f32), + ((-1000, 1000), -0.001604938f32), + ((-800, -1000), -0.12f32), + ((-800, -800), -0.012429481f32), + ((-800, -600), 0.0015399398f32), + ((-800, -400), 0.010565798f32), + ((-800, -200), 0.0085737575f32), + ((-800, 0), 2.0498858E-4f32), + ((-800, 200), 0.059694663f32), + ((-800, 400), 0.005873039f32), + ((-800, 600), -0.0037780532f32), + ((-800, 800), 0.1453951f32), + ((-800, 1000), -0.12f32), + ((-600, -1000), 0.06484584f32), + ((-600, -800), 0.0044598696f32), + ((-600, -600), 0.010014304f32), + ((-600, -400), -0.044046972f32), + ((-600, -200), 0.003978624f32), + ((-600, 0), -0.0364713f32), + ((-600, 200), 0.14794901f32), + ((-600, 400), 0.018754544f32), + ((-600, 600), 0.045433506f32), + ((-600, 800), 0.0047304784f32), + ((-600, 1000), -0.08921682f32), + ((-400, -1000), 0.35670424f32), + ((-400, -800), 0.010680163f32), + ((-400, -600), 0.024394374f32), + ((-400, -400), -0.07180046f32), + ((-400, -200), -0.0046629338f32), + ((-400, 0), 0.041712783f32), + ((-400, 200), 0.42516303f32), + ((-400, 400), -0.016010465f32), + ((-400, 600), -0.054500334f32), + ((-400, 800), 0.03915234f32), + ((-400, 1000), 0.11074094f32), + ((-200, -1000), 0.010157828f32), + ((-200, -800), -0.045935497f32), + ((-200, -600), -0.06370152f32), + ((-200, -400), -0.010669484f32), + ((-200, -200), 0.007693166f32), + ((-200, 0), 0.2740575f32), + ((-200, 200), 0.25065988f32), + ((-200, 400), 0.23743957f32), + ((-200, 600), 0.038222533f32), + ((-200, 800), 0.23740187f32), + ((-200, 1000), 0.045121815f32), + ((0, -1000), 0.025613945f32), + ((0, -800), 0.010543518f32), + ((0, -600), -0.009503379f32), + ((0, -400), -0.05679583f32), + ((0, -200), 0.014229352f32), + ((0, 0), 0.015351922f32), + ((0, 200), 0.052398924f32), + ((0, 400), 0.3348988f32), + ((0, 600), 0.037273783f32), + ((0, 800), 0.15397507f32), + ((0, 1000), -0.12f32), + ((200, -1000), 0.011213763f32), + ((200, -800), 0.010004221f32), + ((200, -600), 0.014950525f32), + ((200, -400), 0.0060791634f32), + ((200, -200), 0.0051073986f32), + ((200, 0), 0.21087551f32), + ((200, 200), 0.18799084f32), + ((200, 400), 0.10954257f32), + ((200, 600), 0.15038633f32), + ((200, 800), -0.20215355f32), + ((200, 1000), 0.006606252f32), + ((400, -1000), -0.060982484f32), + ((400, -800), -0.036393903f32), + ((400, -600), 0.0014582938f32), + ((400, -400), -0.04869196f32), + ((400, -200), 0.30029622f32), + ((400, 0), 0.20263676f32), + ((400, 200), 0.22583991f32), + ((400, 400), 0.5766444f32), + ((400, 600), 0.064524874f32), + ((400, 800), 0.001492043f32), + ((400, 1000), 0.0666899f32), + ((600, -1000), 0.042593893f32), + ((600, -800), 0.011076624f32), + ((600, -600), -0.07617872f32), + ((600, -400), 0.33489174f32), + ((600, -200), 0.19499643f32), + ((600, 0), 0.12718138f32), + ((600, 200), 0.42322046f32), + ((600, 400), 0.15204243f32), + ((600, 600), 0.62875843f32), + ((600, 800), 0.28533196f32), + ((600, 1000), 0.112939574f32), + ((800, -1000), -0.005106967f32), + ((800, -800), 0.004147144f32), + ((800, -600), 0.033886474f32), + ((800, -400), 0.3707387f32), + ((800, -200), 0.23363632f32), + ((800, 0), 0.6662116f32), + ((800, 200), 0.1378678f32), + ((800, 400), -0.040576354f32), + ((800, 600), 0.117314756f32), + ((800, 800), 0.08826091f32), + ((800, 1000), 0.16682401f32), + ((1000, -1000), -0.09812155f32), + ((1000, -800), 0.12626381f32), + ((1000, -600), 0.13974974f32), + ((1000, -400), 0.19341275f32), + ((1000, -200), 0.26667717f32), + ((1000, 0), 0.2554746f32), + ((1000, 200), 0.19757578f32), + ((1000, 400), 0.18204813f32), + ((1000, 600), -0.12f32), + ((1000, 800), 0.09942525f32), + ((1000, 1000), -0.20376506f32), + ]; + + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(converted.sample_mut(pos, &FakeEnvironment {}), value as f64); + } + } + + #[test] + fn test_create_offset_spline() { + let mut rand = LegacyRand::from_seed(0); + let deriver = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(deriver), + }; + + let spline = create_offset_spline( + CONTINENTS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + false, + ); + + let values = [ + ((-1000, -1000), -0.12f32), + ((-1000, -800), -0.12f32), + ((-1000, -600), 0.21642008f32), + ((-1000, -400), 0.01f32), + ((-1000, -200), 0.004557855f32), + ((-1000, 0), 0.01f32), + ((-1000, 200), 0.009997683f32), + ((-1000, 400), 0.026355354f32), + ((-1000, 600), 0.007802739f32), + ((-1000, 800), -0.12f32), + ((-1000, 1000), -0.001604938f32), + ((-800, -1000), -0.12f32), + ((-800, -800), -0.012429481f32), + ((-800, -600), 0.0015399398f32), + ((-800, -400), 0.010565798f32), + ((-800, -200), 0.0085737575f32), + ((-800, 0), 2.0498858E-4f32), + ((-800, 200), 0.059694663f32), + ((-800, 400), 0.005873039f32), + ((-800, 600), -0.0037780532f32), + ((-800, 800), 0.1453951f32), + ((-800, 1000), -0.12f32), + ((-600, -1000), 0.06484584f32), + ((-600, -800), 0.0044598696f32), + ((-600, -600), 0.010014304f32), + ((-600, -400), -0.044046972f32), + ((-600, -200), 0.003978624f32), + ((-600, 0), -0.0364713f32), + ((-600, 200), 0.14794901f32), + ((-600, 400), 0.018754544f32), + ((-600, 600), 0.045433506f32), + ((-600, 800), 0.0047304784f32), + ((-600, 1000), -0.08921682f32), + ((-400, -1000), 0.35670424f32), + ((-400, -800), 0.010680163f32), + ((-400, -600), 0.024394374f32), + ((-400, -400), -0.07180046f32), + ((-400, -200), -0.0046629338f32), + ((-400, 0), 0.041712783f32), + ((-400, 200), 0.42516303f32), + ((-400, 400), -0.016010465f32), + ((-400, 600), -0.054500334f32), + ((-400, 800), 0.03915234f32), + ((-400, 1000), 0.11074094f32), + ((-200, -1000), 0.010157828f32), + ((-200, -800), -0.045935497f32), + ((-200, -600), -0.06370152f32), + ((-200, -400), -0.010669484f32), + ((-200, -200), 0.007693166f32), + ((-200, 0), 0.2740575f32), + ((-200, 200), 0.25065988f32), + ((-200, 400), 0.23743957f32), + ((-200, 600), 0.038222533f32), + ((-200, 800), 0.23740187f32), + ((-200, 1000), 0.045121815f32), + ((0, -1000), 0.025613945f32), + ((0, -800), 0.010543518f32), + ((0, -600), -0.009503379f32), + ((0, -400), -0.05679583f32), + ((0, -200), 0.014229352f32), + ((0, 0), 0.015351922f32), + ((0, 200), 0.052398924f32), + ((0, 400), 0.3348988f32), + ((0, 600), 0.037273783f32), + ((0, 800), 0.15397507f32), + ((0, 1000), -0.12f32), + ((200, -1000), 0.011213763f32), + ((200, -800), 0.010004221f32), + ((200, -600), 0.014950525f32), + ((200, -400), 0.0060791634f32), + ((200, -200), 0.0051073986f32), + ((200, 0), 0.21087551f32), + ((200, 200), 0.18799084f32), + ((200, 400), 0.10954257f32), + ((200, 600), 0.15038633f32), + ((200, 800), -0.20215355f32), + ((200, 1000), 0.006606252f32), + ((400, -1000), -0.060982484f32), + ((400, -800), -0.036393903f32), + ((400, -600), 0.0014582938f32), + ((400, -400), -0.04869196f32), + ((400, -200), 0.30029622f32), + ((400, 0), 0.20263676f32), + ((400, 200), 0.22583991f32), + ((400, 400), 0.5766444f32), + ((400, 600), 0.064524874f32), + ((400, 800), 0.001492043f32), + ((400, 1000), 0.0666899f32), + ((600, -1000), 0.042593893f32), + ((600, -800), 0.011076624f32), + ((600, -600), -0.07617872f32), + ((600, -400), 0.33489174f32), + ((600, -200), 0.19499643f32), + ((600, 0), 0.12718138f32), + ((600, 200), 0.42322046f32), + ((600, 400), 0.15204243f32), + ((600, 600), 0.62875843f32), + ((600, 800), 0.28533196f32), + ((600, 1000), 0.112939574f32), + ((800, -1000), -0.005106967f32), + ((800, -800), 0.004147144f32), + ((800, -600), 0.033886474f32), + ((800, -400), 0.3707387f32), + ((800, -200), 0.23363632f32), + ((800, 0), 0.6662116f32), + ((800, 200), 0.1378678f32), + ((800, 400), -0.040576354f32), + ((800, 600), 0.117314756f32), + ((800, 800), 0.08826091f32), + ((800, 1000), 0.16682401f32), + ((1000, -1000), -0.09812155f32), + ((1000, -800), 0.12626381f32), + ((1000, -600), 0.13974974f32), + ((1000, -400), 0.19341275f32), + ((1000, -200), 0.26667717f32), + ((1000, 0), 0.2554746f32), + ((1000, 200), 0.19757578f32), + ((1000, 400), 0.18204813f32), + ((1000, 600), -0.12f32), + ((1000, 800), 0.09942525f32), + ((1000, 1000), -0.20376506f32), + ]; + + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), value); + } + + let spline = create_offset_spline( + CONTINENTS_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + RIDGES_FOLDED_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(), + true, + ); + + let values = [ + ((-1000, -1000), -0.12f32), + ((-1000, -800), -0.12f32), + ((-1000, -600), 0.40646723f32), + ((-1000, -400), 0.02f32), + ((-1000, -200), 0.011649819f32), + ((-1000, 0), 0.02f32), + ((-1000, 200), 0.019997103f32), + ((-1000, 400), 0.054926828f32), + ((-1000, 600), 0.0161799f32), + ((-1000, 800), -0.12f32), + ((-1000, 1000), -0.001604938f32), + ((-800, -1000), -0.12f32), + ((-800, -800), -0.009731578f32), + ((-800, -600), 0.008272511f32), + ((-800, -400), 0.02010726f32), + ((-800, -200), 0.017626597f32), + ((-800, 0), 0.0039240704f32), + ((-800, 200), 0.12954348f32), + ((-800, 400), 0.013576008f32), + ((-800, 600), 5.68838E-4f32), + ((-800, 800), 0.31590718f32), + ((-800, 1000), -0.12f32), + ((-600, -1000), 0.12946187f32), + ((-600, -800), 0.0120871635f32), + ((-600, -600), 0.019976187f32), + ((-600, -400), -0.043153357f32), + ((-600, -200), 0.01147486f32), + ((-600, 0), -0.03608053f32), + ((-600, 200), 0.32358822f32), + ((-600, 400), 0.038205504f32), + ((-600, 600), 0.09575883f32), + ((-600, 800), 0.0087937f32), + ((-600, 1000), -0.08919823f32), + ((-400, -1000), 0.68852895f32), + ((-400, -800), 0.02136095f32), + ((-400, -600), 0.05210319f32), + ((-400, -400), -0.07174147f32), + ((-400, -200), -1.782187E-4f32), + ((-400, 0), 0.08275533f32), + ((-400, 200), 0.8391089f32), + ((-400, 400), 0.015925307f32), + ((-400, 600), -0.05179032f32), + ((-400, 800), 0.080548115f32), + ((-400, 1000), 0.2183966f32), + ((-200, -1000), 0.019721974f32), + ((-200, -800), -0.044857025f32), + ((-200, -600), -0.0632717f32), + ((-200, -400), -0.0071803415f32), + ((-200, -200), 0.016522845f32), + ((-200, 0), 0.5790978f32), + ((-200, 200), 0.48663375f32), + ((-200, 400), 0.4579222f32), + ((-200, 600), 0.07735475f32), + ((-200, 800), 0.46947122f32), + ((-200, 1000), 0.09024363f32), + ((0, -1000), 0.05332743f32), + ((0, -800), 0.021054735f32), + ((0, -600), -0.0060041896f32), + ((0, -400), -0.056453f32), + ((0, -200), 0.028670382f32), + ((0, 0), 0.031875737f32), + ((0, 200), 0.1057405f32), + ((0, 400), 0.6566899f32), + ((0, 600), 0.078629725f32), + ((0, 800), 0.30936983f32), + ((0, 1000), -0.12f32), + ((200, -1000), 0.01984784f32), + ((200, -800), 0.020003142f32), + ((200, -600), 0.030099068f32), + ((200, -400), 0.014725439f32), + ((200, -200), 0.04267062f32), + ((200, 0), 0.4335333f32), + ((200, 200), 0.41353047f32), + ((200, 400), 0.28182158f32), + ((200, 600), 0.3194872f32), + ((200, 800), -0.19964206f32), + ((200, 1000), 0.013215651f32), + ((400, -1000), -0.06075418f32), + ((400, -800), -0.035268508f32), + ((400, -600), 0.008122481f32), + ((400, -400), -0.04745455f32), + ((400, -200), 0.6001307f32), + ((400, 0), 0.44305244f32), + ((400, 200), 0.4961017f32), + ((400, 400), 1.1597066f32), + ((400, 600), 0.13732544f32), + ((400, 800), 0.0033238232f32), + ((400, 1000), 0.13391209f32), + ((600, -1000), 0.08317007f32), + ((600, -800), 0.02169337f32), + ((600, -600), -0.07605565f32), + ((600, -400), 0.6699571f32), + ((600, -200), 0.43031088f32), + ((600, 0), 0.2863704f32), + ((600, 200), 0.8479774f32), + ((600, 400), 0.33766848f32), + ((600, 600), 1.2939436f32), + ((600, 800), 0.5734297f32), + ((600, 1000), 0.23295875f32), + ((800, -1000), -0.0016568054f32), + ((800, -800), 0.0118271075f32), + ((800, -600), 0.116723984f32), + ((800, -400), 0.748354f32), + ((800, -200), 0.5145798f32), + ((800, 0), 1.3620454f32), + ((800, 200), 0.3075331f32), + ((800, 400), -0.0031769574f32), + ((800, 600), 0.25992817f32), + ((800, 800), 0.19284995f32), + ((800, 1000), 0.33883432f32), + ((1000, -1000), -0.09807106f32), + ((1000, -800), 0.265128f32), + ((1000, -600), 0.31908166f32), + ((1000, -400), 0.3983419f32), + ((1000, -200), 0.5943536f32), + ((1000, 0), 0.5574826f32), + ((1000, 200), 0.39628267f32), + ((1000, 400), 0.40190077f32), + ((1000, 600), -0.12f32), + ((1000, 800), 0.21975446f32), + ((1000, 1000), -0.20376506f32), + ]; - assert_eq!(spline.apply(&pos), -0.1f32); + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(spline.sample(pos), value); + } } } diff --git a/pumpkin-world/src/world_gen/noise/density/unary.rs b/pumpkin-world/src/world_gen/noise/density/unary.rs index 143ab1a20..8baa9bd8d 100644 --- a/pumpkin-world/src/world_gen/noise/density/unary.rs +++ b/pumpkin-world/src/world_gen/noise/density/unary.rs @@ -1,52 +1,134 @@ -use std::sync::Arc; +use std::marker::PhantomData; use super::{ - Applier, DensityFunction, DensityFunctionImpl, NoisePos, UnaryDensityFunction, Visitor, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + NoEnvironment, OwnedConverterEnvironment, SharedComponentReference, + SharedConverterEnvironment, + }, + NoisePos, }; #[derive(Clone)] -pub struct ClampFunction<'a> { - pub(crate) input: Arc>, +pub(crate) struct ClampUntypedData { pub(crate) min: f64, pub(crate) max: f64, } -impl<'a> UnaryDensityFunction<'a> for ClampFunction<'a> { +impl> From> + for MutableComponentReference +{ + fn from(value: ClampFunction) -> Self { + Self(Box::new(value)) + } +} + +pub struct ClampFunction> { + pub(crate) input: R, + pub(crate) data: ClampUntypedData, + _dummy: PhantomData, +} + +impl> ClampFunction { + pub fn new(input: R, min: f64, max: f64) -> Self { + Self { + input, + data: ClampUntypedData { min, max }, + _dummy: PhantomData:: {}, + } + } + #[inline] fn apply_density(&self, density: f64) -> f64 { - density.clamp(self.min, self.max) + density.clamp(self.data.min, self.data.max) + } + + pub fn create_new_ref( + input: ComponentReferenceImplementation, + data: &ClampUntypedData, + ) -> ComponentReferenceImplementation { + match input { + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + ClampFunction::::new( + shared, data.min, data.max, + ) + .into(), + ) + } + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable( + ClampFunction::new(owned, data.min, data.max).into(), + ) + } + } } } -impl<'a> DensityFunctionImpl<'a> for ClampFunction<'a> { - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - Arc::new(DensityFunction::Clamp(ClampFunction { - input: self.input.apply(visitor), - min: self.min, - max: self.max, - })) +impl> ComponentFunctionImpl + for ClampFunction +{ +} + +impl> MutableComponentFunctionImpl + for ClampFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density = self.input.sample_mut(pos, env); + self.apply_density(density) } - fn sample(&self, pos: &NoisePos) -> f64 { - self.apply_density(self.input.sample(pos)) + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.input.fill_mut(arr, applier); + arr.iter_mut() + .for_each(|density| *density = self.apply_density(*density)); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Clamp(&self.input, &self.data) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier); - densities.iter_mut().for_each(|val| { - *val = self.apply_density(*val); - }); + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Clamp(self.input.wrapped_ref(), self.data) } - fn min(&self) -> f64 { - self.min + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.convert(converter), &self.data) } - fn max(&self) -> f64 { - self.max + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.clone_to_new_ref(), &self.data) } } -#[derive(Clone)] +impl ImmutableComponentFunctionImpl + for ClampFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + let density = self.input.sample(pos); + self.apply_density(density) + } + + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.input.fill(arr, applier); + arr.iter_mut() + .for_each(|density| *density = self.apply_density(*density)); + } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Clamp(&self.input, &self.data) + } +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub(crate) enum UnaryType { Abs, Square, @@ -56,37 +138,32 @@ pub(crate) enum UnaryType { Squeeze, } -#[derive(Clone)] -pub struct UnaryFunction<'a> { - action: UnaryType, - input: Arc>, - min: f64, - max: f64, +pub struct UnaryFunction> { + pub(crate) unary_type: UnaryType, + pub(crate) input: R, + _dummy: PhantomData, +} + +impl> From> + for MutableComponentReference +{ + fn from(value: UnaryFunction) -> Self { + Self(Box::new(value)) + } } -impl<'a> UnaryFunction<'a> { - pub(crate) fn create(action: UnaryType, input: Arc>) -> UnaryFunction { - let base_min = input.min(); - let new_min = Self::internal_apply(&action, base_min); - let new_max = Self::internal_apply(&action, input.max()); - match action { - UnaryType::Abs | UnaryType::Square => Self { - action, - input, - min: f64::max(0f64, base_min), - max: f64::max(new_min, new_max), - }, - _ => Self { - action, - input, - min: new_min, - max: new_max, - }, +impl> UnaryFunction { + pub fn new(unary_type: UnaryType, input: R) -> Self { + Self { + unary_type, + input, + _dummy: PhantomData:: {}, } } - fn internal_apply(action: &UnaryType, density: f64) -> f64 { - match action { + #[inline] + fn apply_density(&self, density: f64) -> f64 { + match self.unary_type { UnaryType::Abs => density.abs(), UnaryType::Square => density * density, UnaryType::Cube => density * density * density, @@ -110,36 +187,83 @@ impl<'a> UnaryFunction<'a> { } } } -} -impl<'a> UnaryDensityFunction<'a> for UnaryFunction<'a> { - fn apply_density(&self, density: f64) -> f64 { - Self::internal_apply(&self.action, density) + pub fn create_new_ref( + input: ComponentReferenceImplementation, + action: UnaryType, + ) -> ComponentReferenceImplementation { + match input { + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + UnaryFunction::::new(action, shared) + .into(), + ) + } + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable(UnaryFunction::new(action, owned).into()) + } + } } } -impl<'a> DensityFunctionImpl<'a> for UnaryFunction<'a> { - fn sample(&self, pos: &NoisePos) -> f64 { - self.apply_density(self.input.sample(pos)) +impl> ComponentFunctionImpl + for UnaryFunction +{ +} + +impl> MutableComponentFunctionImpl + for UnaryFunction +{ + #[inline] + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density = self.input.sample_mut(pos, env); + self.apply_density(density) + } + + #[inline] + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.input.fill_mut(arr, applier); + arr.iter_mut() + .for_each(|density| *density = self.apply_density(*density)); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Unary(&self.input, self.unary_type) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier); - densities.iter_mut().for_each(|val| { - *val = self.apply_density(*val); - }); + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Unary(self.input.wrapped_ref(), self.unary_type) } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - let raw = Self::create(self.action.clone(), self.input.apply(visitor)); - Arc::new(DensityFunction::Unary(raw)) + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.convert(converter), self.unary_type) + } + + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref(self.input.clone_to_new_ref(), self.unary_type) + } +} + +impl ImmutableComponentFunctionImpl + for UnaryFunction +{ + #[inline] + fn sample(&self, pos: &NoisePos) -> f64 { + let density = self.input.sample(pos); + self.apply_density(density) } - fn max(&self) -> f64 { - self.max + #[inline] + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.input.fill(arr, applier); + arr.iter_mut() + .for_each(|density| *density = self.apply_density(*density)); } - fn min(&self) -> f64 { - self.min + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Unary(&self.input, self.unary_type) } } diff --git a/pumpkin-world/src/world_gen/noise/density/weird.rs b/pumpkin-world/src/world_gen/noise/density/weird.rs index 84664474f..44a3255aa 100644 --- a/pumpkin-world/src/world_gen/noise/density/weird.rs +++ b/pumpkin-world/src/world_gen/noise/density/weird.rs @@ -1,11 +1,18 @@ -use std::sync::Arc; +use std::{hash::Hash, marker::PhantomData, sync::Arc}; use super::{ - noise::InternalNoise, Applier, ApplierImpl, DensityFunction, DensityFunctionImpl, NoisePos, - NoisePosImpl, Visitor, VisitorImpl, + component_functions::{ + ApplierImpl, ComponentFunctionImpl, ComponentReference, ComponentReferenceImplementation, + ConverterEnvironment, ConverterImpl, DensityFunctionEnvironment, EnvironmentApplierImpl, + ImmutableComponentFunctionImpl, MutableComponentFunctionImpl, MutableComponentReference, + NoEnvironment, OwnedConverterEnvironment, SharedComponentReference, + SharedConverterEnvironment, + }, + noise::InternalNoise, + NoisePos, NoisePosImpl, }; -#[derive(Clone)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub enum RarityMapper { Tunnels, Caves, @@ -41,7 +48,7 @@ impl RarityMapper { 0.75f64 } else if value < 0.5f64 { 1f64 - } else if value < 0.75 { + } else if value < 0.75f64 { 2f64 } else { 3f64 @@ -51,23 +58,28 @@ impl RarityMapper { } } -#[derive(Clone)] -pub struct WierdScaledFunction<'a> { - input: Arc>, - noise: Arc>, - rarity: RarityMapper, +pub struct WierdScaledFunction> { + pub(crate) input: R, + pub(crate) noise: Arc, + pub(crate) rarity: RarityMapper, + _dummy: PhantomData, } -impl<'a> WierdScaledFunction<'a> { - pub fn new( - input: Arc>, - noise: Arc>, - rarity: RarityMapper, - ) -> Self { +impl> From> + for MutableComponentReference +{ + fn from(value: WierdScaledFunction) -> Self { + Self(Box::new(value)) + } +} + +impl> WierdScaledFunction { + pub fn new(input: R, noise: Arc, rarity: RarityMapper) -> Self { Self { input, noise, rarity, + _dummy: PhantomData:: {}, } } @@ -78,33 +90,96 @@ impl<'a> WierdScaledFunction<'a> { .sample(pos.x() as f64 / d, pos.y() as f64 / d, pos.z() as f64 / d) .abs() } + + pub fn create_new_ref( + input: ComponentReferenceImplementation, + noise: Arc, + rarity: RarityMapper, + ) -> ComponentReferenceImplementation { + match input { + ComponentReferenceImplementation::Mutable(owned) => { + ComponentReferenceImplementation::Mutable( + WierdScaledFunction::new(owned, noise, rarity).into(), + ) + } + ComponentReferenceImplementation::Shared(shared) => { + ComponentReferenceImplementation::Shared( + WierdScaledFunction::::new( + shared, noise, rarity, + ) + .into(), + ) + } + } + } +} + +impl> ComponentFunctionImpl + for WierdScaledFunction +{ } -impl<'a> DensityFunctionImpl<'a> for WierdScaledFunction<'a> { - fn max(&self) -> f64 { - self.rarity.max_multiplier() * self.noise.max_value() +impl> MutableComponentFunctionImpl + for WierdScaledFunction +{ + fn sample_mut(&mut self, pos: &NoisePos, env: &E) -> f64 { + let density = self.input.sample_mut(pos, env); + self.apply_loc(pos, density) } - fn min(&self) -> f64 { - 0f64 + fn fill_mut(&mut self, arr: &mut [f64], applier: &mut dyn EnvironmentApplierImpl) { + self.input.fill_mut(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, val)| { + *val = self.apply_loc(&applier.at(i), *val); + }); + } + + fn environment(&self) -> ConverterEnvironment { + ConverterEnvironment::Wierd(&self.input, &self.noise, self.rarity) + } + + fn into_environment(self: Box) -> OwnedConverterEnvironment { + OwnedConverterEnvironment::Wierd(self.input.wrapped_ref(), self.noise, self.rarity) } - fn apply(&self, visitor: &Visitor<'a>) -> Arc> { - visitor.apply(Arc::new(DensityFunction::Wierd(WierdScaledFunction { - input: self.input.apply(visitor), - noise: visitor.apply_internal_noise(self.noise.clone()), - rarity: self.rarity.clone(), - }))) + fn convert( + self: Box, + converter: &mut dyn ConverterImpl, + ) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.input.convert(converter), + converter + .convert_noise(&self.noise) + .unwrap_or_else(|| self.noise.clone()), + self.rarity, + ) } + fn clone_to_new_ref(&self) -> ComponentReferenceImplementation { + Self::create_new_ref( + self.input.clone_to_new_ref(), + self.noise.clone(), + self.rarity, + ) + } +} + +impl ImmutableComponentFunctionImpl + for WierdScaledFunction +{ fn sample(&self, pos: &NoisePos) -> f64 { - self.apply_loc(pos, self.input.sample(pos)) + let density = self.input.sample(pos); + self.apply_loc(pos, density) } - fn fill(&self, densities: &mut [f64], applier: &Applier<'a>) { - self.input.fill(densities, applier); - densities.iter_mut().enumerate().for_each(|(i, val)| { + fn fill(&self, arr: &mut [f64], applier: &mut dyn ApplierImpl) { + self.input.fill(arr, applier); + arr.iter_mut().enumerate().for_each(|(i, val)| { *val = self.apply_loc(&applier.at(i), *val); }); } + + fn shared_environment(&self) -> SharedConverterEnvironment { + SharedConverterEnvironment::Wierd(&self.input, &self.noise, self.rarity) + } } diff --git a/pumpkin-world/src/world_gen/noise/mod.rs b/pumpkin-world/src/world_gen/noise/mod.rs index 72d009204..ee0c42abc 100644 --- a/pumpkin-world/src/world_gen/noise/mod.rs +++ b/pumpkin-world/src/world_gen/noise/mod.rs @@ -1,188 +1,194 @@ -use derive_getters::Getters; use num_traits::Float; -use perlin::DoublePerlinNoiseParameters; +pub mod config; pub mod density; pub mod perlin; -mod router; +pub mod router; mod simplex; -#[derive(Getters)] -pub struct BuiltInNoiseParams<'a> { - temperature: DoublePerlinNoiseParameters<'a>, - vegetation: DoublePerlinNoiseParameters<'a>, - continentalness: DoublePerlinNoiseParameters<'a>, - erosion: DoublePerlinNoiseParameters<'a>, - temperature_large: DoublePerlinNoiseParameters<'a>, - vegetation_large: DoublePerlinNoiseParameters<'a>, - continentalness_large: DoublePerlinNoiseParameters<'a>, - erosion_large: DoublePerlinNoiseParameters<'a>, - ridge: DoublePerlinNoiseParameters<'a>, - offset: DoublePerlinNoiseParameters<'a>, - aquifer_barrier: DoublePerlinNoiseParameters<'a>, - aquifer_fluid_level_floodedness: DoublePerlinNoiseParameters<'a>, - aquifer_lava: DoublePerlinNoiseParameters<'a>, - aquifer_fluid_level_spread: DoublePerlinNoiseParameters<'a>, - pillar: DoublePerlinNoiseParameters<'a>, - pillar_rareness: DoublePerlinNoiseParameters<'a>, - pillar_thickness: DoublePerlinNoiseParameters<'a>, - spaghetti_2d: DoublePerlinNoiseParameters<'a>, - spaghetti_2d_elevation: DoublePerlinNoiseParameters<'a>, - spaghetti_2d_modulator: DoublePerlinNoiseParameters<'a>, - spaghetti_2d_thickness: DoublePerlinNoiseParameters<'a>, - spaghetti_3d_1: DoublePerlinNoiseParameters<'a>, - spaghetti_3d_2: DoublePerlinNoiseParameters<'a>, - spaghetti_3d_rarity: DoublePerlinNoiseParameters<'a>, - spaghetti_3d_thickness: DoublePerlinNoiseParameters<'a>, - spaghetti_roughness: DoublePerlinNoiseParameters<'a>, - spaghetti_roughness_modulator: DoublePerlinNoiseParameters<'a>, - cave_entrance: DoublePerlinNoiseParameters<'a>, - cave_layer: DoublePerlinNoiseParameters<'a>, - cave_cheese: DoublePerlinNoiseParameters<'a>, - ore_veininess: DoublePerlinNoiseParameters<'a>, - ore_vein_a: DoublePerlinNoiseParameters<'a>, - ore_vein_b: DoublePerlinNoiseParameters<'a>, - ore_gap: DoublePerlinNoiseParameters<'a>, - noodle: DoublePerlinNoiseParameters<'a>, - noodle_thickness: DoublePerlinNoiseParameters<'a>, - noodle_ridge_a: DoublePerlinNoiseParameters<'a>, - noodle_ridge_b: DoublePerlinNoiseParameters<'a>, - jagged: DoublePerlinNoiseParameters<'a>, - surface: DoublePerlinNoiseParameters<'a>, - surface_secondary: DoublePerlinNoiseParameters<'a>, - clay_bands_offset: DoublePerlinNoiseParameters<'a>, - badlands_pillar: DoublePerlinNoiseParameters<'a>, - badlands_pillar_roof: DoublePerlinNoiseParameters<'a>, - badlands_surface: DoublePerlinNoiseParameters<'a>, - iceberg_pillar: DoublePerlinNoiseParameters<'a>, - iceberg_pillar_roof: DoublePerlinNoiseParameters<'a>, - iceberg_surface: DoublePerlinNoiseParameters<'a>, - surface_swamp: DoublePerlinNoiseParameters<'a>, - calcite: DoublePerlinNoiseParameters<'a>, - gravel: DoublePerlinNoiseParameters<'a>, - powder_snow: DoublePerlinNoiseParameters<'a>, - packed_ice: DoublePerlinNoiseParameters<'a>, - ice: DoublePerlinNoiseParameters<'a>, - soul_sand_layer: DoublePerlinNoiseParameters<'a>, - gravel_layer: DoublePerlinNoiseParameters<'a>, - patch: DoublePerlinNoiseParameters<'a>, - netherrack: DoublePerlinNoiseParameters<'a>, - nether_wart: DoublePerlinNoiseParameters<'a>, - nether_state_selector: DoublePerlinNoiseParameters<'a>, -} +pub mod built_in_noise_params { + use super::perlin::DoublePerlinNoiseParameters; -impl<'a> BuiltInNoiseParams<'a> { - pub fn new() -> Self { - Self { - temperature: DoublePerlinNoiseParameters::new( - -10, - &[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64], - ), - vegetation: DoublePerlinNoiseParameters::new(-8, &[1f64, 1f64, 0f64, 0f64, 0f64, 0f64]), - continentalness: DoublePerlinNoiseParameters::new( - -9, - &[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64], - ), + pub const TEMPERATURE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -10, + &[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64], + "minecraft:temperature", + ); + pub const VEGETATION: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -8, + &[1f64, 1f64, 0f64, 0f64, 0f64, 0f64], + "minecraft:vegetation", + ); + pub const CONTINENTALNESS: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -9, + &[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64], + "minecraft:continentalness", + ); + pub const EROSION: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-9, &[1f64, 1f64, 0f64, 1f64, 1f64], "minecraft:erosion"); + pub const TEMPERATURE_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -12, + &[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64], + "minecraft:temperature_large", + ); + pub const VEGETATION_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -10, + &[1f64, 1f64, 0f64, 0f64, 0f64, 0f64], + "minecraft:vegetation_large", + ); + pub const CONTINENTALNESS_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -11, + &[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64], + "minecraft:continentalness_large", + ); + pub const EROSION_LARGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -11, + &[1f64, 1f64, 0f64, 1f64, 1f64], + "minecraft:erosion_large", + ); + pub const RIDGE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -7, + &[1f64, 2f64, 1f64, 0f64, 0f64, 0f64], + "minecraft:ridge", + ); + pub const OFFSET: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-3, &[1f64, 1f64, 1f64, 0f64], "minecraft:offset"); + pub const AQUIFER_BARRIER: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-3, &[1f64], "minecraft:aquifer_barrier"); + pub const AQUIFER_FLUID_LEVEL_FLOODEDNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:aquifer_fluid_level_floodedness"); + pub const AQUIFER_LAVA: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-1, &[1f64], "minecraft:aquifer_lava"); + pub const AQUIFER_FLUID_LEVEL_SPREAD: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:aquifer_fluid_level_spread"); + pub const PILLAR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64; 2], "minecraft:pillar"); + pub const PILLAR_RARENESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:pillar_rareness"); + pub const PILLAR_THICKNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:pillar_thickness"); + pub const SPAGHETTI_2D: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_2d"); + pub const SPAGHETTI_2D_ELEVATION: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_2d_elevation"); + pub const SPAGHETTI_2D_MODULATOR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_2d_modulator"); + pub const SPAGHETTI_2D_THICKNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_2d_thickness"); + pub const SPAGHETTI_3D_1: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_3d_1"); + pub const SPAGHETTI_3D_2: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:spaghetti_3d_2"); + pub const SPAGHETTI_3D_RARITY: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-11, &[1f64], "minecraft:spaghetti_3d_rarity"); + pub const SPAGHETTI_3D_THICKNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_3d_thickness"); + pub const SPAGHETTI_ROUGHNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:spaghetti_roughness"); + pub const SPAGHETTI_ROUGHNESS_MODULATOR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:spaghetti_roughness_modulator"); + pub const CAVE_ENTRANCE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[0.4f64, 0.5f64, 1f64], "minecraft:cave_entrance"); + pub const CAVE_LAYER: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:cave_layer"); + pub const CAVE_CHEESE: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -8, + &[0.5f64, 1f64, 2f64, 1f64, 2f64, 1f64, 0f64, 2f64, 0f64], + "minecraft:cave_cheese", + ); + pub const ORE_VEININESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:ore_veininess"); - erosion: DoublePerlinNoiseParameters::new(-9, &[1f64, 1f64, 0f64, 1f64, 1f64]), - temperature_large: DoublePerlinNoiseParameters::new( - -12, - &[1.5f64, 0f64, 1f64, 0f64, 0f64, 0f64], - ), - vegetation_large: DoublePerlinNoiseParameters::new( - -10, - &[1f64, 1f64, 0f64, 0f64, 0f64, 0f64], - ), - continentalness_large: DoublePerlinNoiseParameters::new( - -11, - &[1f64, 1f64, 2f64, 2f64, 2f64, 1f64, 1f64, 1f64, 1f64], - ), - erosion_large: DoublePerlinNoiseParameters::new(-11, &[1f64, 1f64, 0f64, 1f64, 1f64]), - ridge: DoublePerlinNoiseParameters::new(-7, &[1f64, 2f64, 1f64, 0f64, 0f64, 0f64]), - offset: DoublePerlinNoiseParameters::new(-3, &[1f64; 4]), - aquifer_barrier: DoublePerlinNoiseParameters::new(-3, &[1f64]), - aquifer_fluid_level_floodedness: DoublePerlinNoiseParameters::new(-7, &[1f64]), - aquifer_lava: DoublePerlinNoiseParameters::new(-1, &[1f64]), - aquifer_fluid_level_spread: DoublePerlinNoiseParameters::new(-5, &[1f64]), - pillar: DoublePerlinNoiseParameters::new(-7, &[1f64; 2]), - pillar_rareness: DoublePerlinNoiseParameters::new(-8, &[1f64]), - pillar_thickness: DoublePerlinNoiseParameters::new(-8, &[1f64]), - spaghetti_2d: DoublePerlinNoiseParameters::new(-7, &[1f64]), - spaghetti_2d_elevation: DoublePerlinNoiseParameters::new(-8, &[1f64]), - spaghetti_2d_modulator: DoublePerlinNoiseParameters::new(-11, &[1f64]), - spaghetti_2d_thickness: DoublePerlinNoiseParameters::new(-11, &[1f64]), - spaghetti_3d_1: DoublePerlinNoiseParameters::new(-7, &[1f64]), - spaghetti_3d_2: DoublePerlinNoiseParameters::new(-7, &[1f64]), - spaghetti_3d_rarity: DoublePerlinNoiseParameters::new(-11, &[1f64]), - spaghetti_3d_thickness: DoublePerlinNoiseParameters::new(-8, &[1f64]), - spaghetti_roughness: DoublePerlinNoiseParameters::new(-5, &[1f64]), - spaghetti_roughness_modulator: DoublePerlinNoiseParameters::new(-8, &[1f64]), - cave_entrance: DoublePerlinNoiseParameters::new(-7, &[0.4f64, 0.5f64, 1f64]), - cave_layer: DoublePerlinNoiseParameters::new(-8, &[1f64]), - cave_cheese: DoublePerlinNoiseParameters::new( - -8, - &[0.5f64, 1f64, 2f64, 1f64, 2f64, 1f64, 0f64, 2f64, 0f64], - ), - ore_veininess: DoublePerlinNoiseParameters::new(-8, &[1f64]), - ore_vein_a: DoublePerlinNoiseParameters::new(-7, &[1f64]), - ore_vein_b: DoublePerlinNoiseParameters::new(-7, &[1f64]), - ore_gap: DoublePerlinNoiseParameters::new(-5, &[1f64]), - noodle: DoublePerlinNoiseParameters::new(-8, &[1f64]), - noodle_thickness: DoublePerlinNoiseParameters::new(-8, &[1f64]), - noodle_ridge_a: DoublePerlinNoiseParameters::new(-7, &[1f64]), - noodle_ridge_b: DoublePerlinNoiseParameters::new(-7, &[1f64]), - jagged: DoublePerlinNoiseParameters::new(-16, &[1f64; 16]), - surface: DoublePerlinNoiseParameters::new(-6, &[1f64; 3]), - surface_secondary: DoublePerlinNoiseParameters::new(-6, &[1f64, 1f64, 0f64, 1f64]), - clay_bands_offset: DoublePerlinNoiseParameters::new(-8, &[1f64]), - badlands_pillar: DoublePerlinNoiseParameters::new(-2, &[1f64; 4]), - badlands_pillar_roof: DoublePerlinNoiseParameters::new(-8, &[1f64]), - badlands_surface: DoublePerlinNoiseParameters::new(-6, &[1f64; 3]), - iceberg_pillar: DoublePerlinNoiseParameters::new(-6, &[1f64; 4]), - iceberg_pillar_roof: DoublePerlinNoiseParameters::new(-3, &[1f64]), - iceberg_surface: DoublePerlinNoiseParameters::new(-6, &[1f64; 3]), - surface_swamp: DoublePerlinNoiseParameters::new(-2, &[1f64]), - calcite: DoublePerlinNoiseParameters::new(-9, &[1f64; 4]), - gravel: DoublePerlinNoiseParameters::new(-8, &[1f64; 4]), - powder_snow: DoublePerlinNoiseParameters::new(-6, &[1f64; 4]), - packed_ice: DoublePerlinNoiseParameters::new(-7, &[1f64; 4]), - ice: DoublePerlinNoiseParameters::new(-4, &[1f64; 4]), - soul_sand_layer: DoublePerlinNoiseParameters::new( - -8, - &[ - 1f64, - 1f64, - 1f64, - 1f64, - 0f64, - 0f64, - 0f64, - 0f64, - 0.013333333333333334f64, - ], - ), - gravel_layer: DoublePerlinNoiseParameters::new( - -8, - &[ - 1f64, - 1f64, - 1f64, - 1f64, - 0f64, - 0f64, - 0f64, - 0f64, - 0.013333333333333334f64, - ], - ), - patch: DoublePerlinNoiseParameters::new( - -5, - &[1f64, 0f64, 0f64, 0f64, 0f64, 0.013333333333333334f64], - ), - netherrack: DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.35f64]), - nether_wart: DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.9f64]), - nether_state_selector: DoublePerlinNoiseParameters::new(-4, &[1f64]), - } - } + pub const ORE_VEIN_A: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:ore_vein_a"); + pub const ORE_VEIN_B: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:ore_vein_b"); + pub const ORE_GAP: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-5, &[1f64], "minecraft:ore_gap"); + pub const NOODLE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:noodle"); + pub const NOODLE_THICKNESS: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:noodle_thickness"); + pub const NOODLE_RIDGE_A: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:noodle_ridge_a"); + pub const NOODLE_RIDGE_B: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64], "minecraft:noodle_ridge_b"); + + pub const JAGGED: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-16, &[1f64; 16], "minecraft:jagged"); + pub const SURFACE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:surface"); + pub const SURFACE_SECONDARY: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -6, + &[1f64, 1f64, 0f64, 1f64], + "minecraft:surface_secondary", + ); + pub const CLAY_BANDS_OFFSET: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:clay_bands_offset"); + pub const BADLANDS_PILLAR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-2, &[1f64; 4], "minecraft:badlands_pillar"); + pub const BADLANDS_PILLAR_ROOF: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64], "minecraft:badlands_pillar_roof"); + pub const BADLANDS_SURFACE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:badlands_surface"); + pub const ICEBERG_PILLAR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-6, &[1f64; 4], "minecraft:iceberg_pillar"); + pub const ICEBERG_PILLAR_ROOF: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-3, &[1f64], "minecraft:iceberg_pillar_roof"); + pub const ICEBERG_SURFACE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-6, &[1f64; 3], "minecraft:iceberg_surface"); + pub const SURFACE_SWAMP: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-2, &[1f64], "minecraft:surface_swamp"); + pub const CALCITE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-9, &[1f64; 4], "minecraft:calcite"); + pub const GRAVEL: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-8, &[1f64; 4], "minecraft:gravel"); + pub const POWDER_SNOW: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-6, &[1f64; 4], "minecraft:powder_snow"); + pub const PACKED_ICE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-7, &[1f64; 4], "minecraft:packed_ice"); + pub const ICE: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-4, &[1f64; 4], "minecraft:ice"); + pub const SOUL_SAND_LAYER: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -8, + &[ + 1f64, + 1f64, + 1f64, + 1f64, + 0f64, + 0f64, + 0f64, + 0f64, + 0.013333333333333334f64, + ], + "minecraft:soul_sand_layer", + ); + pub const GRAVEL_LAYER: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -8, + &[ + 1f64, + 1f64, + 1f64, + 1f64, + 0f64, + 0f64, + 0f64, + 0f64, + 0.013333333333333334f64, + ], + "minecraft:gravel_layer", + ); + pub const PATCH: DoublePerlinNoiseParameters = DoublePerlinNoiseParameters::new( + -5, + &[1f64, 0f64, 0f64, 0f64, 0f64, 0.013333333333333334f64], + "minecraft:patch", + ); + pub const NETHERRACK: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.35f64], "minecraft:netherrack"); + pub const NETHER_WART: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-3, &[1f64, 0f64, 0f64, 0.9f64], "minecraft:nether_wart"); + pub const NETHER_STATE_SELECTOR: DoublePerlinNoiseParameters = + DoublePerlinNoiseParameters::new(-4, &[1f64], "minecraft:nether_state_selector"); } pub fn lerp(delta: T, start: T, end: T) -> T @@ -192,7 +198,10 @@ where start + delta * (end - start) } -pub fn lerp_progress(value: f64, start: f64, end: f64) -> f64 { +pub fn lerp_progress(value: T, start: T, end: T) -> T +where + T: Float, +{ (value - start) / (end - start) } @@ -210,6 +219,13 @@ pub fn clamped_map(value: f64, old_start: f64, old_end: f64, new_start: f64, new clamped_lerp(new_start, new_end, lerp_progress(value, old_start, old_end)) } +pub fn map(value: T, old_start: T, old_end: T, new_start: T, new_end: T) -> T +where + T: Float, +{ + lerp(lerp_progress(value, old_start, old_end), new_start, new_end) +} + pub fn lerp2(delta_x: f64, delta_y: f64, x0y0: f64, x1y0: f64, x0y1: f64, x1y1: f64) -> f64 { lerp( delta_y, @@ -240,30 +256,97 @@ pub fn lerp3( } struct Gradient { - x: i32, - y: i32, - z: i32, + x: f64, + y: f64, + z: f64, } const GRADIENTS: [Gradient; 16] = [ - Gradient { x: 1, y: 1, z: 0 }, - Gradient { x: -1, y: 1, z: 0 }, - Gradient { x: 1, y: -1, z: 0 }, - Gradient { x: -1, y: -1, z: 0 }, - Gradient { x: 1, y: 0, z: 1 }, - Gradient { x: -1, y: 0, z: 1 }, - Gradient { x: 1, y: 0, z: -1 }, - Gradient { x: -1, y: 0, z: -1 }, - Gradient { x: 0, y: 1, z: 1 }, - Gradient { x: 0, y: -1, z: 1 }, - Gradient { x: 0, y: 1, z: -1 }, - Gradient { x: 0, y: -1, z: -1 }, - Gradient { x: 1, y: 1, z: 0 }, - Gradient { x: 0, y: -1, z: 1 }, - Gradient { x: -1, y: 1, z: 0 }, - Gradient { x: 0, y: -1, z: -1 }, + Gradient { + x: 1f64, + y: 1f64, + z: 0f64, + }, + Gradient { + x: -1f64, + y: 1f64, + z: 0f64, + }, + Gradient { + x: 1f64, + y: -1f64, + z: 0f64, + }, + Gradient { + x: -1f64, + y: -1f64, + z: 0f64, + }, + Gradient { + x: 1f64, + y: 0f64, + z: 1f64, + }, + Gradient { + x: -1f64, + y: 0f64, + z: 1f64, + }, + Gradient { + x: 1f64, + y: 0f64, + z: -1f64, + }, + Gradient { + x: -1f64, + y: 0f64, + z: -1f64, + }, + Gradient { + x: 0f64, + y: 1f64, + z: 1f64, + }, + Gradient { + x: 0f64, + y: -1f64, + z: 1f64, + }, + Gradient { + x: 0f64, + y: 1f64, + z: -1f64, + }, + Gradient { + x: 0f64, + y: -1f64, + z: -1f64, + }, + Gradient { + x: 1f64, + y: 1f64, + z: 0f64, + }, + Gradient { + x: 0f64, + y: -1f64, + z: 1f64, + }, + Gradient { + x: -1f64, + y: 1f64, + z: 0f64, + }, + Gradient { + x: 0f64, + y: -1f64, + z: -1f64, + }, ]; -fn dot(gradient: &Gradient, x: f64, y: f64, z: f64) -> f64 { - (gradient.z as f64).mul_add(z, (gradient.x as f64).mul_add(x, gradient.y as f64 * y)) +impl Gradient { + #[inline] + fn dot(&self, x: f64, y: f64, z: f64) -> f64 { + self.x * x + self.y * y + self.z * z + } } diff --git a/pumpkin-world/src/world_gen/noise/perlin.rs b/pumpkin-world/src/world_gen/noise/perlin.rs index 7d9527831..54494d8c6 100644 --- a/pumpkin-world/src/world_gen/noise/perlin.rs +++ b/pumpkin-world/src/world_gen/noise/perlin.rs @@ -1,8 +1,9 @@ -use itertools::Itertools; -use num_traits::{Pow, Zero}; -use pumpkin_core::random::{RandomDeriverImpl, RandomGenerator, RandomImpl}; +use std::{hash::Hash, sync::Arc}; -use super::{dot, lerp3, GRADIENTS}; +use num_traits::{Pow, ToBytes}; +use pumpkin_core::random::RandomGenerator; + +use super::{lerp3, GRADIENTS}; pub struct PerlinNoiseSampler { permutation: Box<[u8]>, @@ -11,8 +12,26 @@ pub struct PerlinNoiseSampler { z_origin: f64, } +impl PartialEq for PerlinNoiseSampler { + fn eq(&self, other: &Self) -> bool { + self.permutation == other.permutation + && self.x_origin.to_le_bytes() == other.x_origin.to_le_bytes() + && self.y_origin.to_le_bytes() == other.y_origin.to_le_bytes() + && self.z_origin.to_le_bytes() == other.z_origin.to_le_bytes() + } +} + +impl Hash for PerlinNoiseSampler { + fn hash(&self, state: &mut H) { + self.permutation.hash(state); + self.x_origin.to_le_bytes().hash(state); + self.y_origin.to_le_bytes().hash(state); + self.z_origin.to_le_bytes().hash(state); + } +} + impl PerlinNoiseSampler { - pub fn new(random: &mut impl RandomImpl) -> Self { + pub fn new(random: &mut RandomGenerator) -> Self { let x_origin = random.next_f64() * 256f64; let y_origin = random.next_f64() * 256f64; let z_origin = random.next_f64() * 256f64; @@ -46,13 +65,13 @@ impl PerlinNoiseSampler { let trans_y = y + self.y_origin; let trans_z = z + self.z_origin; - let x_int = trans_x.floor() as i32; - let y_int = trans_y.floor() as i32; - let z_int = trans_z.floor() as i32; + let x_int = trans_x.floor(); + let y_int = trans_y.floor(); + let z_int = trans_z.floor(); - let x_dec = trans_x - x_int as f64; - let y_dec = trans_y - y_int as f64; - let z_dec = trans_z - z_int as f64; + let x_dec = trans_x - x_int; + let y_dec = trans_y - y_int; + let z_dec = trans_z - z_int; let y_noise = if y_scale != 0f64 { let raw_y_dec = if y_max >= 0f64 && y_max < y_dec { @@ -65,17 +84,28 @@ impl PerlinNoiseSampler { 0f64 }; - self.sample(x_int, y_int, z_int, x_dec, y_dec - y_noise, z_dec, y_dec) + self.sample( + x_int as i32, + y_int as i32, + z_int as i32, + x_dec, + y_dec - y_noise, + z_dec, + y_dec, + ) } + #[inline] fn grad(hash: i32, x: f64, y: f64, z: f64) -> f64 { - dot(&GRADIENTS[(hash & 15) as usize], x, y, z) + GRADIENTS[(hash & 15) as usize].dot(x, y, z) } + #[inline] fn perlin_fade(value: f64) -> f64 { value * value * value * (value * (value * 6f64 - 15f64) + 10f64) } + #[inline] fn map(&self, input: i32) -> i32 { self.permutation[(input & 0xFF) as usize] as i32 } @@ -151,14 +181,42 @@ impl PerlinNoiseSampler { } pub struct OctavePerlinNoiseSampler { - octave_samplers: Vec>, - pub(crate) amplitudes: Vec, + octave_samplers: Box<[Option]>, + pub(crate) amplitudes: Box<[f64]>, first_octave: i32, pub(crate) persistence: f64, lacunarity: f64, max_value: f64, } +impl PartialEq for OctavePerlinNoiseSampler { + fn eq(&self, other: &Self) -> bool { + self.octave_samplers == other.octave_samplers + && self.amplitudes.len() == other.amplitudes.len() + && self + .amplitudes + .iter() + .zip(other.amplitudes.iter()) + .all(|(a1, a2)| a1.to_le_bytes() == a2.to_le_bytes()) + && self.first_octave == other.first_octave + && self.lacunarity.to_le_bytes() == other.lacunarity.to_le_bytes() + && self.max_value.to_le_bytes() == other.max_value.to_le_bytes() + } +} + +impl Hash for OctavePerlinNoiseSampler { + fn hash(&self, state: &mut H) { + self.octave_samplers.hash(state); + self.amplitudes + .iter() + .for_each(|amp| amp.to_le_bytes().hash(state)); + self.first_octave.hash(state); + self.persistence.to_le_bytes().hash(state); + self.lacunarity.to_le_bytes().hash(state); + self.max_value.to_le_bytes().hash(state); + } +} + impl OctavePerlinNoiseSampler { pub(crate) fn get_octave(&self, octave: i32) -> Option<&PerlinNoiseSampler> { match self @@ -183,9 +241,7 @@ impl OctavePerlinNoiseSampler { } pub fn maintain_precision(value: f64) -> f64 { - (value / 3.3554432E7f64 + 0.5f64) - .floor() - .mul_add(-3.3554432E7f64, value) + (value / 3.3554432E7f64 + 0.5f64).floor() * -3.3554432E7f64 + value } pub fn calculate_amplitudes(octaves: &[i32]) -> (i32, Vec) { @@ -208,7 +264,12 @@ impl OctavePerlinNoiseSampler { (-i, double_list) } - pub fn new(random: &mut RandomGenerator, first_octave: i32, amplitudes: &[f64]) -> Self { + pub fn new( + random: &mut RandomGenerator, + first_octave: i32, + amplitudes: &[f64], + legacy: bool, + ) -> Self { let i = amplitudes.len(); let j = -first_octave; @@ -217,70 +278,32 @@ impl OctavePerlinNoiseSampler { samplers.push(None); } - match random { - RandomGenerator::Xoroshiro(random) => { - let splitter = random.next_splitter(); - for k in 0..i { - if amplitudes[k] != 0f64 { - let l = first_octave + k as i32; - samplers[k] = Some(PerlinNoiseSampler::new( - &mut splitter.split_string(&format!("octave_{}", l)), - )); - } + if legacy { + let sampler = PerlinNoiseSampler::new(random); + if j >= 0 && j < i as i32 { + let d = amplitudes[j as usize]; + if d != 0f64 { + samplers[j as usize] = Some(sampler); } } - RandomGenerator::LegacyXoroshiro(random) => { - let sampler = PerlinNoiseSampler::new(random); - if j >= 0 && j < i as i32 { - let d = amplitudes[j as usize]; - if d != 0f64 { - samplers[j as usize] = Some(sampler); - } - } - for kx in (0..j as usize).rev() { - if kx < i { - let e = amplitudes[kx]; - if e != 0f64 { - samplers[kx] = Some(PerlinNoiseSampler::new(random)); - } else { - random.skip(262); - } + for kx in (0..j as usize).rev() { + if kx < i { + let e = amplitudes[kx]; + if e != 0f64 { + samplers[kx] = Some(PerlinNoiseSampler::new(random)); } else { random.skip(262); } + } else { + random.skip(262); } - - if let Ok(length1) = samplers.iter().filter(|x| x.is_some()).try_len() { - if let Ok(length2) = amplitudes.iter().filter(|x| !x.is_zero()).try_len() { - assert_eq!(length1, length2); - } - } - assert!(j >= i as i32 - 1); } - // TODO: This is exactly the same code as LegacyXoroshiro path - // Is there a way to combine somehow? - RandomGenerator::Legacy(random) => { - let sampler = PerlinNoiseSampler::new(random); - if j >= 0 && j < i as i32 { - let d = amplitudes[j as usize]; - if d != 0f64 { - samplers[j as usize] = Some(sampler); - } - } - for kx in (0..j as usize).rev() { - if kx < i { - let e = amplitudes[kx]; - if e != 0f64 { - samplers[kx] = Some(PerlinNoiseSampler::new(random)); - } else { - random.skip(262); - } - } else { - random.skip(262); - } - } + #[cfg(debug_assertions)] + { + use itertools::Itertools; + use num_traits::Zero; if let Ok(length1) = samplers.iter().filter(|x| x.is_some()).try_len() { if let Ok(length2) = amplitudes.iter().filter(|x| !x.is_zero()).try_len() { @@ -289,13 +312,23 @@ impl OctavePerlinNoiseSampler { } assert!(j >= i as i32 - 1); } + } else { + let splitter = random.next_splitter(); + for k in 0..i { + if amplitudes[k] != 0f64 { + let l = first_octave + k as i32; + samplers[k] = Some(PerlinNoiseSampler::new( + &mut splitter.split_string(&format!("octave_{}", l)), + )); + } + } } let persistence = 2f64.pow((i as i32).wrapping_sub(1) as f64) / (2f64.pow(i as f64) - 1f64); let max_value = Self::get_total_amplitude(2f64, persistence, amplitudes); Self { - octave_samplers: samplers, - amplitudes: amplitudes.to_vec(), + octave_samplers: samplers.into(), + amplitudes: amplitudes.into(), first_octave, persistence, lacunarity: 2f64.pow((-j) as f64), @@ -329,28 +362,83 @@ impl OctavePerlinNoiseSampler { } } -#[derive(Clone)] -pub struct DoublePerlinNoiseParameters<'a> { +pub struct DoublePerlinNoiseParameters { first_octave: i32, - amplitudes: &'a [f64], + amplitudes: &'static [f64], + id: &'static str, +} + +impl Hash for DoublePerlinNoiseParameters { + fn hash(&self, state: &mut H) { + self.first_octave.hash(state); + self.amplitudes + .iter() + .for_each(|amp| amp.to_le_bytes().hash(state)); + self.id.hash(state); + } +} + +impl PartialEq for DoublePerlinNoiseParameters { + fn eq(&self, other: &Self) -> bool { + self.first_octave == other.first_octave + && self.amplitudes.len() == other.amplitudes.len() + && self + .amplitudes + .iter() + .zip(other.amplitudes.iter()) + .all(|(a1, a2)| a1.to_le_bytes() == a2.to_le_bytes()) + && self.id == other.id + } } -impl<'a> DoublePerlinNoiseParameters<'a> { - pub fn new(first_octave: i32, amplitudes: &'a [f64]) -> Self { +impl Eq for DoublePerlinNoiseParameters {} + +impl DoublePerlinNoiseParameters { + pub(crate) const fn new( + first_octave: i32, + amplitudes: &'static [f64], + id: &'static str, + ) -> Self { Self { first_octave, amplitudes, + id, } } + + pub fn id(&self) -> &'static str { + self.id + } } +#[derive(Clone)] pub struct DoublePerlinNoiseSampler { - first_sampler: OctavePerlinNoiseSampler, - second_sampler: OctavePerlinNoiseSampler, + first_sampler: Arc, + second_sampler: Arc, amplitude: f64, max_value: f64, } +impl PartialEq for DoublePerlinNoiseSampler { + fn eq(&self, other: &Self) -> bool { + self.first_sampler == other.first_sampler + && self.second_sampler == other.second_sampler + && self.amplitude.to_le_bytes() == other.amplitude.to_le_bytes() + && self.max_value.to_le_bytes() == other.max_value.to_le_bytes() + } +} + +impl Eq for DoublePerlinNoiseSampler {} + +impl Hash for DoublePerlinNoiseSampler { + fn hash(&self, state: &mut H) { + self.first_sampler.hash(state); + self.second_sampler.hash(state); + self.amplitude.to_le_bytes().hash(state); + self.max_value.to_le_bytes().hash(state); + } +} + impl DoublePerlinNoiseSampler { fn create_amplitude(octaves: i32) -> f64 { 0.1f64 * (1f64 + 1f64 / (octaves + 1) as f64) @@ -360,12 +448,16 @@ impl DoublePerlinNoiseSampler { self.max_value } - pub fn new(rand: &mut RandomGenerator, parameters: &DoublePerlinNoiseParameters) -> Self { + pub fn new( + rand: &mut RandomGenerator, + parameters: &DoublePerlinNoiseParameters, + legacy: bool, + ) -> Self { let first_octave = parameters.first_octave; let amplitudes = parameters.amplitudes; - let first_sampler = OctavePerlinNoiseSampler::new(rand, first_octave, amplitudes); - let second_sampler = OctavePerlinNoiseSampler::new(rand, first_octave, amplitudes); + let first_sampler = OctavePerlinNoiseSampler::new(rand, first_octave, amplitudes, legacy); + let second_sampler = OctavePerlinNoiseSampler::new(rand, first_octave, amplitudes, legacy); let mut j = i32::MAX; let mut k = i32::MIN; @@ -381,8 +473,8 @@ impl DoublePerlinNoiseSampler { let max_value = (first_sampler.max_value + second_sampler.max_value) * amplitude; Self { - first_sampler, - second_sampler, + first_sampler: first_sampler.into(), + second_sampler: second_sampler.into(), amplitude, max_value, } @@ -399,23 +491,20 @@ impl DoublePerlinNoiseSampler { #[cfg(test)] mod double_perlin_noise_sampler_test { - use pumpkin_core::random::{legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomImpl}; - - use crate::world_gen::noise::perlin::{ - DoublePerlinNoiseParameters, DoublePerlinNoiseSampler, RandomGenerator, + use pumpkin_core::random::{ + legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl, }; + use crate::world_gen::noise::perlin::{DoublePerlinNoiseParameters, DoublePerlinNoiseSampler}; + #[test] fn sample_legacy() { let mut rand = LegacyRand::from_seed(513513513); assert_eq!(rand.next_i32(), -1302745855); let mut rand_gen = RandomGenerator::Legacy(rand); - let params = DoublePerlinNoiseParameters { - first_octave: 0, - amplitudes: &[4f64], - }; - let sampler = DoublePerlinNoiseSampler::new(&mut rand_gen, ¶ms); + let params = DoublePerlinNoiseParameters::new(0, &[4f64], ""); + let sampler = DoublePerlinNoiseSampler::new(&mut rand_gen, ¶ms, true); let values = [ ( @@ -512,12 +601,9 @@ mod double_perlin_noise_sampler_test { let mut rand_gen = RandomGenerator::Xoroshiro(rand); - let params = DoublePerlinNoiseParameters { - first_octave: 1, - amplitudes: &[2f64, 4f64], - }; + let params = DoublePerlinNoiseParameters::new(1, &[2f64, 4f64], ""); - let sampler = DoublePerlinNoiseSampler::new(&mut rand_gen, ¶ms); + let sampler = DoublePerlinNoiseSampler::new(&mut rand_gen, ¶ms, false); let values = [ ( @@ -610,9 +696,9 @@ mod double_perlin_noise_sampler_test { #[cfg(test)] mod octave_perline_noise_sampler_test { - use pumpkin_core::random::{legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomImpl}; - - use crate::world_gen::noise::perlin::RandomGenerator; + use pumpkin_core::random::{ + legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl, + }; use super::OctavePerlinNoiseSampler; @@ -626,7 +712,7 @@ mod octave_perline_noise_sampler_test { assert_eq!(amplitudes, [1f64, 1f64, 1f64]); let mut rand_gen = RandomGenerator::Xoroshiro(rand); - let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes); + let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes, false); assert_eq!(sampler.first_octave, 1); assert_eq!(sampler.persistence, 0.5714285714285714f64); @@ -661,7 +747,7 @@ mod octave_perline_noise_sampler_test { assert_eq!(amplitudes, [1f64]); let mut rand_gen = RandomGenerator::Legacy(rand); - let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes); + let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes, true); assert_eq!(sampler.first_octave, 0); assert_eq!(sampler.persistence, 1f64); assert_eq!(sampler.lacunarity, 1f64); @@ -688,7 +774,7 @@ mod octave_perline_noise_sampler_test { let (start, amplitudes) = OctavePerlinNoiseSampler::calculate_amplitudes(&[1, 2, 3]); let mut rand_gen = RandomGenerator::Xoroshiro(rand); - let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes); + let sampler = OctavePerlinNoiseSampler::new(&mut rand_gen, start, &litudes, false); let values = [ ( @@ -783,13 +869,13 @@ mod octave_perline_noise_sampler_test { mod perlin_noise_sampler_test { use std::ops::Deref; - use pumpkin_core::random::{xoroshiro128::Xoroshiro, RandomImpl}; + use pumpkin_core::random::{xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl}; use crate::world_gen::noise::perlin::PerlinNoiseSampler; #[test] fn test_create() { - let mut rand = Xoroshiro::from_seed(111); + let mut rand = RandomGenerator::Xoroshiro(Xoroshiro::from_seed(111)); assert_eq!(rand.next_i32(), -1467508761); let sampler = PerlinNoiseSampler::new(&mut rand); @@ -818,7 +904,7 @@ mod perlin_noise_sampler_test { #[test] fn test_no_y() { - let mut rand = Xoroshiro::from_seed(111); + let mut rand = RandomGenerator::Xoroshiro(Xoroshiro::from_seed(111)); assert_eq!(rand.next_i32(), -1467508761); let sampler = PerlinNoiseSampler::new(&mut rand); @@ -988,7 +1074,7 @@ mod perlin_noise_sampler_test { #[test] fn test_no_fade() { - let mut rand = Xoroshiro::from_seed(111); + let mut rand = RandomGenerator::Xoroshiro(Xoroshiro::from_seed(111)); assert_eq!(rand.next_i32(), -1467508761); let sampler = PerlinNoiseSampler::new(&mut rand); diff --git a/pumpkin-world/src/world_gen/noise/router.rs b/pumpkin-world/src/world_gen/noise/router.rs index 92be5d555..88ab8cab7 100644 --- a/pumpkin-world/src/world_gen/noise/router.rs +++ b/pumpkin-world/src/world_gen/noise/router.rs @@ -1,293 +1,390 @@ use std::sync::Arc; -use crate::world_gen::sampler::VeinType; +use lazy_static::lazy_static; + +use crate::world_gen::{ + noise::density::{ + apply_blend_density, + basic::RangeFunction, + built_in_density_function::{ + CAVES_ENTRANCES_OVERWORLD, CAVES_NOODLE_OVERWORLD, CONTINENTS_OVERWORLD, + CONTINENTS_OVERWORLD_LARGE_BIOME, EROSION_OVERWORLD, EROSION_OVERWORLD_LARGE_BIOME, + RIDGES_OVERWORLD, Y, + }, + vertical_range_choice, + }, + sampler::vein_type, +}; use super::{ + built_in_noise_params, density::{ - apply_blend_density, lerp_density_static_start, + basic::{ConstantFunction, WrapperFunction, WrapperType, YClampedFunction}, + built_in_density_function::{ + CAVES_PILLARS_OVERWORLD, CAVES_SPAGHETTI_2D_OVERWORLD, + CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD, DEPTH_OVERWORLD, + DEPTH_OVERWORLD_AMPLIFIED, DEPTH_OVERWORLD_LARGE_BIOME, FACTOR_OVERWORLD, + FACTOR_OVERWORLD_AMPLIFIED, FACTOR_OVERWORLD_LARGE_BIOME, SHIFT_X, SHIFT_Z, + SLOPED_CHEESE_OVERWORLD, SLOPED_CHEESE_OVERWORLD_AMPLIFIED, + SLOPED_CHEESE_OVERWORLD_LARGE_BIOME, ZERO, + }, + component_functions::{ + ComponentReference, ComponentReferenceMap, ComponentReferenceMath, ConverterImpl, + DensityFunctionEnvironment, NoEnvironment, SharedComponentReference, + }, + lerp_density_static_start, noise::{InternalNoise, NoiseFunction, ShiftedNoiseFunction}, - veritcal_range_choice, BuiltInNoiseFunctions, ConstantFunction, DensityFunction, - DensityFunctionImpl, RangeFunction, Visitor, WrapperFunction, WrapperType, - YClampedFunction, }, - BuiltInNoiseParams, }; -#[derive(Clone)] -pub struct NoiseRouter<'a> { - barrier: Arc>, - fluid_level_floodedness: Arc>, - fluid_level_spread: Arc>, - lava: Arc>, - temperature: Arc>, - vegetation: Arc>, - continents: Arc>, - erosion: Arc>, - depth: Arc>, - ridges: Arc>, - pub(crate) internal_density: Arc>, - pub(crate) final_densitiy: Arc>, - vein_toggle: Arc>, - vein_ridged: Arc>, - vein_gap: Arc>, +lazy_static! { + pub static ref OVERWORLD_NOISE_ROUTER: BaseRouter = + BaseRouter::create_surface_noise_router(false, false); + pub static ref OVERWORLD_NOISE_ROUTER_LARGE: BaseRouter = + BaseRouter::create_surface_noise_router(true, false); + pub static ref OVERWORLD_NOISE_ROUTER_AMPLIFIED: BaseRouter = + BaseRouter::create_surface_noise_router(false, true); } -impl<'a> NoiseRouter<'a> { - pub fn apply(&self, visitor: &Visitor<'a>) -> Self { - Self { - barrier: self.barrier.apply(visitor), - fluid_level_floodedness: self.fluid_level_floodedness.apply(visitor), - fluid_level_spread: self.fluid_level_spread.apply(visitor), - lava: self.lava.apply(visitor), - temperature: self.temperature.apply(visitor), - vegetation: self.vegetation.apply(visitor), - continents: self.continents.apply(visitor), - erosion: self.erosion.apply(visitor), - depth: self.depth.apply(visitor), - ridges: self.ridges.apply(visitor), - internal_density: self.internal_density.apply(visitor), - final_densitiy: self.final_densitiy.apply(visitor), - vein_toggle: self.vein_toggle.apply(visitor), - vein_ridged: self.vein_ridged.apply(visitor), - vein_gap: self.vein_gap.apply(visitor), +pub struct BaseRouter { + pub(crate) barrier: SharedComponentReference, + pub(crate) fluid_level_floodedness: SharedComponentReference, + pub(crate) fluid_level_spread: SharedComponentReference, + pub(crate) lava: SharedComponentReference, + pub(crate) temperature: SharedComponentReference, + pub(crate) vegetation: SharedComponentReference, + pub(crate) continents: SharedComponentReference, + pub(crate) erosion: SharedComponentReference, + pub(crate) depth: SharedComponentReference, + pub(crate) ridges: SharedComponentReference, + pub(crate) internal_density: SharedComponentReference, + pub(crate) final_density: SharedComponentReference, + pub(crate) vein_toggle: SharedComponentReference, + pub(crate) vein_ridged: SharedComponentReference, + pub(crate) vein_gap: SharedComponentReference, +} + +// TODO: This is double indirection... can we do something about that? +pub struct NoiseRouter { + pub(crate) barrier: Box>, + pub(crate) fluid_level_floodedness: Box>, + pub(crate) fluid_level_spread: Box>, + pub(crate) lava: Box>, + pub(crate) temperature: Box>, + pub(crate) vegetation: Box>, + pub(crate) continents: Box>, + pub(crate) erosion: Box>, + pub(crate) depth: Box>, + pub(crate) ridges: Box>, + pub(crate) internal_density: Box>, + pub(crate) final_density: Box>, + pub(crate) vein_toggle: Box>, + pub(crate) vein_ridged: Box>, + pub(crate) vein_gap: Box>, +} + +impl BaseRouter { + pub fn convert_assert_shared( + &self, + converter: &mut dyn ConverterImpl, + ) -> BaseRouter { + BaseRouter { + barrier: self.barrier.clone().convert(converter).assert_shared(), + fluid_level_floodedness: self + .fluid_level_floodedness + .clone() + .convert(converter) + .assert_shared(), + fluid_level_spread: self + .fluid_level_spread + .clone() + .convert(converter) + .assert_shared(), + lava: self.lava.clone().convert(converter).assert_shared(), + temperature: self.temperature.clone().convert(converter).assert_shared(), + vegetation: self.vegetation.clone().convert(converter).assert_shared(), + continents: self.continents.clone().convert(converter).assert_shared(), + erosion: self.erosion.clone().convert(converter).assert_shared(), + depth: self.depth.clone().convert(converter).assert_shared(), + ridges: self.ridges.clone().convert(converter).assert_shared(), + internal_density: self + .internal_density + .clone() + .convert(converter) + .assert_shared(), + final_density: self + .final_density + .clone() + .convert(converter) + .assert_shared(), + vein_toggle: self.vein_toggle.clone().convert(converter).assert_shared(), + vein_ridged: self.vein_ridged.clone().convert(converter).assert_shared(), + vein_gap: self.vein_gap.clone().convert(converter).assert_shared(), + } + } + + pub fn convert( + &self, + converter: &mut dyn ConverterImpl, + ) -> NoiseRouter { + NoiseRouter { + barrier: self.barrier.clone().convert(converter).boxed(), + fluid_level_floodedness: self + .fluid_level_floodedness + .clone() + .convert(converter) + .boxed(), + fluid_level_spread: self.fluid_level_spread.clone().convert(converter).boxed(), + lava: self.lava.clone().convert(converter).boxed(), + temperature: self.temperature.clone().convert(converter).boxed(), + vegetation: self.vegetation.clone().convert(converter).boxed(), + continents: self.continents.clone().convert(converter).boxed(), + erosion: self.erosion.clone().convert(converter).boxed(), + depth: self.depth.clone().convert(converter).boxed(), + ridges: self.ridges.clone().convert(converter).boxed(), + internal_density: self.internal_density.clone().convert(converter).boxed(), + final_density: self.final_density.clone().convert(converter).boxed(), + vein_toggle: self.vein_toggle.clone().convert(converter).boxed(), + vein_ridged: self.vein_ridged.clone().convert(converter).boxed(), + vein_gap: self.vein_gap.clone().convert(converter).boxed(), } } +} + +impl BaseRouter { + pub fn create_surface_noise_router(large_biomes: bool, amplified: bool) -> Self { + #[cfg(debug_assertions)] + assert!(!(large_biomes && amplified)); - pub fn create_surface_noise_router( - noise_params: &'a BuiltInNoiseParams<'a>, - noise_funcs: &'a BuiltInNoiseFunctions<'a>, - large_biomes: bool, - amplified: bool, - ) -> Self { - let aquifier_barrier = Arc::new(DensityFunction::Noise(NoiseFunction::new( + let aquifier_barrier = NoiseFunction::new( Arc::new(InternalNoise::new( - noise_params.aquifer_barrier().clone(), + &built_in_noise_params::AQUIFER_BARRIER, None, )), 1f64, 0.5f64, - ))); + ); - let aquifier_fluid_level_floodedness = - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new( - noise_params.aquifer_fluid_level_floodedness().clone(), - None, - )), - 1f64, - 0.67f64, - ))); + let aquifier_fluid_level_floodedness = NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::AQUIFER_FLUID_LEVEL_FLOODEDNESS, + None, + )), + 1f64, + 0.67f64, + ); - let aquifer_fluid_level_spread = Arc::new(DensityFunction::Noise(NoiseFunction::new( + let aquifer_fluid_level_spread = NoiseFunction::new( Arc::new(InternalNoise::new( - noise_params.aquifer_fluid_level_spread().clone(), + &built_in_noise_params::AQUIFER_FLUID_LEVEL_SPREAD, None, )), 1f64, 0.7142857142857143f64, - ))); + ); - let aquifer_lava = Arc::new(DensityFunction::Noise(NoiseFunction::new( + let aquifer_lava = NoiseFunction::new( Arc::new(InternalNoise::new( - noise_params.aquifer_lava().clone(), + &built_in_noise_params::AQUIFER_LAVA, None, )), 1f64, 1f64, - ))); - - let shift_x = noise_funcs.shift_x().clone(); - let shift_z = noise_funcs.shift_z().clone(); + ); - let temperature = Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - noise_funcs.zero().clone(), - shift_z.clone(), + let temperature = ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, Arc::new(InternalNoise::new( if large_biomes { - noise_params.temperature_large().clone() + &built_in_noise_params::TEMPERATURE_LARGE } else { - noise_params.temperature().clone() + &built_in_noise_params::TEMPERATURE }, None, )), - ))); + ); - let vegetation = Arc::new(DensityFunction::ShiftedNoise(ShiftedNoiseFunction::new( - shift_x.clone(), - noise_funcs.zero().clone(), - shift_z.clone(), + let vegetation = ShiftedNoiseFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + SHIFT_X.clone(), + ZERO.clone(), + SHIFT_Z.clone(), 0.25f64, 0f64, Arc::new(InternalNoise::new( if large_biomes { - noise_params.vegetation_large().clone() + &built_in_noise_params::VEGETATION_LARGE } else { - noise_params.vegetation().clone() + &built_in_noise_params::VEGETATION }, None, )), - ))); + ); let factor_overworld = if large_biomes { - noise_funcs.factor_overworld_large_biome().clone() + FACTOR_OVERWORLD_LARGE_BIOME.clone() } else if amplified { - noise_funcs.factor_overworld_amplified().clone() + FACTOR_OVERWORLD_AMPLIFIED.clone() } else { - noise_funcs.factor_overworld().clone() + FACTOR_OVERWORLD.clone() }; let depth_overworld = if large_biomes { - noise_funcs.depth_overworld_large_biome().clone() + DEPTH_OVERWORLD_LARGE_BIOME.clone() } else if amplified { - noise_funcs.depth_overworld_amplified().clone() + DEPTH_OVERWORLD_AMPLIFIED.clone() } else { - noise_funcs.depth_overworld().clone() + DEPTH_OVERWORLD.clone() }; - let mapped_depth_overworld = Arc::new( - DensityFunction::Constant(ConstantFunction::new(4f64)).mul(Arc::new( - depth_overworld - .mul(Arc::new(DensityFunction::Wrapper(WrapperFunction::new( + let mapped_depth_overworld = ConstantFunction::new(4f64).mul( + depth_overworld + .clone() + .mul( + WrapperFunction::::new( factor_overworld, WrapperType::Cache2D, - )))) - .quarter_negative(), - )), + ) + .into(), + ) + .quarter_negative(), ); let sloped_cheese_overworld = if large_biomes { - noise_funcs.sloped_cheese_overworld_large_biome().clone() + SLOPED_CHEESE_OVERWORLD_LARGE_BIOME.clone() } else if amplified { - noise_funcs.sloped_cheese_overworld_amplified().clone() + SLOPED_CHEESE_OVERWORLD_AMPLIFIED.clone() } else { - noise_funcs.sloped_cheese_overworld().clone() + SLOPED_CHEESE_OVERWORLD.clone() }; - let cave_entrances_overworld = Arc::new( - sloped_cheese_overworld.binary_min(Arc::new( - DensityFunction::Constant(ConstantFunction::new(5f64)) - .mul(noise_funcs.caves_entrances_overworld().clone()), - )), - ); + let cave_entrances_overworld = sloped_cheese_overworld + .clone() + .min(ConstantFunction::new(5f64).mul(CAVES_ENTRANCES_OVERWORLD.clone())); - let mapped_cave_entraces_overworld = Arc::new(DensityFunction::Range(RangeFunction::new( + let mapped_cave_entraces_overworld = RangeFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( sloped_cheese_overworld.clone(), -1000000f64, 1.5625f64, cave_entrances_overworld, - Arc::new(create_caves( - noise_funcs, - noise_params, - sloped_cheese_overworld, - )), - ))); - - let blended_cave_entrances_overworld = Arc::new( - apply_blend_density(apply_surface_slides( - amplified, - mapped_cave_entraces_overworld, - )) - .binary_min(noise_funcs.caves_noodle_overworld().clone()), + create_caves(sloped_cheese_overworld), ); - let y = noise_funcs.y().clone(); - let i = VeinType::overall_min_y(); - let j = VeinType::overall_max_y(); - let ore_veininess = Arc::new(veritcal_range_choice( - y.clone(), - Arc::new(DensityFunction::Noise(NoiseFunction::new( + let blended_cave_entrances_overworld = apply_blend_density(apply_surface_slides( + amplified, + mapped_cave_entraces_overworld.into(), + )) + .min(CAVES_NOODLE_OVERWORLD.clone()); + + let i = *vein_type::MIN_Y; + let j = *vein_type::MAX_Y; + let ore_veininess = vertical_range_choice( + Y.clone(), + NoiseFunction::new( Arc::new(InternalNoise::new( - noise_params.ore_veininess().clone(), + &built_in_noise_params::ORE_VEININESS, None, )), 1.5f64, 1.5f64, - ))), + ) + .into(), i, j, 0, - )); - - let ore_vein_a = Arc::new( - veritcal_range_choice( - y.clone(), - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise_params.ore_vein_a().clone(), None)), - 4f64, - 4f64, - ))), - i, - j, - 0, - ) - .abs(), ); - let ore_vein_b = Arc::new( - veritcal_range_choice( - y, - Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise_params.ore_vein_b().clone(), None)), - 4f64, - 4f64, - ))), - i, - j, - 0, + let ore_vein_a = vertical_range_choice( + Y.clone(), + NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::ORE_VEIN_A, None)), + 4f64, + 4f64, ) - .abs(), - ); + .into(), + i, + j, + 0, + ) + .abs(); - let ore_vein = Arc::new( - DensityFunction::Constant(ConstantFunction::new(-0.08f64)) - .add(Arc::new(ore_vein_a.binary_max(ore_vein_b))), - ); + let ore_vein_b = vertical_range_choice( + Y.clone(), + NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::ORE_VEIN_B, None)), + 4f64, + 4f64, + ) + .into(), + i, + j, + 0, + ) + .abs(); + + let ore_vein = ConstantFunction::new(-0.08f32 as f64).add(ore_vein_a.max(ore_vein_b)); - let ore_gap = Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise_params.ore_gap().clone(), None)), + let ore_gap = NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::ORE_GAP, None)), 1f64, 1f64, - ))); + ); Self { - barrier: aquifier_barrier, - fluid_level_floodedness: aquifier_fluid_level_floodedness, - fluid_level_spread: aquifer_fluid_level_spread, - lava: aquifer_lava, - temperature, - vegetation, + barrier: aquifier_barrier.into(), + fluid_level_floodedness: aquifier_fluid_level_floodedness.into(), + fluid_level_spread: aquifer_fluid_level_spread.into(), + lava: aquifer_lava.into(), + temperature: temperature.into(), + vegetation: vegetation.into(), continents: if large_biomes { - noise_funcs.continents_overworld_large_biome().clone() + CONTINENTS_OVERWORLD_LARGE_BIOME.clone() } else { - noise_funcs.continents_overworld().clone() + CONTINENTS_OVERWORLD.clone() }, erosion: if large_biomes { - noise_funcs.erosion_overworld_large_biome().clone() + EROSION_OVERWORLD_LARGE_BIOME.clone() } else { - noise_funcs.erosion_overworld().clone() + EROSION_OVERWORLD.clone() }, depth: depth_overworld, - ridges: noise_funcs.ridges_overworld().clone(), - internal_density: Arc::new(apply_surface_slides( + ridges: RIDGES_OVERWORLD.clone(), + internal_density: apply_surface_slides( amplified, - Arc::new( - mapped_depth_overworld - .add_const(-0.703125) - .clamp(-64f64, 64f64), - ), - )), - final_densitiy: blended_cave_entrances_overworld, + mapped_depth_overworld + .add_const(-0.703125) + .clamp(-64f64, 64f64), + ), + final_density: blended_cave_entrances_overworld, vein_toggle: ore_veininess, vein_ridged: ore_vein, - vein_gap: ore_gap, + vein_gap: ore_gap.into(), } } } -fn apply_surface_slides(amplified: bool, density: Arc) -> DensityFunction { +fn apply_surface_slides( + amplified: bool, + density: SharedComponentReference, +) -> SharedComponentReference { apply_slides( density, -64, @@ -303,7 +400,7 @@ fn apply_surface_slides(amplified: bool, density: Arc) -> Densi #[allow(clippy::too_many_arguments)] fn apply_slides( - density: Arc, + density: SharedComponentReference, y_min: i32, y_max: i32, top_rel_y_min: i32, @@ -312,71 +409,365 @@ fn apply_slides( bottom_rel_y_min: i32, bottom_rel_y_max: i32, bottom_density: f64, -) -> DensityFunction { - let function2 = Arc::new(DensityFunction::ClampedY(YClampedFunction::new( +) -> SharedComponentReference { + let function2 = YClampedFunction::new( y_min + y_max - top_rel_y_min, y_min + y_max + -top_rel_y_max, 1f64, 0f64, - ))); - let function = Arc::new(lerp_density_static_start(function2, top_density, density)); - let function3 = Arc::new(DensityFunction::ClampedY(YClampedFunction::new( + ); + let function = lerp_density_static_start(function2.into(), top_density, density); + let function3 = YClampedFunction::new( y_min + bottom_rel_y_min, y_min + bottom_rel_y_max, 0f64, 1f64, - ))); - lerp_density_static_start(function3, bottom_density, function) + ); + lerp_density_static_start(function3.into(), bottom_density, function) } -fn create_caves<'a>( - noise_funcs: &BuiltInNoiseFunctions<'a>, - noise_params: &BuiltInNoiseParams<'a>, - sloped_cheese: Arc>, -) -> DensityFunction<'a> { - let caves_spaghetti_2d = noise_funcs.caves_spaghetti_2d_overworld().clone(); - let caves_spaghetti_roughness = noise_funcs - .caves_spaghetti_roughness_function_overworld() - .clone(); - let cave_layer = Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise_params.cave_layer().clone(), None)), +fn create_caves(sloped_cheese: SharedComponentReference) -> SharedComponentReference { + let cave_layer = NoiseFunction::new( + Arc::new(InternalNoise::new(&built_in_noise_params::CAVE_LAYER, None)), 1f64, 8f64, - ))); - let scaled_cave_layer = Arc::new( - DensityFunction::Constant(ConstantFunction::new(4f64)).mul(Arc::new(cave_layer.square())), ); - let cave_cheese = Arc::new(DensityFunction::Noise(NoiseFunction::new( - Arc::new(InternalNoise::new(noise_params.cave_cheese().clone(), None)), + let scaled_cave_layer = ConstantFunction::new(4f64).mul(cave_layer.square()); + let cave_cheese = NoiseFunction::new( + Arc::new(InternalNoise::new( + &built_in_noise_params::CAVE_CHEESE, + None, + )), 1f64, 0.6666666666666666f64, - ))); - let scaled_cave_cheese = Arc::new( - DensityFunction::Constant(ConstantFunction::new(0.27f64)) - .add(cave_cheese) - .clamp(-1f64, 1f64) - .add(Arc::new( - DensityFunction::Constant(ConstantFunction::new(1.5f64)) - .add(Arc::new( - DensityFunction::Constant(ConstantFunction::new(-0.64f64)) - .mul(sloped_cheese), - )) - .clamp(0f64, 0.5f64), - )), ); - let final_cave_layer = Arc::new(scaled_cave_layer.add(scaled_cave_cheese)); - let cave_entrances = final_cave_layer - .binary_min(noise_funcs.caves_entrances_overworld().clone()) - .binary_min(Arc::new(caves_spaghetti_2d.add(caves_spaghetti_roughness))); - let pillars = noise_funcs.caves_pillars_overworld().clone(); - let scaled_pillars = Arc::new(DensityFunction::Range(RangeFunction::new( - pillars.clone(), + let scaled_cave_cheese = ConstantFunction::new(0.27f64) + .add(cave_cheese.into()) + .clamp(-1f64, 1f64) + .add( + ConstantFunction::new(1.5f64) + .add(ConstantFunction::new(-0.64f64).mul(sloped_cheese)) + .clamp(0f64, 0.5f64), + ); + let final_cave_layer = scaled_cave_layer.add(scaled_cave_cheese); + let cave_entrances = final_cave_layer.min(CAVES_ENTRANCES_OVERWORLD.clone()).min( + CAVES_SPAGHETTI_2D_OVERWORLD + .clone() + .add(CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD.clone()), + ); + let scaled_pillars = RangeFunction::< + NoEnvironment, + SharedComponentReference, + SharedComponentReference, + SharedComponentReference, + >::new( + CAVES_PILLARS_OVERWORLD.clone(), -1000000f64, 0.03f64, - Arc::new(DensityFunction::Constant(ConstantFunction::new( - -1000000f64, - ))), - pillars, - ))); - cave_entrances.binary_max(scaled_pillars) + ConstantFunction::new(-1000000f64).into(), + CAVES_PILLARS_OVERWORLD.clone(), + ); + cave_entrances.max(scaled_pillars.into()) +} + +#[cfg(test)] +mod test { + use std::sync::Arc; + + use pumpkin_core::random::{legacy_rand::LegacyRand, RandomDeriver, RandomImpl}; + + use crate::world_gen::noise::{ + density::{ + built_in_density_function::EROSION_OVERWORLD, + component_functions::{ + ComponentReference, ComponentReferenceImplementation, ConversionResultPre, + ConverterEnvironment, ConverterImpl, NoEnvironment, OwnedConverterEnvironment, + }, + noise::InternalNoise, + NoisePos, UnblendedNoisePos, + }, + perlin::DoublePerlinNoiseSampler, + router::OVERWORLD_NOISE_ROUTER, + }; + + use super::apply_surface_slides; + + pub struct TestConverter { + pub splitter: RandomDeriver, + } + + impl ConverterImpl for TestConverter { + fn convert_noise(&mut self, noise: &Arc) -> Option> { + let id = noise.parameters.id(); + let mut rand = self.splitter.split_string(id); + let sampler = DoublePerlinNoiseSampler::new(&mut rand, noise.parameters, false); + + Some(Arc::new(InternalNoise::new( + noise.parameters, + Some(sampler), + ))) + } + + fn convert_env_pre_internal( + &mut self, + _component: ConverterEnvironment, + ) -> ConversionResultPre { + ConversionResultPre::Default + } + + fn converts_post_internal( + &mut self, + _component: ConverterEnvironment, + ) -> bool { + false + } + + fn convert_env_post_internal( + &mut self, + _component: OwnedConverterEnvironment, + ) -> ComponentReferenceImplementation { + unreachable!() + } + } + + #[test] + fn test_apply_surface_slides() { + let mut rand = LegacyRand::from_seed(0); + let splitter = rand.next_splitter(); + let mut converter = TestConverter { + splitter: RandomDeriver::Legacy(splitter), + }; + let converted_func = EROSION_OVERWORLD + .clone() + .convert(&mut converter) + .assert_shared(); + + let values = [ + ((-1000, -1000), -0.30208879996359317f64), + ((-1000, -800), -0.1076130122697041f64), + ((-1000, -600), 0.05906607850421469f64), + ((-1000, -400), 0.24726986724384714f64), + ((-1000, -200), 0.2706794457383526f64), + ((-1000, 0), 0.2697306747800193f64), + ((-1000, 200), 0.21391910117663293f64), + ((-1000, 400), 0.18535143299569468f64), + ((-1000, 600), 0.1294413488921486f64), + ((-1000, 800), 0.061580256900142794f64), + ((-1000, 1000), 0.12530753721310528f64), + ((-800, -1000), -0.26334816753858103f64), + ((-800, -800), -0.020687744964915544f64), + ((-800, -600), 0.023225727811309105f64), + ((-800, -400), 0.07746776104719977f64), + ((-800, -200), 0.09992470719841956f64), + ((-800, 0), 0.1146551050894824f64), + ((-800, 200), 0.06564485641223794f64), + ((-800, 400), 0.08848851954273917f64), + ((-800, 600), 0.056160953033021266f64), + ((-800, 800), 0.011045253253628817f64), + ((-800, 1000), 0.015198372445202502f64), + ((-600, -1000), -0.16525687371490894f64), + ((-600, -800), 0.05293810125583154f64), + ((-600, -600), 0.17475689197213684f64), + ((-600, -400), 0.16103184321844596f64), + ((-600, -200), 0.04702586800266029f64), + ((-600, 0), 0.008498755101605193f64), + ((-600, 200), -0.05632912234656379f64), + ((-600, 400), -0.03331984537443711f64), + ((-600, 600), -0.15304483622814935f64), + ((-600, 800), -0.10634904956802882f64), + ((-600, 1000), -0.10145702807865031f64), + ((-400, -1000), 0.014509904002985907f64), + ((-400, -800), 0.1617721780377955f64), + ((-400, -600), 0.1538795562844772f64), + ((-400, -400), 0.09291099527948621f64), + ((-400, -200), 0.016032945505656093f64), + ((-400, 0), -0.12944528371858455f64), + ((-400, 200), -0.22407726246974746f64), + ((-400, 400), -0.18164279264712324f64), + ((-400, 600), -0.15374226930846258f64), + ((-400, 800), -0.14225372340399312f64), + ((-400, 1000), -0.1707662008691604f64), + ((-200, -1000), 0.1737449324031909f64), + ((-200, -800), 0.15588767399915038f64), + ((-200, -600), 0.09807388580637255f64), + ((-200, -400), 0.04134584798831298f64), + ((-200, -200), 0.07633793620513718f64), + ((-200, 0), -0.16636855652213256f64), + ((-200, 200), -0.13472373172620833f64), + ((-200, 400), -0.22022531422260827f64), + ((-200, 600), -0.1733817125721101f64), + ((-200, 800), -0.25850640558184435f64), + ((-200, 1000), -0.3016979165025152f64), + ((0, -1000), 0.251814304135237f64), + ((0, -800), 0.13332966941629143f64), + ((0, -600), 0.10348476729023426f64), + ((0, -400), 0.05536479756994106f64), + ((0, -200), -0.01381233701693424f64), + ((0, 0), -0.19098385460723655f64), + ((0, 200), -0.2404237434218891f64), + ((0, 400), -0.2610517555168873f64), + ((0, 600), -0.2903199404423026f64), + ((0, 800), -0.3374524245257239f64), + ((0, 1000), -0.46305810978001316f64), + ((200, -1000), 0.28709965377682267f64), + ((200, -800), 0.19268673409560028f64), + ((200, -600), 0.0041189472733734744f64), + ((200, -400), -0.047481063682935865f64), + ((200, -200), -0.17715255198738433f64), + ((200, 0), -0.2656740328018877f64), + ((200, 200), -0.38846940763264115f64), + ((200, 400), -0.3771208707257109f64), + ((200, 600), -0.42164320098305474f64), + ((200, 800), -0.45957304404559196f64), + ((200, 1000), -0.3886247688972352f64), + ((400, -1000), 0.2946831456942509f64), + ((400, -800), 0.15366391689596104f64), + ((400, -600), -0.03683895527138398f64), + ((400, -400), -0.12286969762482891f64), + ((400, -200), -0.279692934897965f64), + ((400, 0), -0.3299116026613176f64), + ((400, 200), -0.4397636078519035f64), + ((400, 400), -0.5016687095505773f64), + ((400, 600), -0.4593088249355858f64), + ((400, 800), -0.4120918663615397f64), + ((400, 1000), -0.33349227727910835f64), + ((600, -1000), 0.22507430288840974f64), + ((600, -800), 0.11690723489828847f64), + ((600, -600), -0.07736959302795038f64), + ((600, -400), -0.3103436858126015f64), + ((600, -200), -0.4646135074970098f64), + ((600, 0), -0.42802179309528376f64), + ((600, 200), -0.5031234101517712f64), + ((600, 400), -0.43980110641169434f64), + ((600, 600), -0.418150522213239f64), + ((600, 800), -0.2858012217898377f64), + ((600, 1000), -0.2078009597778817f64), + ((800, -1000), 0.02646235055281687f64), + ((800, -800), -0.0025711457048024355f64), + ((800, -600), -0.22091967015314884f64), + ((800, -400), -0.36062363978247114f64), + ((800, -200), -0.5267644629903612f64), + ((800, 0), -0.5221952728781099f64), + ((800, 200), -0.5583524962468077f64), + ((800, 400), -0.6064703416700034f64), + ((800, 600), -0.42124877767264723f64), + ((800, 800), -0.41023710661537083f64), + ((800, 1000), -0.31011231029109043f64), + ((1000, -1000), -0.13246158771459038f64), + ((1000, -800), -0.21539115619228733f64), + ((1000, -600), -0.2583347168279443f64), + ((1000, -400), -0.3998592325985889f64), + ((1000, -200), -0.5387601014248653f64), + ((1000, 0), -0.5666190345839045f64), + ((1000, 200), -0.6213722075094567f64), + ((1000, 400), -0.671739773000314f64), + ((1000, 600), -0.6238217558734026f64), + ((1000, 800), -0.49441693548204757f64), + ((1000, 1000), -0.3843933568068797f64), + ]; + let amplified = apply_surface_slides(true, converted_func); + for ((x, z), value) in values { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(x, 60, z)); + assert_eq!(amplified.sample(pos), value); + } + } + + #[test] + fn test_normal_surface_functions() { + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 0, 0)); + assert_eq!(OVERWORLD_NOISE_ROUTER.barrier.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.fluid_level_floodedness.sample(pos), + 0f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.fluid_level_spread.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.lava.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.temperature.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.vegetation.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.continents.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.erosion.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.depth.sample(pos), + 0.3962499722838402f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.ridges.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.internal_density.sample(pos), + 8.093466727565826f64 + ); + assert_eq!( + OVERWORLD_NOISE_ROUTER.final_density.sample(pos), + -0.07500000000000001f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_toggle.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.vein_ridged.sample(pos), + -0.07999999821186066f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_gap.sample(pos), 0f64); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 60, 0)); + assert_eq!(OVERWORLD_NOISE_ROUTER.barrier.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.fluid_level_floodedness.sample(pos), + 0f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.fluid_level_spread.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.lava.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.temperature.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.vegetation.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.continents.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.erosion.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.depth.sample(pos), + -0.07250002771615982f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.ridges.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.internal_density.sample(pos), + -1.105492942375168f64 + ); + assert_eq!( + OVERWORLD_NOISE_ROUTER.final_density.sample(pos), + -0.15607060320915436f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_toggle.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.vein_ridged.sample(pos), + -0.07999999821186066f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_gap.sample(pos), 0f64); + + let pos = &NoisePos::Unblended(UnblendedNoisePos::new(0, 120, 0)); + assert_eq!(OVERWORLD_NOISE_ROUTER.barrier.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.fluid_level_floodedness.sample(pos), + 0f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.fluid_level_spread.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.lava.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.temperature.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.vegetation.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.continents.sample(pos), 0f64); + assert_eq!(OVERWORLD_NOISE_ROUTER.erosion.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.depth.sample(pos), + -0.5412500277161598f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.ridges.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.internal_density.sample(pos), + -3.7070088166417925f64 + ); + assert_eq!( + OVERWORLD_NOISE_ROUTER.final_density.sample(pos), + -0.4583333333333333f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_toggle.sample(pos), 0f64); + assert_eq!( + OVERWORLD_NOISE_ROUTER.vein_ridged.sample(pos), + -0.07999999821186066f64 + ); + assert_eq!(OVERWORLD_NOISE_ROUTER.vein_gap.sample(pos), 0f64); + } } diff --git a/pumpkin-world/src/world_gen/noise/simplex.rs b/pumpkin-world/src/world_gen/noise/simplex.rs index 8310bc65f..ff9afd6ef 100644 --- a/pumpkin-world/src/world_gen/noise/simplex.rs +++ b/pumpkin-world/src/world_gen/noise/simplex.rs @@ -1,7 +1,9 @@ +use std::hash::Hash; + use num_traits::Pow; use pumpkin_core::random::{legacy_rand::LegacyRand, RandomImpl}; -use super::{dot, GRADIENTS}; +use super::GRADIENTS; #[derive(Clone)] pub struct SimplexNoiseSampler { @@ -11,6 +13,26 @@ pub struct SimplexNoiseSampler { z_origin: f64, } +impl PartialEq for SimplexNoiseSampler { + fn eq(&self, other: &Self) -> bool { + self.permutation == other.permutation + && self.x_origin.to_le_bytes() == other.x_origin.to_le_bytes() + && self.y_origin.to_le_bytes() == other.y_origin.to_le_bytes() + && self.z_origin.to_le_bytes() == other.z_origin.to_le_bytes() + } +} + +impl Eq for SimplexNoiseSampler {} + +impl Hash for SimplexNoiseSampler { + fn hash(&self, state: &mut H) { + self.permutation.hash(state); + self.x_origin.to_le_bytes().hash(state); + self.y_origin.to_le_bytes().hash(state); + self.z_origin.to_le_bytes().hash(state); + } +} + impl SimplexNoiseSampler { const SQRT_3: f64 = 1.7320508075688772f64; const SKEW_FACTOR_2D: f64 = 0.5f64 * (Self::SQRT_3 - 1f64); @@ -41,6 +63,7 @@ impl SimplexNoiseSampler { } } + #[inline] fn map(&self, input: i32) -> i32 { self.permutation[(input & 0xFF) as usize] as i32 } @@ -51,7 +74,7 @@ impl SimplexNoiseSampler { 0f64 } else { let d = d * d; - d * d * dot(&GRADIENTS[gradient_index], x, y, z) + d * d * GRADIENTS[gradient_index].dot(x, y, z) } } @@ -71,8 +94,8 @@ impl SimplexNoiseSampler { let n = h - l as f64 + Self::UNSKEW_FACTOR_2D; let o = k - m as f64 + Self::UNSKEW_FACTOR_2D; - let p = 2f64.mul_add(Self::UNSKEW_FACTOR_2D, h - 1f64); - let q = 2f64.mul_add(Self::UNSKEW_FACTOR_2D, k - 1f64); + let p = 2f64 * Self::UNSKEW_FACTOR_2D + (h - 1f64); + let q = 2f64 * Self::UNSKEW_FACTOR_2D + (k - 1f64); let r = i & 0xFF; let s = j & 0xFF; @@ -236,8 +259,8 @@ impl OctaveSimplexNoiseSampler { for sampler in self.octave_samplers.iter() { if let Some(sampler) = sampler { d += sampler.sample_2d( - x.mul_add(e, if use_origin { sampler.x_origin } else { 0f64 }), - y.mul_add(e, if use_origin { sampler.y_origin } else { 0f64 }), + x * e + if use_origin { sampler.x_origin } else { 0f64 }, + y * e + if use_origin { sampler.y_origin } else { 0f64 }, ) * f; } diff --git a/pumpkin-world/src/world_gen/positions.rs b/pumpkin-world/src/world_gen/positions.rs index 4420c96d0..6fc4f33a5 100644 --- a/pumpkin-world/src/world_gen/positions.rs +++ b/pumpkin-world/src/world_gen/positions.rs @@ -1,13 +1,46 @@ +use pumpkin_core::math::{floor_log2, smallest_encompassing_power_of_two}; + +pub mod block_pos { + use pumpkin_core::math::vector3::Vector3; + + use super::{ + BITS_X, BITS_Y, BITS_Z, BIT_SHIFT_X, BIT_SHIFT_Z, SIZE_BITS_X, SIZE_BITS_Y, SIZE_BITS_Z, + }; + + #[inline] + pub const fn unpack_x(packed: u64) -> i32 { + (((packed as i64) << (64 - BIT_SHIFT_X - SIZE_BITS_X)) >> (64 - SIZE_BITS_X)) as i32 + } + + #[inline] + pub const fn unpack_y(packed: u64) -> i32 { + (((packed as i64) << (64 - SIZE_BITS_Y)) >> (64 - SIZE_BITS_Y)) as i32 + } + + #[inline] + pub const fn unpack_z(packed: u64) -> i32 { + (((packed as i64) << (64 - BIT_SHIFT_Z - SIZE_BITS_Z)) >> (64 - SIZE_BITS_Z)) as i32 + } + + #[inline] + pub const fn packed(vec: &Vector3) -> u64 { + let mut result = 0i64; + // Need to go to i64 first to conserve sign + result |= (vec.x as i64 & BITS_X as i64) << BIT_SHIFT_X; + result |= (vec.z as i64 & BITS_Z as i64) << BIT_SHIFT_Z; + result |= vec.y as i64 & BITS_Y as i64; + result as u64 + } +} + pub mod chunk_pos { - use noise::Vector2; + use pumpkin_core::math::vector2::Vector2; - const MARKER: u64 = packed(Vector2 { - x: 1875066, - y: 1875066, - }); + // A chunk outside of normal bounds + pub const MARKER: u64 = packed(&Vector2::new(1875066, 1875066)); - pub const fn packed(vec: Vector2) -> u64 { - (vec.x as u64 & 4294967295u64) | ((vec.y as u64 & 4294967295u64) << 32) + pub const fn packed(vec: &Vector2) -> u64 { + (vec.x as u64 & 4294967295u64) | ((vec.z as u64 & 4294967295u64) << 32) } pub const fn unpack_x(packed: u64) -> i32 { @@ -18,11 +51,64 @@ pub mod chunk_pos { ((packed >> 32) & 4294967295u64) as i32 } - pub const fn start_x(vec: Vector2) -> i32 { + pub const fn start_block_x(vec: &Vector2) -> i32 { vec.x << 4 } - pub const fn start_y(vec: Vector2) -> i32 { - vec.y << 4 + pub const fn end_block_x(vec: &Vector2) -> i32 { + start_block_x(vec) + 15 + } + + pub const fn start_block_z(vec: &Vector2) -> i32 { + vec.z << 4 + } + + pub const fn end_block_z(vec: &Vector2) -> i32 { + start_block_z(vec) + 15 + } + + pub const fn to_chunk_pos(vec: &Vector2) -> Vector2 { + Vector2::new(vec.x >> 4, vec.z >> 4) + } +} + +const MAX_BLOCK_AXIS: u32 = 30000000; +const SIZE_BITS_X: u8 = 1 + floor_log2(smallest_encompassing_power_of_two(MAX_BLOCK_AXIS)); +const BITS_X: u64 = (1 << SIZE_BITS_X) - 1; +const SIZE_BITS_Z: u8 = SIZE_BITS_X; +const BITS_Z: u64 = (1 << SIZE_BITS_Z) - 1; +pub const SIZE_BITS_Y: u8 = 64 - SIZE_BITS_X - SIZE_BITS_Z; +const BITS_Y: u64 = (1 << SIZE_BITS_Y) - 1; +const BIT_SHIFT_Z: u8 = SIZE_BITS_Y; +const BIT_SHIFT_X: u8 = SIZE_BITS_Y + SIZE_BITS_Z; + +pub const MAX_HEIGHT: u32 = (1 << SIZE_BITS_Y) - 32; +pub const MAX_COLUMN_HEIGHT: u32 = (MAX_HEIGHT >> 1) - 1; +pub const MIN_HEIGHT: i32 = MAX_COLUMN_HEIGHT as i32 - MAX_HEIGHT as i32 + 1; +pub const MIN_HEIGHT_CELL: i32 = MIN_HEIGHT << 4; + +#[cfg(test)] +mod test { + use pumpkin_core::math::{vector2::Vector2, vector3::Vector3}; + + use super::{block_pos, chunk_pos}; + + #[test] + fn test_chunk_packing() { + let pos = Vector2::new(305135135, -1351513511); + let packed = chunk_pos::packed(&pos); + assert_eq!(packed as i64, -5804706329542001121i64); + assert_eq!(pos.x, chunk_pos::unpack_x(packed)); + assert_eq!(pos.z, chunk_pos::unpack_z(packed)); + } + + #[test] + fn test_block_packing() { + let pos = Vector3::new(-30000000, 120, 30000000); + let packed = block_pos::packed(&pos); + assert_eq!(packed as i64, -8246337085439999880i64); + assert_eq!(pos.x, block_pos::unpack_x(packed)); + assert_eq!(pos.y, block_pos::unpack_y(packed)); + assert_eq!(pos.z, block_pos::unpack_z(packed)); } } diff --git a/pumpkin-world/src/world_gen/proto_chunk.rs b/pumpkin-world/src/world_gen/proto_chunk.rs index f4d5df67c..407686a28 100644 --- a/pumpkin-world/src/world_gen/proto_chunk.rs +++ b/pumpkin-world/src/world_gen/proto_chunk.rs @@ -1,13 +1,198 @@ -use pumpkin_core::math::vector3::Vector3; +use pumpkin_core::math::{vector2::Vector2, vector3::Vector3}; -use crate::block::block_state::BlockState; +use crate::{ + block::BlockState, + world_gen::{ + chunk_noise::CHUNK_DIM, + generation_shapes::GenerationShape, + noise::{config::NoiseConfig, router::OVERWORLD_NOISE_ROUTER}, + positions::chunk_pos, + sampler::FluidLevelSampler, + }, + WORLD_HEIGHT, +}; + +use super::{ + chunk_noise::{ChunkNoiseGenerator, LAVA_BLOCK, STONE_BLOCK, WATER_BLOCK}, + positions::chunk_pos::{start_block_x, start_block_z}, + sampler::{FluidLevel, FluidLevelSamplerImpl}, +}; + +pub struct StandardChunkFluidLevelSampler { + pub top_fluid: FluidLevel, + pub bottom_fluid: FluidLevel, +} + +impl FluidLevelSamplerImpl for StandardChunkFluidLevelSampler { + fn get_fluid_level(&self, _x: i32, y: i32, _z: i32) -> FluidLevel { + if y < self + .top_fluid + .max_y_exclusive() + .min(self.bottom_fluid.max_y_exclusive()) + { + self.bottom_fluid.clone() + } else { + self.top_fluid.clone() + } + } +} pub struct ProtoChunk { + chunk_pos: Vector2, + sampler: ChunkNoiseGenerator, + // These are local positions + flat_block_map: Vec, // may want to use chunk status } impl ProtoChunk { - pub fn get_block_state(&self, _pos: &Vector3) -> BlockState { - unimplemented!() + pub fn new(chunk_pos: Vector2) -> Self { + // TODO: Don't hardcode these + + let base_router = &OVERWORLD_NOISE_ROUTER; + + let generation_shape = GenerationShape::SURFACE; + let config = NoiseConfig::new(0, base_router); + + let horizontal_cell_count = CHUNK_DIM / generation_shape.horizontal_cell_block_count(); + + // TODO: Customize these + let sampler = FluidLevelSampler::Chunk(StandardChunkFluidLevelSampler { + bottom_fluid: FluidLevel::new(-54, *LAVA_BLOCK), + top_fluid: FluidLevel::new(62, *WATER_BLOCK), + }); + + let sampler = ChunkNoiseGenerator::new( + horizontal_cell_count, + chunk_pos::start_block_x(&chunk_pos), + chunk_pos::start_block_z(&chunk_pos), + generation_shape, + &config, + sampler, + true, + true, + ); + + Self { + chunk_pos, + sampler, + flat_block_map: vec![ + BlockState::AIR; + CHUNK_DIM as usize * CHUNK_DIM as usize * WORLD_HEIGHT + ], + } + } + + #[inline] + fn local_pos_to_index(local_pos: &Vector3) -> usize { + #[cfg(debug_assertions)] + { + assert!(local_pos.x >= 0 && local_pos.x <= 15); + assert!(local_pos.y < WORLD_HEIGHT as i32 && local_pos.y >= 0); + assert!(local_pos.z >= 0 && local_pos.z <= 15); + } + WORLD_HEIGHT * CHUNK_DIM as usize * local_pos.x as usize + + CHUNK_DIM as usize * local_pos.y as usize + + local_pos.z as usize + } + + #[inline] + pub fn get_block_state(&self, local_pos: &Vector3) -> BlockState { + let local_pos = Vector3::new( + local_pos.x & 15, + local_pos.y - self.sampler.min_y() as i32, + local_pos.z & 15, + ); + if local_pos.y < 0 || local_pos.y >= WORLD_HEIGHT as i32 { + BlockState::AIR + } else { + self.flat_block_map[Self::local_pos_to_index(&local_pos)] + } + } + + pub fn populate_noise(&mut self) { + let horizontal_cell_block_count = self.sampler.horizontal_cell_block_count(); + let vertical_cell_block_count = self.sampler.vertical_cell_block_count(); + + let horizonal_cells = CHUNK_DIM / horizontal_cell_block_count; + + let min_y = self.sampler.min_y(); + let minimum_cell_y = min_y / vertical_cell_block_count as i8; + let cell_height = self.sampler.height() / vertical_cell_block_count as u16; + + self.sampler.sample_start_density(); + for cell_x in 0..horizonal_cells { + self.sampler.sample_end_density(cell_x); + + for cell_z in 0..horizonal_cells { + for cell_y in (0..cell_height).rev() { + self.sampler.on_sampled_cell_corners(cell_y, cell_z); + for local_y in (0..vertical_cell_block_count).rev() { + let block_y = (minimum_cell_y as i32 + cell_y as i32) + * vertical_cell_block_count as i32 + + local_y as i32; + let delta_y = local_y as f64 / vertical_cell_block_count as f64; + self.sampler.interpolate_y(block_y, delta_y); + + for local_x in 0..horizontal_cell_block_count { + let block_x = self.start_block_x() + + cell_x as i32 * horizontal_cell_block_count as i32 + + local_x as i32; + let delta_x = local_x as f64 / horizontal_cell_block_count as f64; + self.sampler.interpolate_x(block_x, delta_x); + + for local_z in 0..horizontal_cell_block_count { + let block_z = self.start_block_z() + + cell_z as i32 * horizontal_cell_block_count as i32 + + local_z as i32; + let delta_z = local_z as f64 / horizontal_cell_block_count as f64; + self.sampler.interpolate_z(block_z, delta_z); + + // TODO: Change default block + let block_state = + self.sampler.sample_block_state().unwrap_or(*STONE_BLOCK); + //log::debug!("Sampled block state in {:?}", inst.elapsed()); + + let local_pos = Vector3 { + x: block_x & 15, + y: block_y - min_y as i32, + z: block_z & 15, + }; + + #[cfg(debug_assertions)] + { + assert!(local_pos.x < 16 && local_pos.x >= 0); + assert!(local_pos.y < WORLD_HEIGHT as i32 && local_pos.y >= 0); + assert!(local_pos.z < 16 && local_pos.z >= 0); + } + //println!("Putting {:?}: {:?}", local_pos, block_state); + self.flat_block_map[Self::local_pos_to_index(&local_pos)] = + block_state; + } + } + } + } + } + + self.sampler.swap_buffers(); + } + + self.sampler.stop_interpolation(); + } + + fn start_cell_x(&self) -> i32 { + self.start_block_x() / self.sampler.horizontal_cell_block_count() as i32 + } + + fn start_cell_z(&self) -> i32 { + self.start_block_z() / self.sampler.horizontal_cell_block_count() as i32 + } + + fn start_block_x(&self) -> i32 { + start_block_x(&self.chunk_pos) + } + + fn start_block_z(&self) -> i32 { + start_block_z(&self.chunk_pos) } } diff --git a/pumpkin-world/src/world_gen/sampler.rs b/pumpkin-world/src/world_gen/sampler.rs index 93d155a21..479a41772 100644 --- a/pumpkin-world/src/world_gen/sampler.rs +++ b/pumpkin-world/src/world_gen/sampler.rs @@ -1,28 +1,804 @@ -pub enum VeinType { - Copper, - Iron, +use enum_dispatch::enum_dispatch; +use lazy_static::lazy_static; +use num_traits::PrimInt; +use pumpkin_core::{ + math::{floor_div, vector2::Vector2, vector3::Vector3}, + random::RandomDeriver, +}; + +use crate::block::BlockState; + +use super::{ + chunk_noise::{ChunkNoiseDensityFunctions, ChunkNoiseState, LAVA_BLOCK, WATER_BLOCK}, + noise::{ + clamped_map, + density::{ + component_functions::ComponentReference, NoisePos, NoisePosImpl, UnblendedNoisePos, + }, + map, + }, + positions::{block_pos, chunk_pos, MIN_HEIGHT_CELL}, + proto_chunk::StandardChunkFluidLevelSampler, + section_coords, +}; + +pub enum BlockStateSampler { + Aquifer(AquiferSampler), + Ore(OreVeinSampler), + Chained(ChainedBlockStateSampler), } -impl VeinType { - pub fn min_y(&self) -> i32 { +impl BlockStateSampler { + pub fn sample( + &mut self, + pos: &NoisePos, + state: &ChunkNoiseState, + height_estimator: &mut ChunkNoiseDensityFunctions, + ) -> Option { match self { - Self::Copper => 0, - Self::Iron => -60, + Self::Aquifer(aquifer) => aquifer.apply(pos, state, height_estimator), + Self::Ore(ore) => ore.sample(pos, state), + Self::Chained(chained) => chained.sample(pos, state, height_estimator), } } +} - pub fn max_y(&self) -> i32 { - match self { - Self::Copper => 50, - Self::Iron => -8, +pub struct ChainedBlockStateSampler { + samplers: Vec, +} + +impl ChainedBlockStateSampler { + pub fn new(samplers: Vec) -> Self { + Self { samplers } + } + + fn sample( + &mut self, + pos: &NoisePos, + state: &ChunkNoiseState, + height_estimator: &mut ChunkNoiseDensityFunctions, + ) -> Option { + self.samplers + .iter_mut() + .map(|sampler| sampler.sample(pos, state, height_estimator)) + .find(|state| state.is_some()) + .unwrap_or(None) + } +} + +#[derive(Clone)] +pub struct FluidLevel { + max_y: i32, + state: BlockState, +} + +impl FluidLevel { + pub fn new(max_y: i32, state: BlockState) -> Self { + Self { max_y, state } + } + + pub fn max_y_exclusive(&self) -> i32 { + self.max_y + } + + fn get_block_state(&self, y: i32) -> BlockState { + if y < self.max_y { + self.state + } else { + BlockState::AIR } } +} + +#[enum_dispatch(FluidLevelSamplerImpl)] +pub enum FluidLevelSampler { + Static(StaticFluidLevelSampler), + Chunk(StandardChunkFluidLevelSampler), +} + +pub struct StaticFluidLevelSampler { + y: i32, + state: BlockState, +} - pub fn overall_min_y() -> i32 { - -60 +impl StaticFluidLevelSampler { + pub fn new(y: i32, state: BlockState) -> Self { + Self { y, state } } +} + +impl FluidLevelSamplerImpl for StaticFluidLevelSampler { + fn get_fluid_level(&self, _x: i32, _y: i32, _z: i32) -> FluidLevel { + FluidLevel::new(self.y, self.state) + } +} + +#[enum_dispatch] +pub trait FluidLevelSamplerImpl { + fn get_fluid_level(&self, x: i32, y: i32, z: i32) -> FluidLevel; +} + +#[enum_dispatch(AquiferSamplerImpl)] +pub enum AquiferSampler { + SeaLevel(SeaLevelAquiferSampler), + Aquifier(WorldAquiferSampler), +} + +pub struct WorldAquiferSampler { + barrier_noise: Box>, + fluid_level_floodedness: Box>, + fluid_level_spread: Box>, + fluid_type: Box>, + erosion: Box>, + depth: Box>, + function: Box>, + random_deriver: RandomDeriver, + fluid_level: FluidLevelSampler, + start_x: i32, + size_x: usize, + start_y: i8, + start_z: i32, + size_z: usize, + levels: Box<[Option]>, + positions: Box<[Option]>, +} + +impl WorldAquiferSampler { + const CHUNK_POS_OFFSETS: [Vector2; 13] = [ + Vector2::new(0, 0), + Vector2::new(-2, -1), + Vector2::new(-1, -1), + Vector2::new(0, -1), + Vector2::new(1, -1), + Vector2::new(-3, 0), + Vector2::new(-2, 0), + Vector2::new(-1, 0), + Vector2::new(1, 0), + Vector2::new(-2, 1), + Vector2::new(-1, 1), + Vector2::new(0, 1), + Vector2::new(1, 1), + ]; + + #[allow(clippy::too_many_arguments)] + pub fn new( + chunk_pos: Vector2, + barrier_noise: Box>, + fluid_level_floodedness: Box>, + fluid_level_spread: Box>, + fluid_type: Box>, + erosion: Box>, + depth: Box>, + function: Box>, + random_deriver: RandomDeriver, + minimum_y: i8, + height: u16, + fluid_level: FluidLevelSampler, + ) -> Self { + let start_x = Self::get_local_x(chunk_pos::start_block_x(&chunk_pos)) - 1; + let end_x = Self::get_local_x(chunk_pos::end_block_x(&chunk_pos)) + 1; + let size_x = (end_x - start_x) as usize + 1; + + let start_y = Self::get_local_y(minimum_y) - 1; + let end_y = Self::get_local_y(minimum_y as i32 + height as i32) + 1; + let size_y = (end_y - start_y as i32) as usize + 1; + + let start_z = Self::get_local_z(chunk_pos::start_block_z(&chunk_pos)) - 1; + let end_z = Self::get_local_z(chunk_pos::end_block_z(&chunk_pos)) + 1; + let size_z = (end_z - start_z) as usize + 1; + + let cache_size = size_x * size_y * size_z; + Self { + barrier_noise, + fluid_level_floodedness, + fluid_level_spread, + fluid_type, + erosion, + depth, + function, + random_deriver, + fluid_level, + start_x, + size_x, + start_y, + start_z, + size_z, + levels: vec![None; cache_size].into(), + positions: vec![None; cache_size].into(), + } + } + + #[inline] + fn index(&self, x: i32, y: i32, z: i32) -> usize { + let i = (x - self.start_x) as usize; + let j = (y - self.start_y as i32) as usize; + let k = (z - self.start_z) as usize; + + (j * self.size_z + k) * self.size_x + i + } + + #[inline] + fn max_distance(i: i32, a: i32) -> f64 { + 1f64 - ((a - i).abs() as f64) / 25f64 + } + + fn calculate_density( + &mut self, + pos: &NoisePos, + barrier_sample: &mut Option, + level_1: FluidLevel, + level_2: FluidLevel, + env: &ChunkNoiseState, + ) -> f64 { + let y = pos.y(); + let block_state1 = level_1.get_block_state(y); + let block_state2 = level_2.get_block_state(y); + + if (!block_state1.of_block(LAVA_BLOCK.block_id) + || !block_state2.of_block(WATER_BLOCK.block_id)) + && (!block_state1.of_block(WATER_BLOCK.block_id) + || !block_state2.of_block(LAVA_BLOCK.block_id)) + { + let level_diff = (level_1.max_y - level_2.max_y).abs(); + if level_diff == 0 { + 0f64 + } else { + let avg_level = 0.5f64 * (level_1.max_y + level_2.max_y) as f64; + let scaled_level = y as f64 + 0.5f64 - avg_level; + let halved_diff = level_diff as f64 / 2f64; + + let o = halved_diff - scaled_level.abs(); + let q = if scaled_level > 0f64 { + if o > 0f64 { + o / 1.5f64 + } else { + o / 2.5f64 + } + } else { + let p = 3f64 + o; + if p > 0f64 { + p / 3f64 + } else { + p / 10f64 + } + }; + + let r = if (-2f64..=2f64).contains(&q) { + if let Some(val) = barrier_sample { + *val + } else { + let sample = self.barrier_noise.sample_mut(pos, env); + *barrier_sample = Some(sample); + sample + } + } else { + 0f64 + }; + + 2f64 * (r + q) + } + } else { + 2f64 + } + } + + fn get_water_level( + &mut self, + packed: u64, + height_estimator: &mut ChunkNoiseDensityFunctions, + env: &ChunkNoiseState, + ) -> FluidLevel { + let x = block_pos::unpack_x(packed); + let y = block_pos::unpack_y(packed); + let z = block_pos::unpack_z(packed); + + let local_x = Self::get_local_x(x); + let local_y = Self::get_local_y(y); + let local_z = Self::get_local_z(z); + + let index = self.index(local_x, local_y, local_z); + if let Some(level) = &self.levels[index] { + level.clone() + } else { + let fluid_level = self.get_fluid_level(x, y, z, height_estimator, env); + self.levels[index] = Some(fluid_level.clone()); + fluid_level + } + } + + fn get_fluid_level( + &mut self, + block_x: i32, + block_y: i32, + block_z: i32, + height_estimator: &mut ChunkNoiseDensityFunctions, + env: &ChunkNoiseState, + ) -> FluidLevel { + let fluid_level = self.fluid_level.get_fluid_level(block_x, block_y, block_z); + let j = block_y + 12; + let k = block_y - 12; + let mut bl = false; + let mut min_surface_estimate = i32::MAX; + + for offset in Self::CHUNK_POS_OFFSETS { + let x = block_x + section_coords::section_to_block(offset.x) as i32; + let z = block_z + section_coords::section_to_block(offset.z) as i32; + + let n = height_estimator.estimate_surface_height(env, x, z); + let o = n + 8; + let bl2 = offset.x == 0 && offset.z == 0; + + if bl2 && k > o { + return fluid_level; + } + + let bl3 = j > o; + if bl3 || bl2 { + let fluid_level = self.fluid_level.get_fluid_level(x, o, z); + if !fluid_level.get_block_state(o).is_air() { + if bl2 { + bl = true; + } + + if bl3 { + return fluid_level; + } + } + } + + min_surface_estimate = min_surface_estimate.min(n); + } + + let p = self.get_fluid_block_y( + block_x, + block_y, + block_z, + fluid_level.clone(), + min_surface_estimate, + bl, + env, + ); + FluidLevel::new( + p, + self.get_fluid_block_state(block_x, block_y, block_z, fluid_level, p, env), + ) + } + + #[allow(clippy::too_many_arguments)] + fn get_fluid_block_y( + &mut self, + block_x: i32, + block_y: i32, + block_z: i32, + default_level: FluidLevel, + surface_height_estimate: i32, + bl: bool, + env: &ChunkNoiseState, + ) -> i32 { + let pos = NoisePos::Unblended(UnblendedNoisePos::new(block_x, block_y, block_z)); + + let is_deep_dark = self.erosion.sample_mut(&pos, env) < -0.225f32 as f64 + && self.depth.sample_mut(&pos, env) > 0.9f32 as f64; + + let (d, e) = if is_deep_dark { + (-1f64, -1f64) + } else { + let top_y = surface_height_estimate + 8 - block_y; + let f = if bl { + clamped_map(top_y as f64, 0f64, 64f64, 1f64, 0f64) + } else { + 0f64 + }; + + let g = self + .fluid_level_floodedness + .sample_mut(&pos, env) + .clamp(-1f64, 1f64); + let h = map(f, 1f64, 0f64, -0.3f64, 0.8f64); + let k = map(f, 1f64, 0f64, -0.8f64, 0.4f64); + + (g - k, g - h) + }; + + if e > 0f64 { + default_level.max_y + } else if d > 0f64 { + self.get_noise_based_fluid_level( + block_x, + block_y, + block_z, + surface_height_estimate, + env, + ) + } else { + MIN_HEIGHT_CELL + } + } + + fn get_noise_based_fluid_level( + &mut self, + block_x: i32, + block_y: i32, + block_z: i32, + surface_height_estimate: i32, + env: &ChunkNoiseState, + ) -> i32 { + let x = floor_div(block_x, 16); + let y = floor_div(block_y, 40); + let z = floor_div(block_z, 16); + + let local_y = y * 40 + 20; + let sample = self + .fluid_level_spread + .sample_mut(&NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)), env) + * 10f64; + let to_nearest_multiple_of_three = (sample / 3f64).floor() as i32 * 3; + let local_height = to_nearest_multiple_of_three + local_y; + + surface_height_estimate.min(local_height) + } + + fn get_fluid_block_state( + &mut self, + block_x: i32, + block_y: i32, + block_z: i32, + default_level: FluidLevel, + level: i32, + env: &ChunkNoiseState, + ) -> BlockState { + if level <= -10 + && level != MIN_HEIGHT_CELL + && !default_level.state.of_block(LAVA_BLOCK.block_id) + { + let x = floor_div(block_x, 64); + let y = floor_div(block_y, 40); + let z = floor_div(block_z, 64); + + let sample = self + .fluid_type + .sample_mut(&NoisePos::Unblended(UnblendedNoisePos::new(x, y, z)), env); + + if sample.abs() > 0.3f64 { + return *LAVA_BLOCK; + } + } + + default_level.state + } + + #[inline] + fn get_local_x(x: T) -> T + where + T: PrimInt + From, + { + floor_div(x, 16.into()) + } + + #[inline] + fn get_local_y(y: T) -> T + where + T: PrimInt + From, + { + floor_div(y, 12.into()) + } + + #[inline] + fn get_local_z(z: T) -> T + where + T: PrimInt + From, + { + floor_div(z, 16.into()) + } +} + +impl AquiferSamplerImpl for WorldAquiferSampler { + fn apply( + &mut self, + pos: &NoisePos, + state: &ChunkNoiseState, + height_estimator: &mut ChunkNoiseDensityFunctions, + ) -> Option { + let density = self.function.sample_mut(pos, state); + if density > 0f64 { + None + } else { + let i = pos.x(); + let j = pos.y(); + let k = pos.z(); + + let fluid_level = self.fluid_level.get_fluid_level(i, j, k); + if fluid_level.get_block_state(j).of_block(LAVA_BLOCK.block_id) { + Some(*LAVA_BLOCK) + } else { + let l = floor_div(i - 5, 16); + let m = floor_div(j + 1, 12); + let n = floor_div(k - 5, 16); + + let mut o = i32::MAX; + let mut p = i32::MAX; + let mut q = i32::MAX; + let mut r = i32::MAX; + + let mut s = 0; + let mut t = 0; + let mut u = 0; + let mut v = 0; + + for w in 0..=1 { + for x in -1..=1 { + for y in 0..=1 { + let z = l + w; + let aa = m + x; + let ab = n + y; + + let ac = self.index(z, aa, ab); + let ad = self.positions[ac]; + + let ae = if let Some(packed) = ad { + packed + } else { + let mut random = self.random_deriver.split_pos(z, aa, ab); + let block_x = z * 16 + random.next_bounded_i32(10); + let block_y = aa * 12 + random.next_bounded_i32(9); + let block_z = ab * 16 + random.next_bounded_i32(10); + + let packed = + block_pos::packed(&Vector3::new(block_x, block_y, block_z)); + self.positions[ac] = Some(packed); + packed + }; + + let af = block_pos::unpack_x(ae) - i; + let ag = block_pos::unpack_y(ae) - j; + let ah = block_pos::unpack_z(ae) - k; + + let ai = af * af + ag * ag + ah * ah; + if o >= ai { + v = u; + u = t; + t = s; + s = ae; + r = q; + q = p; + p = o; + o = ai; + } else if p >= ai { + v = u; + u = t; + t = ae; + r = q; + q = p; + p = ai; + } else if q >= ai { + v = u; + u = ae; + r = q; + q = ai; + } else if r >= ai { + v = ae; + r = ai; + } + } + } + } + + let fluid_level2 = self.get_water_level(s, height_estimator, state); + let d = Self::max_distance(o, p); + let block_state = fluid_level2.get_block_state(j); + + if d <= 0f64 { + // TODO: Handle fluid tick + Some(block_state) + } else if block_state.of_block(WATER_BLOCK.block_id) + && self + .fluid_level + .get_fluid_level(i, j - 1, k) + .get_block_state(j - 1) + .of_block(LAVA_BLOCK.block_id) + { + Some(block_state) + } else { + let mut mutable_f64 = None; + let fluid_level3 = self.get_water_level(t, height_estimator, state); + let e = d * self.calculate_density( + pos, + &mut mutable_f64, + fluid_level2.clone(), + fluid_level3.clone(), + state, + ); + if density + e > 0f64 { + None + } else { + let fluid_level4 = self.get_water_level(u, height_estimator, state); + let f = Self::max_distance(o, q); + if f > 0f64 { + let g = d + * f + * self.calculate_density( + pos, + &mut mutable_f64, + fluid_level2, + fluid_level4.clone(), + state, + ); + if density + g > 0f64 { + return None; + } + } + + let g = Self::max_distance(p, q); + if g > 0f64 { + let h = d + * g + * self.calculate_density( + pos, + &mut mutable_f64, + fluid_level3, + fluid_level4, + state, + ); + if density + h > 0f64 { + return None; + } + } + + //TODO Handle fluid tick + let _ = v; + + Some(block_state) + } + } + } + } + } +} + +pub struct SeaLevelAquiferSampler { + level_sampler: FluidLevelSampler, + function: Box>, +} + +impl SeaLevelAquiferSampler { + pub fn new( + level_sampler: FluidLevelSampler, + function: Box>, + ) -> Self { + Self { + level_sampler, + function, + } + } +} + +impl AquiferSamplerImpl for SeaLevelAquiferSampler { + fn apply( + &mut self, + pos: &NoisePos, + state: &ChunkNoiseState, + _height_estimator: &mut ChunkNoiseDensityFunctions, + ) -> Option { + let sample = self.function.sample_mut(pos, state); + //log::debug!("Aquifer sample {:?}: {}", &pos, sample); + if sample > 0f64 { + None + } else { + Some( + self.level_sampler + .get_fluid_level(pos.x(), pos.y(), pos.z()) + .get_block_state(pos.y()), + ) + } + } +} + +#[enum_dispatch] +trait AquiferSamplerImpl { + fn apply( + &mut self, + pos: &NoisePos, + state: &ChunkNoiseState, + height_estimator: &mut ChunkNoiseDensityFunctions, + ) -> Option; +} + +pub struct OreVeinSampler { + vein_toggle: Box>, + vein_ridged: Box>, + vein_gap: Box>, + random_deriver: RandomDeriver, +} + +impl OreVeinSampler { + pub fn new( + vein_toggle: Box>, + vein_ridged: Box>, + vein_gap: Box>, + random_deriver: RandomDeriver, + ) -> Self { + Self { + vein_toggle, + vein_ridged, + vein_gap, + random_deriver, + } + } +} + +impl OreVeinSampler { + fn sample(&mut self, pos: &NoisePos, state: &ChunkNoiseState) -> Option { + let vein_sample = self.vein_toggle.sample_mut(pos, state); + let vein_type: &VeinType = if vein_sample > 0f64 { + &vein_type::COPPER + } else { + &vein_type::IRON + }; + + let block_y = pos.y(); + let max_to_y = vein_type.max_y - block_y; + let y_to_min = block_y - vein_type.min_y; + if (max_to_y >= 0) && (y_to_min >= 0) { + let closest_to_bound = max_to_y.min(y_to_min); + let mapped_diff = clamped_map(closest_to_bound as f64, 0f64, 20f64, -0.2f64, 0f64); + let abs_sample = vein_sample.abs(); + if abs_sample + mapped_diff >= 0.4f32 as f64 { + let mut random = self.random_deriver.split_pos(pos.x(), block_y, pos.z()); + if random.next_f32() <= 0.7f32 && self.vein_ridged.sample_mut(pos, state) < 0f64 { + let clamped_sample = clamped_map( + abs_sample, + 0.4f32 as f64, + 0.6f32 as f64, + 0.1f32 as f64, + 0.3f32 as f64, + ); + + return if (random.next_f32() as f64) < clamped_sample + && self.vein_gap.sample_mut(pos, state) > (-0.3f32 as f64) + { + Some(if random.next_f32() < 0.02f32 { + vein_type.raw_ore + } else { + vein_type.ore + }) + } else { + Some(vein_type.stone) + }; + } + } + } + None + } +} + +pub struct VeinType { + ore: BlockState, + raw_ore: BlockState, + stone: BlockState, + min_y: i32, + max_y: i32, +} + +// One of the victims of removing compile time blocks +pub mod vein_type { + use super::*; - pub fn overall_max_y() -> i32 { - 60 + lazy_static! { + pub static ref COPPER: VeinType = VeinType { + ore: BlockState::new("minecraft:copper_ore").unwrap(), + raw_ore: BlockState::new("minecraft:raw_copper_block").unwrap(), + stone: BlockState::new("minecraft:granite").unwrap(), + min_y: 0, + max_y: 50, + }; + pub static ref IRON: VeinType = VeinType { + ore: BlockState::new("minecraft:deepslate_iron_ore").unwrap(), + raw_ore: BlockState::new("minecraft:raw_iron_block").unwrap(), + stone: BlockState::new("minecraft:tuff").unwrap(), + min_y: -60, + max_y: -8, + }; + pub static ref MIN_Y: i32 = IRON.min_y; + pub static ref MAX_Y: i32 = COPPER.max_y; } } diff --git a/pumpkin/src/command/commands/cmd_transfer.rs b/pumpkin/src/command/commands/cmd_transfer.rs index b73f2418b..1af9ae3c2 100644 --- a/pumpkin/src/command/commands/cmd_transfer.rs +++ b/pumpkin/src/command/commands/cmd_transfer.rs @@ -116,6 +116,7 @@ impl CommandExecutor for TransferTargetPlayer { } } +#[allow(clippy::redundant_closure_for_method_calls)] pub fn init_command_tree<'a>() -> CommandTree<'a> { CommandTree::new(NAMES, DESCRIPTION).with_child( require(&|sender| sender.has_permission_lvl(PermissionLvl::Three)).with_child(