Coord1D is an R6::R6Class() object representing two-dimensional points
represented by Cartesian Coordinates.
xwA two-column matrix representing the homogeneous coordinates. The first column is the "x" coordinates and the second column is all ones.
xA numeric vector of x-coordinates.
new()Coord1D$new(xw)xwA matrix with three columns representing (homogeneous) coordinates. The first column represents x coordinates and the last column is all ones. Column names should be "x" and "w".
print()Coord1D$print(n = NULL, ...)nNumber of coordinates to print. If NULL print all of them.
...Passed to format.default().
project()Coord1D$project(point = as_point1d("origin"), ...)pointA Point1D object of length one representing the point
you with to reflect across or project to or an object coercible to one by as_point1d(point, ...)
such as "origin".
...Passed to project1d().
reflect()Coord1D$reflect(point = as_point1d("origin"), ...)pointA Point1D object of length one representing the point
you with to reflect across or project to or an object coercible to one by as_point1d(point, ...)
such as "origin".
...Passed to reflect1d().
scale()Coord1D$scale(x_scale = 1)x_scaleScaling factor to apply to x coordinates
translate()Coord1D$translate(x = as_coord1d(0), ...)xA Coord1D object of length one or an object coercible to one by as_coord1d(x, ...).
...Passed to as_coord1d(x, ...) if x is not a Coord1D object
transform()Coord1D$transform(mat = transform1d())matA 2x2 matrix representing a post-multiplied affine transformation matrix.
The last column must be equal to c(0, 1).
If the last row is c(0, 1) you may need to transpose it
to convert it from a pre-multiplied affine transformation matrix to a post-multiplied one.
If a 1x1 matrix we'll quietly add a final column/row equal to c(0, 1).
clone()The objects of this class are cloneable with this method.
Coord1D$clone(deep = FALSE)deepWhether to make a deep clone.
p <- as_coord1d(x = rnorm(100, 2))
print(p, n = 10L)
pc <- mean(p) # Centroid
# method chained affine transformation matrices are auto-pre-multiplied
p$
translate(-pc)$
reflect("origin")$
print(n = 10L)
Run the code above in your browser using DataLab