Description Usage Arguments Details Value References See Also Examples

Computes a 3D contours or isosurface by the marching cubes algorithm.

1 2 3 4 | ```
computeContour3d(vol, maxvol = max(vol), level,
x = 1:dim(vol)[1],
y = 1:dim(vol)[2],
z = 1:dim(vol)[3], mask)
``` |

`vol` |
a three dimensional array. |

`maxvol` |
maximum of the |

`level` |
The level at which to construct the contour surface. |

`x,y,z` |
locations of grid planes at which values in |

`mask` |
a function of 3 arguments returning a logical array, a
three dimensional logical array, or |

Uses the marching-cubes algorithm, with adjustments for dealing with
face and internal ambiguities, to compute an isosurface.
See references for the details. The function
`contour3d`

provides a higher-level interface.

A matrix of three columns representing the triangles making up the contour surface. Each row represents a vertex and goups of three rows represent a triangle.

Chernyaev E. (1995)
Marching Cubes 33: Construction of Topologically Correct Isosurfaces
*Technical Report CN/95-17, CERN*

Lorensen W. and Cline H. (1987)
Marching Cubes: A High Resolution 3D Surface Reconstruction Algorithm
*Computer Graphics* **vol. 21, no. 4**, 163-169

Nielson G. and Hamann B. (1992)
The Asymptotic Decider: Resolving the Ambiguity in Marching Cubes
*Proc. IEEE Visualization* **92**, 83-91

1 2 3 4 5 | ```
x <- seq(-2,2,len=50)
g <- expand.grid(x = x, y = x, z = x)
v <- array(g$x^4 + g$y^4 + g$z^4, rep(length(x),3))
con <- computeContour3d(v, max(v), 1)
drawScene(makeTriangles(con))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.