ScalingXY: R6 class representing an axis-scaling

ScalingXYR Documentation

R6 class representing an axis-scaling

Description

An axis-scaling is given by a center, and two scale factors sx and sy, one for the x-axis and one for the y-axis.

Active bindings

center

get or set the center

sx

get or set the scale factor of the x-axis

sy

get or set the scale factor of the y-ayis

Methods

Public methods


Method new()

Create a new ScalingXY object.

Usage
ScalingXY$new(center, sx, sy)
Arguments
center

a point, the center of the scaling

sx

a number, the scale factor of the x-axis

sy

a number, the scale factor of the y-axis

Returns

A new ScalingXY object.

Examples
ScalingXY$new(c(1,1), 4, 2)

Method print()

Show instance of a ScalingXY object.

Usage
ScalingXY$print(...)
Arguments
...

ignored


Method transform()

Transform a point or several points by the reference axis-scaling.

Usage
ScalingXY$transform(M)
Arguments
M

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

Returns

A point or a two-column matrix of points.


Method getMatrix()

Augmented matrix of the axis-scaling.

Usage
ScalingXY$getMatrix()
Returns

A 3x3 matrix.

Examples
S <- ScalingXY$new(c(1,1), 4, 2)
P <- c(1,5)
S$transform(P)
S$getMatrix() %*% c(P,1)

Method asAffine()

Convert the reference axis-scaling to an Affine object.

Usage
ScalingXY$asAffine()

Method clone()

The objects of this class are cloneable with this method.

Usage
ScalingXY$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `ScalingXY$new`
## ------------------------------------------------

ScalingXY$new(c(1,1), 4, 2)

## ------------------------------------------------
## Method `ScalingXY$getMatrix`
## ------------------------------------------------

S <- ScalingXY$new(c(1,1), 4, 2)
P <- c(1,5)
S$transform(P)
S$getMatrix() %*% c(P,1)

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