Coord1D is an R6::R6Class() object representing one-dimensional points
represented by Cartesian Coordinates.
Active bindings
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.
Methods
Coord1D$new()
Usage
Coord1D$new(xw)Coord1D$print()
Arguments
nNumber of coordinates to print. If
NULLprint all of them....Passed to
format.default().
Coord1D$project()
Usage
Coord1D$project(point = as_point1d("origin"), ...)Arguments
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().
Coord1D$reflect()
Usage
Coord1D$reflect(point = as_point1d("origin"), ...)Arguments
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().
Coord1D$translate()
Usage
Coord1D$translate(x = as_coord1d(0), ...)Coord1D$transform()
Usage
Coord1D$transform(mat = transform1d())Arguments
matA 2x2 matrix representing a post-multiplied affine transformation matrix. The last column must be equal to
c(0, 1). If the last row isc(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 toc(0, 1).
Examples
p <- as_coord1d(x = rnorm(100, 2))
print(p, n = 10L)
#> <Coord1D[100]>
#> x w
#> [1,] 0.5999565 1
#> [2,] 2.2553171 1
#> [3,] -0.4372636 1
#> [4,] 1.9944287 1
#> [5,] 2.6215527 1
#> [6,] 3.1484116 1
#> [7,] 0.1781823 1
#> [8,] 1.7526747 1
#> [9,] 1.7558004 1
#> [10,] 1.7172946 1
pc <- mean(p) # Centroid
# method chained affine transformation matrices are auto-pre-multiplied
p$
translate(-pc)$
reflect("origin")$
print(n = 10L)
#> <Coord1D[100]>
#> x w
#> [1,] 1.47083272 1
#> [2,] -0.18452785 1
#> [3,] 2.50805282 1
#> [4,] 0.07636049 1
#> [5,] -0.55076352 1
#> [6,] -1.07762240 1
#> [7,] 1.89260687 1
#> [8,] 0.31811451 1
#> [9,] 0.31498881 1
#> [10,] 0.35349465 1
