coordflip: Flip Coordinates

Description Usage Arguments Value References See Also Examples

View source: R/coordflip.R

Description

Flip (or reflect) coordinates across any given line.

Usage

1
coordflip(pts, seg)

Arguments

pts

A numeric matrix with two columns of x and y coordinates to be rotated.

seg

A numeric matrix of dimension 2 x 2 giving two points which define the line over which the coordinates will be flipped.

Value

A numeric matrix with same dimension as pts with the flipped x and y coordinates.

References

Based on a method posted by Il-Bhima on 22 July 2010 on stackoverflow [link].

See Also

coordplot, coordmove, coordturn, coordtri.

Examples

1
2
3
4
5
6
7
# starting coordinates
test <- matrix(c(0, 4, 1, 0, 2, 3), ncol=2,
 dimnames=list(LETTERS[1:3], NULL))
coordplot(test)
# flip the coordinates across the line defined by the first two points
ftest <- coordflip(test, test[1:2, ])
coordplot(ftest)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.