delaunayn              package:geometry              R Documentation

_D_e_l_a_u_n_a_y _t_r_i_a_n_g_u_l_a_t_i_o_n _i_n _N-_d_i_m_e_n_s_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     The Delaunay triangulation is a tessellation of the convex hull of
     the points such that no n-sphere defined by the n-triangles
     contains any other points from the set.

_U_s_a_g_e:

     delaunayn(p, options = "QJ")

_A_r_g_u_m_e_n_t_s:

       p: 'p' is an 'n'-by-'dim' matrix. The rows of 'p' represent 'n'
          points in 'dim'-dimensional space. 

 options: Optional options, see details below. 

_D_e_t_a_i_l_s:

     This function interfaces the qhull library, and intents to be a
     port from Octave to R. Qhull computes convex hulls, Delaunay
     triangulations, halfspace intersections about a point, Voronoi
     diagrams, furthest-site Delaunay triangulations, and furthest-site
     Voronoi diagrams. It runs in 2-d, 3-d, 4-d, and higher dimensions.
     It implements the Quickhull algorithm for computing the convex
     hull. Qhull handles roundoff errors from floating point
     arithmetic. It computes volumes, surface areas, and approximations
     to the convex hull. See the qhull documentation included in this
     distribution (the doc directory <URL: ../doc/index.htm>).

     The input 'n'-by-'dim' matrix contains 'n' points of dimension
     dim. The return matrix 'T' has 'm' rows and 'dim+1' columns. It
     contains for each row a set of indices to the points, which
     describes a simplex of dimension dim.  The 3D simplex is a
     tetrahedron.

     If a second optional argument is given, it must be a string
     containing extra options for the underlying qhull command.  In
     particular, "Qt" may be useful for joggling the input to cope with
     non-simplicial cases. (See the Qhull documentation (<URL:
     ../doc/index.htm>) for the available options.)

_V_a_l_u_e:

     The return matrix has 'm' rows and 'dim+1' columns. It contains
     for each row a set of indices to the points, which describes a
     simplex of dimension dim.

_N_o_t_e:

     This intents to be a port of the Octave's (<URL:
     http://www.octave.org>) geometry library. The sources originals
     were from Kai Habel.

     The current implementation calls Qhull always with the "QJ"
     option. (See Qhull documentation for details).

     Qhull does not support constrained Delaunay triangulations,
     triangulation of non-convex surfaces, mesh generation of
     non-convex objects, or medium-sized inputs in 9-D and higher. A
     rudimentary algorithm for mesh generation in non-convex regions
     using Delaunay triangulation is implemented in distmesh2d
     (currently only 2D).

_A_u_t_h_o_r(_s):

     Raoul Grasman; based on the corresponding Octave sources of Kai
     Habel.

_R_e_f_e_r_e_n_c_e_s:

     Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., "The Quickhull
     algorithm for convex hulls," _ACM Trans. on Mathematical
     Software,_ Dec 1996.

     <URL: http://www.qhull.org>

_S_e_e _A_l_s_o:

     'tri.mesh', 'convhulln', 'surf.tri', 'distmesh2d'

_E_x_a_m_p_l_e_s:

     # example delaunayn
     d = c(-1,1)
     pc = as.matrix(rbind(expand.grid(d,d,d),0))
     tc = delaunayn(pc)

     # example tetramesh
     ## Not run: 
     library(rgl)
     rgl.viewpoint(60)
     rgl.light(120,60)
     tetramesh(tc,pc, alpha=0.9)
     ## End(Not run)

     # example surf.tri
     # ==> see also convhulln, but it currently prints an unavoidable
     #     message to the console
     ps = matrix(rnorm(3000),ncol=3)        # generate poinst on a sphere
     ps = sqrt(3) * ps / drop(sqrt((ps^2) %*%rep(1,3)))
     ts = delaunayn(ps)
     ts.surf = t( surf.tri(ps,ts) )
     ## Not run: 
     rgl.triangles(ps[ts.surf,1], ps[ts.surf,2] ,ps[ts.surf,3],
                   col="blue", alpha=.2)
     for(i in 1:(8*360)) rgl.viewpoint(i/8)
     ## End(Not run)

