A normal is a direction perpendicular to a geometry. Since normals doesn't have any magnitude they are returned as directions rather than vectors. Normals are not given for all geometries. In 2 dimensions they are defined for line-like geometries (directions, vectors, lines, rays, and segments), while in 3 dimensions they are given for plane-like geometries (circles, triangles, and planes).

normal(x, y = NULL)

x, y | Geometry vectors. If |
---|

A vector of directions with the same dimensionality as the input

#> <2D directions [5]> #> [1] <dx:-4, dy:3> <dx:-3, dy:1> <dx:-1, dy:8> <dx:-2, dy:5> <dx:-8, dy:9># Get the normal of a triangle t <- triangle(point(4, 7, 1), point(9, 2, 1), point(1, 6, 8)) normal(t)#> <3D directions [1]> #> [1] <dx:-35, dy:-35, dz:-20>#> [1] TRUE#> <3D directions [1]> #> [1] <dx:46, dy:-38, dz:22>