triangle_area {area} | R Documentation |
Calculate triangle area from a matrix of coordinates. Triangles are composed of three coordinates, so the matrix should have this as triplets of rows one after the other.
triangle_area(x, signed = FALSE)
x |
coordinates x,y triplets matrix where 'nrow(x) = ntriangles*3' |
signed |
defaults to |
If signed = FALSE
the absolute value of area is returned, otherwise the
sign reflects path orientation. Positive means counter-clockwise orientation.
The algorithm was once documented at 'w w w cs.tufts.edu/comp/163/OrientationTests.pdf'
numeric vector of area
sum(triangle_area(mm_tri$P[t(mm_tri$T), ]))