Shear | R Documentation |
A shear is given by a vertex, two perpendicular vectors, and an angle.
vertex
get or set the vertex
vector
get or set the first vector
ratio
get or set the ratio between the length of vector
and the length of the second vector, perpendicular to the first one
angle
get or set the angle
degrees
get or set the degrees
field
new()
Create a new Shear
object.
Shear$new(vertex, vector, ratio, angle, degrees = TRUE)
vertex
a point
vector
a vector
ratio
a positive number, the ratio between the length of vector
and the length of the second vector, perpendicular to the first one
angle
an angle strictly between -90 degrees and 90 degrees
degrees
logical, whether angle
is given in degrees
A new Shear
object.
Shear$new(c(1,1), c(1,3), 0.5, 30)
print()
Show instance of a Shear
object.
Shear$print(...)
...
ignored
transform()
Transform a point or several points by the reference shear.
Shear$transform(M)
M
a point or a two-column matrix of points, one point per row
getMatrix()
Augmented matrix of the shear.
Shear$getMatrix()
A 3x3 matrix.
S <- Shear$new(c(1,1), c(1,3), 0.5, 30) S$getMatrix()
asAffine()
Convert the reference shear to an Affine
object.
Shear$asAffine()
Shear$new(c(0,0), c(1,0), 1, atan(30), FALSE)$asAffine()
clone()
The objects of this class are cloneable with this method.
Shear$clone(deep = FALSE)
deep
Whether to make a deep clone.
R. Goldman, An Integrated Introduction to Computer Graphics and Geometric Modeling. CRC Press, 2009.
P <- c(0,0); w <- c(1,0); ratio <- 1; angle <- 45
shear <- Shear$new(P, w, ratio, angle)
wt <- ratio * c(-w[2], w[1])
Q <- P + w; R <- Q + wt; S <- P + wt
A <- shear$transform(P)
B <- shear$transform(Q)
C <- shear$transform(R)
D <- shear$transform(S)
plot(0, 0, type = "n", asp = 1, xlim = c(0,1), ylim = c(0,2))
lines(rbind(P,Q,R,S,P), lwd = 2) # unit square
lines(rbind(A,B,C,D,A), lwd = 2, col = "blue") # image by the shear
## ------------------------------------------------
## Method `Shear$new`
## ------------------------------------------------
Shear$new(c(1,1), c(1,3), 0.5, 30)
## ------------------------------------------------
## Method `Shear$getMatrix`
## ------------------------------------------------
S <- Shear$new(c(1,1), c(1,3), 0.5, 30)
S$getMatrix()
## ------------------------------------------------
## Method `Shear$asAffine`
## ------------------------------------------------
Shear$new(c(0,0), c(1,0), 1, atan(30), FALSE)$asAffine()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.