import { Holder } from '../core/index.js'; import type { BlendedNoise, Noise } from '../math/index.js'; import { CubicSpline, Interval, NormalNoise, Vector } from '../math/index.js'; import type { DensityVolume } from './DensityVolume.js'; export declare abstract class DensityFunction { abstract compute(context: DensityFunction.Context): number; computeVolume(volume: DensityVolume): number[]; abstract mapChildren(visitor: DensityFunction.Visitor): DensityFunction; mapAll(visitor: DensityFunction.Visitor): DensityFunction; abstract range(): Interval; } export declare namespace DensityFunction { export interface Visitor { apply: (density: DensityFunction) => DensityFunction; } export interface Context { x: number; y: number; z: number; } export function context(x: number, y: number, z: number): Context; abstract class Transformer extends DensityFunction { readonly input: DensityFunction; constructor(input: DensityFunction); abstract transform(context: Context, density: number): number; compute(context: Context): number; } export function fromJson(obj: unknown, inputParser?: (obj: unknown) => DensityFunction): DensityFunction; export class Constant extends DensityFunction { readonly value: number; static ZERO: Constant; static ONE: Constant; constructor(value: number); compute(): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class HolderHolder extends DensityFunction { readonly holder: Holder; constructor(holder: Holder); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class ConstantMinMax extends DensityFunction.Constant { private readonly min; private readonly max; constructor(value: number, min: number, max: number); range(): Interval; } export class OldBlendedNoise extends DensityFunction { readonly xzScale: number; readonly yScale: number; readonly xzFactor: number; readonly yFactor: number; readonly smearScaleMultiplier: number; private readonly blendedNoise?; constructor(xzScale: number, yScale: number, xzFactor: number, yFactor: number, smearScaleMultiplier: number, blendedNoise?: BlendedNoise | undefined); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Cache extends DensityFunction { readonly input: DensityFunction; constructor(input: DensityFunction); compute(context: DensityFunction.Context): number; mapChildren(visitor: Visitor): Cache; range(): Interval; } export class Interpolated extends DensityFunction { readonly input: DensityFunction; readonly cellSizeXz: number; readonly cellSizeY: number; private readonly values; constructor(input: DensityFunction, cellSizeXz: number, cellSizeY: number); compute({ x: blockX, y: blockY, z: blockZ }: DensityFunction.Context): number; private computeCorner; mapChildren(visitor: Visitor): Interpolated; range(): Interval; } export class NoiseFunction extends DensityFunction { readonly noise: Holder; readonly xzScale: number; readonly yScale: number; readonly shiftX: DensityFunction; readonly shiftY: DensityFunction; readonly shiftZ: DensityFunction; readonly noiseSampler?: Noise | undefined; constructor(noise: Holder, xzScale: number, yScale: number, shiftX: DensityFunction, shiftY: DensityFunction, shiftZ: DensityFunction, noiseSampler?: Noise | undefined); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class EndOuterIslands extends DensityFunction { private readonly islandNoise; constructor(seed?: bigint); private getHeightValue; compute({ x, y, z }: DensityFunction.Context): number; mapChildren(visitor: Visitor): this; range(): Interval; } export class FindTopSurface extends DensityFunction { readonly density: DensityFunction; readonly upperBound: DensityFunction; readonly lowerBound: number; readonly cellHeight: number; constructor(density: DensityFunction, upperBound: DensityFunction, lowerBound: number, cellHeight: number); compute(context: DensityFunction.Context): number; mapChildren(visitor: Visitor): FindTopSurface; range(): Interval; } export class RangeChoice extends DensityFunction { readonly input: DensityFunction; readonly minInclusive: number; readonly maxExclusive: number; readonly whenInRange: DensityFunction; readonly whenOutOfRange: DensityFunction; constructor(input: DensityFunction, minInclusive: number, maxExclusive: number, whenInRange: DensityFunction, whenOutOfRange: DensityFunction); compute(context: Context): number; mapChildren(visitor: Visitor): RangeChoice; range(): Interval; } export abstract class ShiftNoise extends DensityFunction { readonly noise: Holder; readonly noiseSampler?: Noise | undefined; constructor(noise: Holder, noiseSampler?: Noise | undefined); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; abstract withNewNoise(noiseSampler: Noise): ShiftNoise; } export class ShiftA extends ShiftNoise { constructor(noise: Holder, noiseSampler?: Noise); compute(context: Context): number; withNewNoise(noiseSampler: Noise): ShiftA; } export class ShiftB extends ShiftNoise { constructor(noise: Holder, noiseSampler?: Noise); compute(context: Context): number; withNewNoise(noiseSampler: Noise): ShiftB; } export class Shift extends ShiftNoise { constructor(noise: Holder, noiseSampler?: Noise); withNewNoise(noiseSampler: Noise): Shift; } export class BlendDensity extends Transformer { constructor(input: DensityFunction); transform(context: Context, density: number): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Clamp extends Transformer { readonly min: number; readonly max: number; constructor(input: DensityFunction, min: number, max: number); transform(context: Context, density: number): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class IntervalSelect extends DensityFunction { readonly input: DensityFunction; readonly thresholds: number[]; readonly functions: DensityFunction[]; constructor(input: DensityFunction, thresholds: number[], functions: DensityFunction[]); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } const UnaryType: readonly ["abs", "square", "cube", "sqrt", "half_negative", "quarter_negative", "squeeze", "reciprocal", "negate", "log", "sign"]; export class Unary extends Transformer { readonly type: typeof UnaryType[number]; constructor(type: typeof UnaryType[number], input: DensityFunction); transform(context: Context, density: number): number; private static transform; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } const BinaryType: readonly ["add", "sub", "mul", "div", "min", "max"]; export class Binary extends DensityFunction { readonly type: typeof BinaryType[number]; readonly left: DensityFunction; readonly right: DensityFunction; private rightRange; constructor(type: typeof BinaryType[number], left: DensityFunction, right: DensityFunction); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; trySimplify(): DensityFunction; } const MulOrAddType: readonly ["add", "mul"]; export class MulOrAdd extends Transformer { private readonly type; private readonly value; constructor(type: typeof MulOrAddType[number], input: DensityFunction, value: number); transform(context: Context, density: number): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Spline extends DensityFunction { readonly spline: CubicSpline; constructor(spline: CubicSpline); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } const AxisType: readonly ["x", "y", "z"]; const TilingType: readonly ["clamp_to_edge", "repeat", "mirrored_repeat"]; export class Gradient extends DensityFunction { readonly axis: typeof AxisType[number]; readonly tiling: typeof TilingType[number]; readonly fromCoordinate: number; readonly toCoordinate: number; readonly fromValue: number; readonly toValue: number; constructor(axis: typeof AxisType[number], tiling: typeof TilingType[number], fromCoordinate: number, toCoordinate: number, fromValue: number, toValue: number); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Lerp extends DensityFunction { readonly alpha: DensityFunction; readonly first: DensityFunction; readonly second: DensityFunction; constructor(alpha: DensityFunction, first: DensityFunction, second: DensityFunction); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } const RoundType: readonly ["floor", "round", "ceil", "truncate"]; export class Round extends DensityFunction { readonly type: typeof RoundType[number]; readonly input: DensityFunction; readonly multiple: DensityFunction; constructor(type: typeof RoundType[number], input: DensityFunction, multiple: DensityFunction); compute(context: Context): number; private roundToInteger; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Pow extends DensityFunction { readonly base: DensityFunction; readonly exponent: DensityFunction; constructor(base: DensityFunction, exponent: DensityFunction); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } const DistanceMetric: readonly ["euclidean", "euclidean_squared", "manhattan", "chebyshev"]; export class DistanceToPoint extends DensityFunction { readonly point: Vector; readonly metric: typeof DistanceMetric[number]; constructor(point: Vector, metric: typeof DistanceMetric[number]); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export class Slice extends DensityFunction { readonly axis: typeof AxisType[number]; readonly coordinate: number; readonly input: DensityFunction; constructor(axis: typeof AxisType[number], coordinate: number, input: DensityFunction); compute(context: Context): number; mapChildren(visitor: Visitor): DensityFunction; range(): Interval; } export {}; } //# sourceMappingURL=DensityFunction.d.ts.map