| Scaling | R Documentation |
A (non-uniform) scaling is given by a center, a direction vector, and a scale factor.
centerget or set the center
directionget or set the direction
scaleget or set the scale factor
new()Create a new Scaling object.
Scaling$new(center, direction, scale)
centera point, the center of the scaling
directiona vector, the direction of the scaling
scalea number, the scale factor
A new Scaling object.
Scaling$new(c(1,1), c(1,3), 2)
print()Show instance of a Scaling object.
Scaling$print(...)
...ignored
transform()Transform a point or several points by the reference scaling.
Scaling$transform(M)
Ma point or a two-column matrix of points, one point per row
getMatrix()Augmented matrix of the scaling.
Scaling$getMatrix()
A 3x3 matrix.
S <- Scaling$new(c(1,1), c(2,3), 2) P <- c(1,5) S$transform(P) S$getMatrix() %*% c(P,1)
asAffine()Convert the reference scaling to an Affine object.
Scaling$asAffine()
scaleCircle()Scale a circle. The result is an ellipse.
Scaling$scaleCircle(circ)
circa Circle object
An Ellipse object.
clone()The objects of this class are cloneable with this method.
Scaling$clone(deep = FALSE)
deepWhether to make a deep clone.
R. Goldman, An Integrated Introduction to Computer Graphics and Geometric Modeling. CRC Press, 2009.
Q <- c(1,1); w <- c(1,3); s <- 2
S <- Scaling$new(Q, w, s)
# the center is mapped to itself:
S$transform(Q)
# any vector \code{u} parallel to the direction vector is mapped to \code{s*u}:
u <- 3*w
all.equal(s*u, S$transform(u) - S$transform(c(0,0)))
# any vector perpendicular to the direction vector is mapped to itself
wt <- 3*c(-w[2], w[1])
all.equal(wt, S$transform(wt) - S$transform(c(0,0)))
## ------------------------------------------------
## Method `Scaling$new`
## ------------------------------------------------
Scaling$new(c(1,1), c(1,3), 2)
## ------------------------------------------------
## Method `Scaling$getMatrix`
## ------------------------------------------------
S <- Scaling$new(c(1,1), c(2,3), 2)
P <- c(1,5)
S$transform(P)
S$getMatrix() %*% c(P,1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.