R: Miscellaneous computational geometry and utility functions
mvmesh-geom
R Documentation
Miscellaneous computational geometry and utility functions
Description
EdgeSubdivision calculates an equal area/volume subdivision of a simplex.
AffineTransform defines a new mesh by translating all points x to x' = A
Rotate2D and Rotate3D calculate rotation matrices for use by AffineTransform.
Icosahedron returns the vertices of an icosahedron with vertices on the unit sphere
Other functions are internal functions, use at your own risk.
Usage
EdgeSubdivision( n, k )
EdgeSubdivisionMulti( V, SVI, k, normalize = FALSE, p = 2)
ConvertBase( m, b, n)
NumVertices( n, k, single = TRUE)
PointCoord( S, color )
SimplexCoord( S, color )
SVIFromColor( S, T )
MatchRow(v, table, first = 1, last = nrow(table))
AffineTransform( mesh, A, shift )
Rotate2D( theta )
Rotate3D( theta )
Icosahedron( )
V2Hrep( S )
H2Vrep( H )
SatisfyHrep( x, Hsingle )
HrepCones( S )
IntersectMultipleSimplicesV( S1, S2 )
IntersectMultipleSimplicesH( H1, H2 )
Intersect2SimplicesH( H1, H2, tesselate=FALSE )
Lift2UnitSimplex(S)
Arguments
v
a vector of length n
table
matrix of size m3 x n
first
row to start search
last
row to end search
mesh
object of class "mvmesh"
A
n x n matrix
shift
shift vector of length n
theta
rotation angle; in 2D, this is a single angle; in 3D is it a vector of length 3,
with theta[i] giving rotation around i-th axis
...
optional parameters to rgl plot commands
k
number of subdivisions
n
dimension of simplex
V
matrix of vertices; each row is a point in R^n
normalize
TRUE to normalize vertices to lie on the unit sphere in the l^p norm
p
power in the l^p norm
S,S1,S2
matrix of size (vps x n) specifying the vertices of a single simplex; S[j,] is the j-th vertex of S
SVI
Simplex Vertex Indices, see mvmesh
m
positive integer to be converted to base 'b'
b
positive integer, the base used to expess 'x'
single
If TRUE, return only one value; if FALSE, return table of values
color
color matrix, internal matrix used by EdgeSubdivision to subdivide a simplex
T
array giving a list of color matrices
H,H1,H2
array of simplices in the H-representation, H[,,k] is the H-representation for the k-th simplex
x
matrix with columns giving the points
Hsingle
matrix giving the H-representation of a single simplex
tesselate
TRUE to tesselate the resulting intersection
Details
AffineTransform computes a new mesh from a previous one, with each vertex v being replaced
by A
Rotate3D computes a 3D rotation matrix.
Icosahedron returns the vertices of the icosahedron with vertices on the
unit sphere
H2Vrep converts from the half-space (H) representation to the vertex (V) representation
of a simplex. V2Hrep converts from the V-representation to the H-representation.
It is assumed that all the resulting value are of the same dimension. If this is not the case,
an error will occur. To work with such cases, call the function separately for each simplex and save the result in
different size objects. The one place where this can occur with mvmesh objects is with a
PolarSphere or PolarBall: at the places where polar coordinates are nonunique, vertices
will repeat and the H-representation will have fewer constraints than other simplices.
IntersectMultipleSimplicesV computes the pairwise intersection of two lists of simplices given in the V-representation.
IntersectMultipleSimplicesH computes the pairwise intersection of two lists of simplices given in the H-representation.
Intersect2SimplicesH computes the intersection of two simplices, both specified in the H-representation.
Lift2UnitSimplex reverses the projection from the unit simplex in n-space to the first (n-1) coordinates. That is,
it 'lifts' each (n-1) dimensional simplex in R^(n-1) to the unit simplex in R^n by appending an n-th coordinate, with x[n] <- 1-sum(x[1:(n-1)]).
Value
MatchRow returns an integer vector, showing which rows of table match v.
If there are no matches, it returns integer(0).
AffineTransform returns an object of class "mvmesh".
Rotate2D returns a 2 x 2 rotation matrix,
Rotate3D returns a 3 x 3 rotation matrix.
EdgeSubdivision computes an edgewise subdivision of a simplex using the method of
Edelsbrunner and Grayson. The algorithm of Concalves, et. al. was implemented in R. It is a coordinate free
method. ConvertBase is an internal routine used by the subdivision algorithm.
NumVertices is a utility routine to recursively
calculate the number of vertices in an edgewise subdivision.
EdgeSubdivMulti is roughly a vectorized version of EdgeSubdivison. It takes a list
of simplices, and performs a k-subdivision of each simplex for function UnitSphere and
related functions. Since some simplices may share edges, the
same vertex can be occur multiple times, so this function goes through the resulting
vertices and eliminates repeats. This function is not meant to be called by an end user; it is not
guaranteed to be general.
ConvertBase is an internal function that converts a positve integer 'x' to an 'n' digit base 'b' representation.
NumVertices is an internal function that computes the number of simplices in an
edgewise subdivision (without doing the subdivision).
PointCoord is an internal function that computes a single vertex of a simplex.
SimplexCoord is an internal function that computes the coordinates of a simplex 'S' given color matrix 'color'.
SVIFromColor is an internal function that computes the SVI from a starting simplex 'S' and color array 'T'.
Note that rays and lines are not allowed in V2Hrep; use rcdd funtion makeH directly to use them.
EdgeSubdivision returns a color matrix, a coordinate free representaion of the subdivision.
One generally uses UnitSimplex or UnitBall to get a vertex representation of the subdivision.
EdgeSubdivMulti returns a list of class 'mvmesh'
References
Edelsbrunner and Grayson, Discrete Comput. Geom., Vol 24, 707-719 (2000).
Goncalves, Palhares, Takahashi, and Mesquita, Algorithm 860: SimpleS –
an extension of Freudenthal's simplex subdivision, ACM Trans. Math. Softw.,
32, 609-621 (2006).