Topic: Spatial

Topic Description:

Functions for calculating Ripley's K from CTFS R Analytical Tables, many routines for quadrat-based calculations. and calculations of wavelet variance.



File: spatial/slope.r

View File Source Download File No help file available

Function: calc.directionslope

Function Description: calc.directionslope

This runs equations 1-3 of Seibert & McGlynn

Function Arguments:

ArgumentDefault Value
z1
z2
x1
x2
y1
y2
z1
z2
x1
x2
y1
y2

Function Source:

calc.directionslope=function(z1,z2,x1,x2,y1,y2)
{
normal=c(z1*y2-z2*y1,z1*x2-z2*x1,y1*x2-y2*x1)
# browser()

if(normal[1]==0)
{
if(normal[2]>=0) direction=0
else direction=pi
}
else if(normal[1]>0) direction=pi/2-atan(normal[2]/normal[1])
else direction=3*pi/2-atan(normal[2]/normal[1])

slope=(-1)*tan(acos(normal[3]/sqrt(sum(normal^2))))

return(c(direction,slope))
}