rescale_coordinates: Scale, rotate, and shift numeric coordinates

rescale_coordinatesR Documentation

Scale, rotate, and shift numeric coordinates

Description

Scale, rotate, and shift numeric coordinates

Usage

rescale_coordinates(
  x,
  scale = c(1, 1),
  rotate_degrees = 0,
  shift = c(0, 0),
  center = NULL,
  rotation_axes = c(1, 2),
  plot_debug = FALSE,
  ...
)

Arguments

x

matrix with one or more columns containing numeric coordinates.

scale

numeric vector whose values are expanded to length ncol(x). After subtracting the center, the coordinates in each column are multiplied by the scale.

rotate_degrees

numeric value in degrees indicating rotation around the center, where positive values are clockwise rotation. This rotation is only applied to two columns in x defined by rotation_axes.

shift

numeric vector whose values are expanded to length ncol(x). The coordinates in each column are added to the shift, after applying scale and rotate_degrees

center

numeric vector whose values are expanded to length ncol(x), indicating the center point used for scale and rotate_degrees transformations. When center=NULL it is derived from the bounding box, which is the mean of the range for each column in x.

rotation_axes

integer vector length 2, indicating which two columns in x are used for rotate_degrees.

plot_debug

logical indicating whether to plot starting, intermediate, and final polygons during the processing.

...

additional arguments are ignored.

Details

This function takes a numeric matrix with two or more numeric columns, and adjusts the coordinates in three ways:

  • scale: adjust coordinate range by a multiplier, relative to a central point

  • rotate: rotate coordinates around a central point in degrees

  • shift: adjust coordinate range by adding a numeric value

The operations are performed in that order: rotate, scale, shift.

When center is not defined, the default behavior is to use the mean of the range of each coordinate column. Using the mean range is equivalent to using the mean of the bounding box.

Value

matrix with numeric values after processing.

See Also

Other venndir spatial: degrees_to_adj(), diff_degrees(), display_angles(), mean_degree_arc(), mean_degrees(), spread_degrees()

Examples

# Todo: migrate examples to use JamPolygon input


jmw86069/venndir documentation built on June 15, 2024, 1:52 p.m.