The marching-cubes Reference Manual

This is the marching-cubes Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:58:39 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 marching-cubes

A marching cubes algorithm implementation in Common Lisp based on Paul Bourke’s (http://paulbourke.net/geometry/polygonise/)

Author

Masayuki Takagi

License

LLGPL

Long Description

# Marching-Cubes

A marching cubes algorithm implementation in Common Lisp based on Paul Bourke’s (http://paulbourke.net/geometry/polygonise/)

## API

### [Function] marching-cubes

MARCHING-CUBES density-function min-position max-position delta isolevel => triangles

Extracts a surface from density field represented with ‘density-function‘ and returns ‘triangles‘ which is a list of triangles. ‘density-function‘ is a function that takes three arguments representing the position of a point and returns density as a scalar at the point. ‘min-position‘ and ‘max-position‘ are ‘vec3‘ values and specify the minimun point and the maximun point of a grid to be processed. ‘delta‘ is a scalar that specifies the size of a cell in a grid to be processed. ‘isolevel‘ is a scalar that specifies the threshold of mesh construction.

### [Function] marching-cubes-smooth

MARCHING-CUBES-SMOOTH density-function normal-function min-position max-position delta isolevel => smooth-triangles

Same as ‘marching-cubes‘ except that ‘marching-cubes-smooth‘ returns a list of smooth triangles which have normal vectors at each vertex. ‘normal-function‘ is a function that takes three arguments representing the position of a point and returns a normal vector at the point. Other arguments are same as ‘marching-cubes‘’s.

## Example

See example/ directory.

## Author

* Masayuki Takagi (kamonama@gmail.com)

## Copyright

Copyright (c) 2012 Masayuki Takagi (kamonama@gmail.com)

## License

Licensed under the LLGPL License.

Version

1.0

Source

marching-cubes.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 marching-cubes/src

Source

marching-cubes.asd.

Parent Component

marching-cubes (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 marching-cubes/marching-cubes.asd

Source

marching-cubes.asd.

Parent Component

marching-cubes (system).

ASDF Systems

marching-cubes.

Packages

marching-cubes-asd.


4.1.2 marching-cubes/src/package.lisp

Source

marching-cubes.asd.

Parent Component

src (module).

Packages

marching-cubes.


4.1.3 marching-cubes/src/tables.lisp

Dependency

package.lisp (file).

Source

marching-cubes.asd.

Parent Component

src (module).

Internals

4.1.4 marching-cubes/src/marching-cubes.lisp

Dependency

tables.lisp (file).

Source

marching-cubes.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 marching-cubes-asd

Source

marching-cubes.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 marching-cubes

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Macros

Macro: smooth-triangle-normal (tri i)
Package

marching-cubes.

Source

marching-cubes.lisp.

Macro: smooth-triangle-vertex (tri i)
Package

marching-cubes.

Source

marching-cubes.lisp.

Macro: triangle-vertex (tri i)
Package

marching-cubes.

Source

marching-cubes.lisp.


6.1.2 Ordinary functions

Function: make-smooth-triangle (vertex-0 normal-0 vertex-1 normal-1 vertex-2 normal-2)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: make-triangle (vertex-0 vertex-1 vertex-2)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: make-vec3 (x y z)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: marching-cubes (fn min max delta isolevel)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: marching-cubes-smooth (fn-value fn-normal min max delta isolevel)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: normalize-vec3 (v)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: smooth-triangle= (a b)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: triangle= (a b)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: vec3-x (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

x.

Reader: vec3-y (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

y.

Reader: vec3-z (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

z.

Function: vec3= (a b)
Package

marching-cubes.

Source

marching-cubes.lisp.


6.2 Internals


6.2.1 Special variables

Special Variable: *vertex-offsets*
Package

marching-cubes.

Source

marching-cubes.lisp.

Special Variable: +edge-table+
Package

marching-cubes.

Source

tables.lisp.

Special Variable: +tri-table+
Package

marching-cubes.

Source

tables.lisp.


6.2.2 Macros

Macro: grid-cell-value (grid i)
Package

marching-cubes.

Source

marching-cubes.lisp.

Macro: grid-cell-vertex (grid i)
Package

marching-cubes.

Source

marching-cubes.lisp.

Macro: inc-logior (x val)
Package

marching-cubes.

Source

marching-cubes.lisp.


6.2.3 Ordinary functions

Function: copy-grid (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: copy-grid-cell (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: copy-smooth-triangle (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: copy-triangle (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: copy-vec3 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: degenerate-triangle (tri)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: grid-cell (grid i j k)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: grid-cell-p (object)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: grid-cell-values (grid i j k)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: grid-cell-values% (instance)
Writer: (setf grid-cell-values%) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

values%.

Function: grid-cell-vertices (grid i j k)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: grid-cell-vertices% (instance)
Writer: (setf grid-cell-vertices%) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertices%.

Reader: grid-delta (instance)
Writer: (setf grid-delta) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

delta.

Reader: grid-max (instance)
Writer: (setf grid-max) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

max.

Reader: grid-min (instance)
Writer: (setf grid-min) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

min.

Function: grid-p (object)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: grid-point (grid i j k)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: grid-size-x (instance)
Writer: (setf grid-size-x) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

size-x.

Reader: grid-size-y (instance)
Writer: (setf grid-size-y) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

size-y.

Reader: grid-size-z (instance)
Writer: (setf grid-size-z) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

size-z.

Function: grid-value (grid i j k)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: grid-values% (instance)
Writer: (setf grid-values%) (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

values%.

Function: make-grid (fn min max delta)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: make-grid-cell (vertices% values%)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: make-grid-values (fn i j k origin delta)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: make-raw-grid (min max size-x size-y size-z delta values%)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: polygonise (grid isolevel)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: reduce-grid (grid fn)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: remove-degenerate-triangles (tris)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: smooth-triangle-normal-0 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

normal-0.

Reader: smooth-triangle-normal-1 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

normal-1.

Reader: smooth-triangle-normal-2 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

normal-2.

Function: smooth-triangle-p (object)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: smooth-triangle-vertex-0 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-0.

Reader: smooth-triangle-vertex-1 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-1.

Reader: smooth-triangle-vertex-2 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-2.

Function: to-smooth-triangle (tri fn)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: triangle-p (object)
Package

marching-cubes.

Source

marching-cubes.lisp.

Reader: triangle-vertex-0 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-0.

Reader: triangle-vertex-1 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-1.

Reader: triangle-vertex-2 (instance)
Package

marching-cubes.

Source

marching-cubes.lisp.

Target Slot

vertex-2.

Function: vec3-p (object)
Package

marching-cubes.

Source

marching-cubes.lisp.

Function: vertex-interop (isolevel p1 p2 val1 val2)
Package

marching-cubes.

Source

marching-cubes.lisp.


6.2.4 Structures

Structure: grid
Package

marching-cubes.

Source

marching-cubes.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: min
Package

common-lisp.

Readers

grid-min.

Writers

(setf grid-min).

Slot: max
Package

common-lisp.

Readers

grid-max.

Writers

(setf grid-max).

Slot: size-x
Readers

grid-size-x.

Writers

(setf grid-size-x).

Slot: size-y
Readers

grid-size-y.

Writers

(setf grid-size-y).

Slot: size-z
Readers

grid-size-z.

Writers

(setf grid-size-z).

Slot: delta
Readers

grid-delta.

Writers

(setf grid-delta).

Slot: values%
Readers

grid-values%.

Writers

(setf grid-values%).

Structure: grid-cell
Package

marching-cubes.

Source

marching-cubes.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: vertices%
Readers

grid-cell-vertices%.

Writers

(setf grid-cell-vertices%).

Slot: values%
Readers

grid-cell-values%.

Writers

(setf grid-cell-values%).

Structure: smooth-triangle
Package

marching-cubes.

Source

marching-cubes.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: vertex-0
Readers

smooth-triangle-vertex-0.

Writers

This slot is read-only.

Slot: normal-0
Readers

smooth-triangle-normal-0.

Writers

This slot is read-only.

Slot: vertex-1
Readers

smooth-triangle-vertex-1.

Writers

This slot is read-only.

Slot: normal-1
Readers

smooth-triangle-normal-1.

Writers

This slot is read-only.

Slot: vertex-2
Readers

smooth-triangle-vertex-2.

Writers

This slot is read-only.

Slot: normal-2
Readers

smooth-triangle-normal-2.

Writers

This slot is read-only.

Structure: triangle
Package

marching-cubes.

Source

marching-cubes.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: vertex-0
Readers

triangle-vertex-0.

Writers

This slot is read-only.

Slot: vertex-1
Readers

triangle-vertex-1.

Writers

This slot is read-only.

Slot: vertex-2
Readers

triangle-vertex-2.

Writers

This slot is read-only.

Structure: vec3
Package

marching-cubes.

Source

marching-cubes.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: x
Initform

0

Readers

vec3-x.

Writers

This slot is read-only.

Slot: y
Initform

0

Readers

vec3-y.

Writers

This slot is read-only.

Slot: z
Initform

0

Readers

vec3-z.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   F   G   I   M   N   P   R   S   T   V  
Index Entry  Section

(
(setf grid-cell-values%): Private ordinary functions
(setf grid-cell-vertices%): Private ordinary functions
(setf grid-delta): Private ordinary functions
(setf grid-max): Private ordinary functions
(setf grid-min): Private ordinary functions
(setf grid-size-x): Private ordinary functions
(setf grid-size-y): Private ordinary functions
(setf grid-size-z): Private ordinary functions
(setf grid-values%): Private ordinary functions

C
copy-grid: Private ordinary functions
copy-grid-cell: Private ordinary functions
copy-smooth-triangle: Private ordinary functions
copy-triangle: Private ordinary functions
copy-vec3: Private ordinary functions

D
degenerate-triangle: Private ordinary functions

F
Function, (setf grid-cell-values%): Private ordinary functions
Function, (setf grid-cell-vertices%): Private ordinary functions
Function, (setf grid-delta): Private ordinary functions
Function, (setf grid-max): Private ordinary functions
Function, (setf grid-min): Private ordinary functions
Function, (setf grid-size-x): Private ordinary functions
Function, (setf grid-size-y): Private ordinary functions
Function, (setf grid-size-z): Private ordinary functions
Function, (setf grid-values%): Private ordinary functions
Function, copy-grid: Private ordinary functions
Function, copy-grid-cell: Private ordinary functions
Function, copy-smooth-triangle: Private ordinary functions
Function, copy-triangle: Private ordinary functions
Function, copy-vec3: Private ordinary functions
Function, degenerate-triangle: Private ordinary functions
Function, grid-cell: Private ordinary functions
Function, grid-cell-p: Private ordinary functions
Function, grid-cell-values: Private ordinary functions
Function, grid-cell-values%: Private ordinary functions
Function, grid-cell-vertices: Private ordinary functions
Function, grid-cell-vertices%: Private ordinary functions
Function, grid-delta: Private ordinary functions
Function, grid-max: Private ordinary functions
Function, grid-min: Private ordinary functions
Function, grid-p: Private ordinary functions
Function, grid-point: Private ordinary functions
Function, grid-size-x: Private ordinary functions
Function, grid-size-y: Private ordinary functions
Function, grid-size-z: Private ordinary functions
Function, grid-value: Private ordinary functions
Function, grid-values%: Private ordinary functions
Function, make-grid: Private ordinary functions
Function, make-grid-cell: Private ordinary functions
Function, make-grid-values: Private ordinary functions
Function, make-raw-grid: Private ordinary functions
Function, make-smooth-triangle: Public ordinary functions
Function, make-triangle: Public ordinary functions
Function, make-vec3: Public ordinary functions
Function, marching-cubes: Public ordinary functions
Function, marching-cubes-smooth: Public ordinary functions
Function, normalize-vec3: Public ordinary functions
Function, polygonise: Private ordinary functions
Function, reduce-grid: Private ordinary functions
Function, remove-degenerate-triangles: Private ordinary functions
Function, smooth-triangle-normal-0: Private ordinary functions
Function, smooth-triangle-normal-1: Private ordinary functions
Function, smooth-triangle-normal-2: Private ordinary functions
Function, smooth-triangle-p: Private ordinary functions
Function, smooth-triangle-vertex-0: Private ordinary functions
Function, smooth-triangle-vertex-1: Private ordinary functions
Function, smooth-triangle-vertex-2: Private ordinary functions
Function, smooth-triangle=: Public ordinary functions
Function, to-smooth-triangle: Private ordinary functions
Function, triangle-p: Private ordinary functions
Function, triangle-vertex-0: Private ordinary functions
Function, triangle-vertex-1: Private ordinary functions
Function, triangle-vertex-2: Private ordinary functions
Function, triangle=: Public ordinary functions
Function, vec3-p: Private ordinary functions
Function, vec3-x: Public ordinary functions
Function, vec3-y: Public ordinary functions
Function, vec3-z: Public ordinary functions
Function, vec3=: Public ordinary functions
Function, vertex-interop: Private ordinary functions

G
grid-cell: Private ordinary functions
grid-cell-p: Private ordinary functions
grid-cell-value: Private macros
grid-cell-values: Private ordinary functions
grid-cell-values%: Private ordinary functions
grid-cell-vertex: Private macros
grid-cell-vertices: Private ordinary functions
grid-cell-vertices%: Private ordinary functions
grid-delta: Private ordinary functions
grid-max: Private ordinary functions
grid-min: Private ordinary functions
grid-p: Private ordinary functions
grid-point: Private ordinary functions
grid-size-x: Private ordinary functions
grid-size-y: Private ordinary functions
grid-size-z: Private ordinary functions
grid-value: Private ordinary functions
grid-values%: Private ordinary functions

I
inc-logior: Private macros

M
Macro, grid-cell-value: Private macros
Macro, grid-cell-vertex: Private macros
Macro, inc-logior: Private macros
Macro, smooth-triangle-normal: Public macros
Macro, smooth-triangle-vertex: Public macros
Macro, triangle-vertex: Public macros
make-grid: Private ordinary functions
make-grid-cell: Private ordinary functions
make-grid-values: Private ordinary functions
make-raw-grid: Private ordinary functions
make-smooth-triangle: Public ordinary functions
make-triangle: Public ordinary functions
make-vec3: Public ordinary functions
marching-cubes: Public ordinary functions
marching-cubes-smooth: Public ordinary functions

N
normalize-vec3: Public ordinary functions

P
polygonise: Private ordinary functions

R
reduce-grid: Private ordinary functions
remove-degenerate-triangles: Private ordinary functions

S
smooth-triangle-normal: Public macros
smooth-triangle-normal-0: Private ordinary functions
smooth-triangle-normal-1: Private ordinary functions
smooth-triangle-normal-2: Private ordinary functions
smooth-triangle-p: Private ordinary functions
smooth-triangle-vertex: Public macros
smooth-triangle-vertex-0: Private ordinary functions
smooth-triangle-vertex-1: Private ordinary functions
smooth-triangle-vertex-2: Private ordinary functions
smooth-triangle=: Public ordinary functions

T
to-smooth-triangle: Private ordinary functions
triangle-p: Private ordinary functions
triangle-vertex: Public macros
triangle-vertex-0: Private ordinary functions
triangle-vertex-1: Private ordinary functions
triangle-vertex-2: Private ordinary functions
triangle=: Public ordinary functions

V
vec3-p: Private ordinary functions
vec3-x: Public ordinary functions
vec3-y: Public ordinary functions
vec3-z: Public ordinary functions
vec3=: Public ordinary functions
vertex-interop: Private ordinary functions


A.3 Variables

Jump to:   *   +  
D   M   N   S   V   X   Y   Z  
Index Entry  Section

*
*vertex-offsets*: Private special variables

+
+edge-table+: Private special variables
+tri-table+: Private special variables

D
delta: Private structures

M
max: Private structures
min: Private structures

N
normal-0: Private structures
normal-1: Private structures
normal-2: Private structures

S
size-x: Private structures
size-y: Private structures
size-z: Private structures
Slot, delta: Private structures
Slot, max: Private structures
Slot, min: Private structures
Slot, normal-0: Private structures
Slot, normal-1: Private structures
Slot, normal-2: Private structures
Slot, size-x: Private structures
Slot, size-y: Private structures
Slot, size-z: Private structures
Slot, values%: Private structures
Slot, values%: Private structures
Slot, vertex-0: Private structures
Slot, vertex-0: Private structures
Slot, vertex-1: Private structures
Slot, vertex-1: Private structures
Slot, vertex-2: Private structures
Slot, vertex-2: Private structures
Slot, vertices%: Private structures
Slot, x: Private structures
Slot, y: Private structures
Slot, z: Private structures
Special Variable, *vertex-offsets*: Private special variables
Special Variable, +edge-table+: Private special variables
Special Variable, +tri-table+: Private special variables

V
values%: Private structures
values%: Private structures
vertex-0: Private structures
vertex-0: Private structures
vertex-1: Private structures
vertex-1: Private structures
vertex-2: Private structures
vertex-2: Private structures
vertices%: Private structures

X
x: Private structures

Y
y: Private structures

Z
z: Private structures