rotate_coord: Rotate Cartesian coordinates

View source: R/rotate.R

rotate_coordR Documentation

Rotate Cartesian coordinates

Description

Rotate Cartesian Coordinates around a given center. Translate or flip cartesian coordinates. Stretch cartesian coordinates.

Usage

rotate_coord(x, y, angle, type = c("degrees", "radial"), method = c("transform", "polar", "polar_extended"), center = c(0, 0), translate = NULL, stretch = NULL, flip = FALSE)

Arguments

x

X coordinates

y

Y coordinates

angle

Angle the points should be rotated. Positive angles rotate clockwise, negative counterclock.

type

Define the type of angle that is given. Default is "degrees", alternative is "radial"

method

Define method to be used for rotation. Default method is "transform" uses an transformation matrix. Other method "polar" transforms coordinates to polar, "polar_extended" additionally returns distances of points from center. Results are the same for both methods.

center

Center around which coordinates should be rotated, give a vector containing and x and y coordinate.

translate

Move coordinates in x and y direction, give a vector containing x and y coordinate

stretch

Stretch or shrink coordinates around the center by a given factor (i.e. 1.5 stretch 50 procent, 0.5 shrink 50

flip

Flip coordinates around the x axis at the center

Value

Returns rotated coordinates

Author(s)

Optical Imaging Centre ErasmusMC Rotterdam

Examples

rotate_coord(c(25,50,100,150),c(150,125,50,25),angle=1.2,type="radial",method="polar_extended")

ErasmusOIC/SMoLR documentation built on July 27, 2023, 8:05 p.m.