Rotation: R6 class representing a rotation

RotationR Documentation

R6 class representing a rotation

Description

A rotation is given by an angle (theta) and a center.

Active bindings

theta

get or set the angle of the rotation

center

get or set the center

degrees

get or set the degrees field

Methods

Public methods


Method new()

Create a new Rotation object.

Usage
Rotation$new(theta, center, degrees = TRUE)
Arguments
theta

a number, the angle of the rotation

center

a point, the center of the rotation

degrees

logical, whether theta is given in degrees

Returns

A new Rotation object.

Examples
Rotation$new(60, c(1,1))

Method print()

Show instance of a Rotation object.

Usage
Rotation$print(...)
Arguments
...

ignored


Method rotate()

Rotate a point or several points.

Usage
Rotation$rotate(M)
Arguments
M

a point or a two-column matrix of points, one point per row


Method transform()

An alias of rotate.

Usage
Rotation$transform(M)
Arguments
M

a point or a two-column matrix of points, one point per row


Method rotateCircle()

Rotate a circle.

Usage
Rotation$rotateCircle(circ)
Arguments
circ

a Circle object

Returns

A Circle object.


Method transformCircle()

An alias of rotateCircle.

Usage
Rotation$transformCircle(circ)
Arguments
circ

a Circle object

Returns

A Circle object.


Method rotateEllipse()

Rotate an ellipse.

Usage
Rotation$rotateEllipse(ell)
Arguments
ell

an Ellipse object

Returns

An Ellipse object.


Method transformEllipse()

An alias of rotateEllipse.

Usage
Rotation$transformEllipse(ell)
Arguments
ell

an Ellipse object

Returns

An Ellipse object.


Method rotateLine()

Rotate a line.

Usage
Rotation$rotateLine(line)
Arguments
line

a Line object

Returns

A Line object.


Method transformLine()

An alias of rotateLine.

Usage
Rotation$transformLine(line)
Arguments
line

a Line object

Returns

A Line object.


Method getMatrix()

Augmented matrix of the rotation.

Usage
Rotation$getMatrix()
Returns

A 3x3 matrix.

Examples
R <- Rotation$new(60, c(1,1))
P <- c(1,5)
R$rotate(P)
R$getMatrix() %*% c(P,1)

Method asAffine()

Convert the reference rotation to an Affine object.

Usage
Rotation$asAffine()

Method clone()

The objects of this class are cloneable with this method.

Usage
Rotation$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Rotation$new`
## ------------------------------------------------

Rotation$new(60, c(1,1))

## ------------------------------------------------
## Method `Rotation$getMatrix`
## ------------------------------------------------

R <- Rotation$new(60, c(1,1))
P <- c(1,5)
R$rotate(P)
R$getMatrix() %*% c(P,1)

PlaneGeometry documentation built on Aug. 10, 2023, 1:09 a.m.