dot_product1d(), dot_product2d(), and dot_product3d() compute the
dot (inner) product of two coordinate vectors.
You may also use the * operator and if R >= 4.3.0 you may also use the %*% operator to compute the dot (inner) product.
See also
cross_product3d() for the cross product of two Coord3D vectors.
Examples
p1 <- as_coord2d(x = c(1, 2), y = c(3, 4))
p2 <- as_coord2d(x = c(5, 6), y = c(7, 8))
dot_product2d(p1, p2)
#> [1] 26 44
p1 * p2 # equivalent
#> [1] 26 44
if (getRversion() >= "4.3.0") {
p1 %*% p2
}
#> [1] 26 44
