Learn R Programming

PlaneGeometry (version 1.6.0)

Homothety: R6 class representing a homothety

Description

A homothety is given by a center and a scale factor.

Arguments

Active bindings

center

get or set the center

scale

get or set the scale factor of the homothety

Methods


Method new()

Create a new Homothety object.

Usage

Homothety$new(center, scale)

Arguments

center

a point, the center of the homothety

scale

a number, the scale factor of the homothety

Returns

A new Homothety object.

Examples

Homothety$new(c(1,1), 2)


Method print()

Show instance of a Homothety object.

Usage

Homothety$print(...)

Arguments

...

ignored


Method transform()

Transform a point or several points by the reference homothety.

Usage

Homothety$transform(M)

Arguments

M

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


Method transformCircle()

Transform a circle by the reference homothety.

Usage

Homothety$transformCircle(circ)

Arguments

circ

a Circle object

Returns

A Circle object.


Method getMatrix()

Augmented matrix of the homothety.

Usage

Homothety$getMatrix()

Returns

A 3x3 matrix.

Examples

H <- Homothety$new(c(1,1), 2)
P <- c(1,5)
H$transform(P)
H$getMatrix() %*% c(P,1)


Method asAffine()

Convert the reference homothety to an Affine object.

Usage

Homothety$asAffine()


Method clone()

The objects of this class are cloneable with this method.

Usage

Homothety$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code

## ------------------------------------------------
## Method `Homothety$new`
## ------------------------------------------------

Homothety$new(c(1,1), 2)

## ------------------------------------------------
## Method `Homothety$getMatrix`
## ------------------------------------------------

H <- Homothety$new(c(1,1), 2)
P <- c(1,5)
H$transform(P)
H$getMatrix() %*% c(P,1)

Run the code above in your browser using DataLab