Home Reference Source
import {FractalNoise} from 'rabbit-hole'
public class | source

FractalNoise

Extends:

SignedDistanceFunction → FractalNoise

Indirect Implements:

Fractal noise based on Perlin's technique.

Reference: https://gpfault.net/posts/perlin-noise.txt.html

Constructor Summary

Public Constructor
public

constructor(parameters: Object, material: Number)

Constructs a new perlin noise density field.

Member Summary

Public Members
public

bbox: *

public

max: Vector3

The upper bounds of this density field.

public

min: Vector3

The upper bounds of this density field.

Method Summary

Public Methods
public

Calculates the bounding box of this density field.

public

sample(position: Vector3): Number

Samples the volume's density at the given point in space.

public

Serialises this SDF.

Inherited Summary

From class SignedDistanceFunction
public

The inverted transformation matrix.

public

A material index.

public

The operation type.

public

position: Vector3

The positional translation.

public

quaternion: Quaternion

The rotation.

public

scale: Vector3

The scale.

public

The type of this SDF.

protected

boundingBox: Box3

The axis-aligned bounding box of this SDF.

public

createTransferList(transferList: Array): Transferable[]

Creates a list of transferable items.

public

getBoundingBox(recursive: Boolean): Box3

Calculates the AABB of this SDF if it doesn't exist yet and returns it.

public

getTransformation(matrix: Matrix4): Matrix4

Composes a transformation matrix using the translation, rotation and scale of this SDF.

public

Intersects the given SDF with this one.

public

sample(position: Vector3): Number

Samples the volume's density at the given point in space.

public

serialize(deflate: Boolean): Object

Serialises this SDF.

public

Sets the material.

public

Sets the CSG operation type of this SDF.

public

Subtracts the given SDF from this one.

public

Translates this SDF into a CSG expression.

public

Returns a plain object that describes this SDF.

public

Adds the given SDF to this one.

public

Updates the inverse transformation matrix.

protected

Calculates the bounding box of this SDF.

Public Constructors

public constructor(parameters: Object, material: Number) source

Constructs a new perlin noise density field.

Override:

SignedDistanceFunction#constructor

Params:

NameTypeAttributeDescription
parameters Object

The parameters.

material Number
  • optional

A material index.

Public Members

public bbox: * source

public max: Vector3 source

The upper bounds of this density field.

public min: Vector3 source

The upper bounds of this density field.

Public Methods

public computeBoundingBox(): Box3 source

Calculates the bounding box of this density field.

Override:

SignedDistanceFunction#computeBoundingBox

Return:

Box3

The bounding box.

public sample(position: Vector3): Number source

Samples the volume's density at the given point in space.

Override:

SignedDistanceFunction#sample

Params:

NameTypeAttributeDescription
position Vector3

A position.

Return:

Number

The euclidean distance to the surface.

public serialize(toJSON: Boolean): Object source

Serialises this SDF.

Override:

SignedDistanceFunction#serialize

Params:

NameTypeAttributeDescription
toJSON Boolean
  • optional
  • default: false

Whether the serialised data will be stringified.

Return:

Object

A serialised description of this SDF.