-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Line 14 in 4cb8ba9
| \item{snap}{boundary points less than \code{snap} distance apart are considered to indicate contiguity; used both to find candidate and actual neighbours for planar geometries, but only actual neighbours for spherical geometries, as spherical spatial indexing itself injects some fuzzyness. If not set, for all \code{SpatialPolygons} objects, the default is as before \code{sqrt(.Machine$double.eps)}, with this value also used for \code{sf} objects with no coordinate reference system. For \code{sf} objects with a defined coordinate reference system, the default value is \code{1e-7} for geographical coordinates (approximately 10mm), is 10mm where projected coordinates are in metre units, and is converted from 10mm to the same distance in the units of the coordinates. Should the conversion fail, \code{snap} reverts to \code{sqrt(.Machine$double.eps)}.} |
I'm trying to understand a bit more clearly how neighbors are identified when using a snap tolerance. I understand that the spatial index bounding box search is increased by snap, however, when matching neighbors, I'm not too sure I understand how we determine if 2 neighbors are adjacent.
Is my reading of the code in
Lines 182 to 206 in 4cb8ba9
| for (i=0; i<(nn-1); i++) { | |
| R_CheckUserInterrupt(); | |
| li = Rf_length(VECTOR_ELT(i_findInBox, i)); | |
| nrsi = NRS[i]; | |
| for (j=0; j<li; j++) { | |
| jj = INTEGER_POINTER(VECTOR_ELT(i_findInBox, i))[j] - ROFFSET; | |
| jhit = spOverlapC(bb1[i], bb2[i], bb3[i], bb4[i], bb1[jj], | |
| bb2[jj], bb3[jj], bb4[jj]); | |
| if (jhit > 0) { | |
| khit = 0; | |
| nrsj = NRS[jj]; | |
| if (nrsi > 0 && nrsj > 0){ | |
| khit = polypolyC(&plx[cNRS[i]], &ply[cNRS[i]], nrsi, | |
| &plx[cNRS[jj]], &ply[cNRS[jj]], nrsj, Dsnap, crit+1L); | |
| } | |
| if (khit > crit) { | |
| card[i]++; | |
| card[jj]++; | |
| is[ii] = i; | |
| jjs[ii] = jj; | |
| ii++; | |
| } | |
| } | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels