Learn R Programming

PlaneGeometry (version 1.6.0)

Reflection: R6 class representing a reflection

Description

A reflection is given by a line.

Arguments

Active bindings

line

get or set the line of the reflection

Methods


Method new()

Create a new Reflection object.

Usage

Reflection$new(line)

Arguments

line

a Line object

Returns

A new Reflection object.

Examples

l <- Line$new(c(1,1), c(1.5,1.5), FALSE, TRUE)
Reflection$new(l)


Method print()

Show instance of a reflection object.

Usage

Reflection$print(...)

Arguments

...

ignored


Method reflect()

Reflect a point.

Usage

Reflection$reflect(M)

Arguments

M

a point, Inf allowed


Method transform()

An alias of reflect.

Usage

Reflection$transform(M)

Arguments

M

a point, Inf allowed


Method reflectCircle()

Reflect a circle.

Usage

Reflection$reflectCircle(circ)

Arguments

circ

a Circle object

Returns

A Circle object.


Method transformCircle()

An alias of reflectCircle.

Usage

Reflection$transformCircle(circ)

Arguments

circ

a Circle object

Returns

A Circle object.


Method reflectLine()

Reflect a line.

Usage

Reflection$reflectLine(line)

Arguments

line

a Line object

Returns

A Line object.


Method transformLine()

An alias of reflectLine.

Usage

Reflection$transformLine(line)

Arguments

line

a Line object

Returns

A Line object.


Method getMatrix()

Augmented matrix of the reflection.

Usage

Reflection$getMatrix()

Returns

A 3x3 matrix.

Examples

R <- Reflection$new(Line$new(c(2,2), c(4,5)))
P <- c(1,5)
R$reflect(P)
R$getMatrix() %*% c(P,1)


Method asAffine()

Convert the reference reflection to an Affine object.

Usage

Reflection$asAffine()


Method clone()

The objects of this class are cloneable with this method.

Usage

Reflection$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code

## ------------------------------------------------
## Method `Reflection$new`
## ------------------------------------------------

l <- Line$new(c(1,1), c(1.5,1.5), FALSE, TRUE)
Reflection$new(l)

## ------------------------------------------------
## Method `Reflection$getMatrix`
## ------------------------------------------------

R <- Reflection$new(Line$new(c(2,2), c(4,5)))
P <- c(1,5)
R$reflect(P)
R$getMatrix() %*% c(P,1)

Run the code above in your browser using DataLab