View source: R/utils_polygon.R
poly_apex_base_angle | R Documentation |
This function calculates the apex and base angles of an object. It takes as
input a matrix of coordinates and returns the apex angle, base angle, and the
coordinates of the apex and base as a list. The angles are computed after the
object is aligned in the vertical axis with poly_align()
.
poly_apex_base_angle(
x,
percentiles = c(0.25, 0.75),
invert = FALSE,
plot = TRUE
)
x |
A matrix of coordinates representing the contour of the object,
often obtained with |
percentiles |
A numeric vector of two percentiles between 0 and 1 indicating the height of the points from the top to the bottom. The function calculates the apex angle between the two percentiles and the base angle between the lowest point and the highest point. |
invert |
If |
plot |
Plots the polygon with the points? Defaults to |
A list containing the apex angle, base angle, apex coordinates, and base coordinates.
library(pliman)
# a matrix of coordinates
angls <- poly_apex_base_angle(contours[[2]])
angls
# or a list of coordinates
poly_apex_base_angle(contours)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.