convhulln              package:geometry              R Documentation

_C_o_m_p_u_t_e _s_m_a_l_l_e_s_t _c_o_n_v_e_x _h_u_l_l _t_h_a_t _e_n_c_l_o_s_e_s _a _s_e_t _o_f _p_o_i_n_t_s

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

     Returns an index matrix to the points of simplices ("triangles")
     that form the smallest convex simplicial complex of a set of input
     points in N-dimensional space.

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

     convhulln(p, options = " ")

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

       p: 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 intends to be a
     port from Octave to R.

     The input 'n'-by-'dim' matrix contains 'n' points of dimension
     'dim'. If a second optional argument is given, it must be a string
     containing extra options for the underlying qhull command. (See
     the Qhull documentation for the available options - refer to
     delaunayn.)

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

     An 'm'-by-'dim' index matrix of which each row defines a
     'dim'-dimensional "triangle". The indices refer to the rows in
     'p'.

_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.

     Currently a call to convhulln unavoidably generates a diagnostic
     report on an Rterm console. This is to be removed in future
     release. See surf.tri for a quiet alternative, which computes the
     hull from a Delaunay triangulation of the points.

     See further notes in delaunayn.

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

     Raoul Grasman

_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:

     'convex.hull', 'delaunayn', '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)    # render tetrahedron mesh
     ## End(Not run)

     # example convhulln
     # ==> see also surf.tri to avoid unwanted messages printed to the console by qhull
     ps = matrix(rnorm(3000),ncol=3)                     # generate poinst on a sphere
     ps = sqrt(3) * ps / drop(sqrt((ps^2) %*% rep(1,3)))
     ts.surf = t( convhulln(ps,"QJ") ) # see the qhull documentations for the options
     ## 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)

