Homothety: R6 class representing a homothety

HomothetyR Documentation

R6 class representing a homothety

Description

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

Active bindings

center

get or set the center

scale

get or set the scale factor of the homothety

Methods

Public 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


## ------------------------------------------------
## 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)

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