gridcentres             package:spatstat             R Documentation

_R_e_c_t_a_n_g_u_l_a_r _g_r_i_d _o_f _p_o_i_n_t_s

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

     Generates a rectangular grid of points in a window

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

      gridcentres(window, nx, ny)

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

  window: A window.  An object of class 'owin', or data in any format
          acceptable to 'as.owin()'. 

      nx: Number of points in each row of the rectangular grid. 

      ny: Number of points in each column of the rectangular grid. 

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

     This function creates a rectangular grid of points in the window.

     The bounding rectangle of the 'window' is divided into a regular
     nx * ny grid of rectangular tiles. The function returns the x,y
     coordinates of the centres of these tiles.

     Note that some of these grid points may lie outside the window, if
     'window' is not of type '"rectangle"'. The function 'inside.owin'
     can be used to select those grid points which do lie inside the
     window. See the examples.

     This function is useful in creating dummy points for quadrature
     schemes (see 'quadscheme') and for other miscellaneous purposes.

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

     A list with two components 'x' and 'y', which are numeric vectors
     giving the coordinates of the points of the rectangular grid.

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

     Adrian Baddeley adrian@maths.uwa.edu.au <URL:
     http://www.maths.uwa.edu.au/~adrian/> and Rolf Turner
     rolf@math.unb.ca <URL: http://www.math.unb.ca/~rolf>

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

     'quad.object', 'quadscheme', 'inside.owin', 'stratrand'

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

       w <- unit.square()
       xy <- gridcentres(w, 10,15)
       ## Not run: 
       plot(w)
       points(xy)
       
     ## End(Not run)

       bdry <- list(x=c(0.1,0.3,0.7,0.4,0.2),
                    y=c(0.1,0.1,0.5,0.7,0.3))
       w <- owin(c(0,1), c(0,1), poly=bdry)
       xy <- gridcentres(w, 30, 30)
       ok <- inside.owin(xy$x, xy$y, w)
       ## Not run: 
       plot(w)
       points(xy$x[ok], xy$y[ok])
       
     ## End(Not run)

