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

Edge

An edge between two material grid points.

Constructor Summary

Public Constructor
public

constructor(a: Vector3, b: Vector3)

Constructs a new edge.

Member Summary

Public Members
public

a: Vector3

The starting point of the edge.

public

b: Vector3

The ending point of the edge.

public

coordinates: Vector3

The local grid coordinates of the starting point.

public

The index of the starting material grid point.

public

n: Vector3

The surface normal at the Zero Crossing position.

public

The Zero Crossing interpolation value.

Method Summary

Public Methods
public

Approximates the smallest density along the edge.

public

Computes the normal of the surface at the edge intersection.

public

computeZeroCrossingPosition(target: Vector3): Vector3

Calculates the Zero Crossing position.

Public Constructors

public constructor(a: Vector3, b: Vector3) source

Constructs a new edge.

Params:

NameTypeAttributeDescription
a Vector3
  • optional

A starting point. If none is provided, a new vector will be created.

b Vector3
  • optional

An ending point. If none is provided, a new vector will be created.

Public Members

public a: Vector3 source

The starting point of the edge.

public b: Vector3 source

The ending point of the edge.

public coordinates: Vector3 source

The local grid coordinates of the starting point.

public index: Number source

The index of the starting material grid point.

public n: Vector3 source

The surface normal at the Zero Crossing position.

public t: Number source

The Zero Crossing interpolation value.

Public Methods

public approximateZeroCrossing(sdf: SignedDistanceFunction, steps: Number) source

Approximates the smallest density along the edge.

Params:

NameTypeAttributeDescription
sdf SignedDistanceFunction

A density field.

steps Number
  • optional
  • default: 8

The maximum number of interpolation steps. Cannot be smaller than 2.

public computeSurfaceNormal(sdf: SignedDistanceFunction): Vector3 source

Computes the normal of the surface at the edge intersection.

Params:

NameTypeAttributeDescription
sdf SignedDistanceFunction

A density field.

Return:

Vector3

The normal.

TODO:

  • Use analytical derivation instead of finite differences.

public computeZeroCrossingPosition(target: Vector3): Vector3 source

Calculates the Zero Crossing position.

Params:

NameTypeAttributeDescription
target Vector3

A target for the Zero Crossing position. If none is provided, a new vector will be created.

Return:

Vector3

The Zero Crossing position.