File: subdivision3d.Rd

package info (click to toggle)
rgl 1.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,968 kB
  • sloc: cpp: 23,234; ansic: 7,462; javascript: 5,668; sh: 3,555; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 2,628 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
\name{subdivision3d}
\alias{subdivision3d}
\alias{subdivision3d.mesh3d}
\alias{divide.mesh3d}
\alias{normalize.mesh3d}
\alias{deform.mesh3d}
\title{Subdivide a mesh}
\description{
The subdivision surface algorithm divides and refines (deforms) a
given mesh recursively to certain degree (depth).
The mesh3d algorithm consists of two stages: divide and deform.
The divide step generates for each triangle or quad four new triangles or quads, the deform
step drags the points (refinement step).
}
\usage{
  subdivision3d( x,  ...)
  \method{subdivision3d}{mesh3d}( x, depth = 1, normalize = FALSE,
                deform = TRUE, keepTags = FALSE, ... )
  divide.mesh3d(mesh,  vb = mesh$vb, 
                ib = mesh$ib, it = mesh$it, is = mesh$is,
                keepTags = FALSE)
  normalize.mesh3d(mesh)
  deform.mesh3d(mesh, vb = mesh$vb, ib = mesh$ib, it = mesh$it,
                is = mesh$is)
}
\arguments{
  \item{x}{3d geometry mesh}
  \item{mesh}{3d geometry mesh}
  \item{depth}{recursion depth}
  \item{normalize}{normalize mesh3d coordinates after division if \code{deform} is \code{TRUE}}
  \item{deform}{deform mesh}
  \item{keepTags}{if \code{TRUE}, add a \code{"tags"}
  component to the output.}
  \item{is}{indices for segments}
  \item{it}{indices for triangular faces}
  \item{ib}{indices for quad faces}
  \item{vb}{matrix of vertices: 4 x n matrix (rows x, y, z, h) or equivalent
    vector, where h indicates scaling of each plotted quad}
  \item{...}{other arguments (unused)}
}
\details{
\code{subdivision3d} takes
a mesh object and replaces each segment with two new ones, and 
each triangle or quad with 4 new ones
by adding vertices half-way along the edges (and one in the
centre of a quad).  The positions of the vertices are 
deformed so that the resulting surface is smoother than the original.  These operations are repeated \code{depth} times.

The other functions do the individual steps of the subdivision.
\code{divide.mesh3d} adds the extra vertices.  \code{deform.mesh3d}
does the smoothing by replacing each vertex with the average of each of its neighbours. \code{normalize.mesh3d} 
normalizes the homogeneous coordinates, by setting the 
4th coordinate to 1.  (The 4th coordinate is used as a
weight in the deform step.)
}
\value{
A modified \code{\link{mesh3d}} object.  If \code{keepTags} is
\code{TRUE}, it will contain a \code{tags} component.  For
details, see the \code{\link{clipMesh3d}} help topic.
}

\examples{
  open3d()
  shade3d( subdivision3d( cube3d(), depth = 3 ), color = "red", alpha = 0.5 )
}
\seealso{
  \code{\link{r3d}}
  \code{\link{mesh3d}}
}
\keyword{dynamic}