Description Usage Arguments Value Examples
Calculates the distance from one quadrat to a second quadrat, where quadrats are designated by their indices, as created by gxgy.to.index. The two quadrats can be vectors, but must be of the same length (or one of the two can be atomic).
1 |
gridsize |
Side of the square quadrate. |
plotdim |
The x and y dimensions of the plot. |
A vector of distances same length as input vectors.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
bad1=pt1$gx<0 | pt1$gy<0
bad2=pt2$gx<0 | pt2$gy<0
xdist=pt1$gx-pt2$gx
ydist=pt1$gy-pt2$gy
dist=sqrt(xdist^2+ydist^2)
if(length(pt1)==1 & bad1==T) dist=rep(-1,length(pt2))
else if(length(pt2)==1 & bad2==T) dist=rep(-1,length(pt1))
dist[bad1]=(-1)
dist[bad2]=(-1)
return(dist)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.