Get the normal of a geometrySource:
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).
- x, y
Geometry vectors. If
yis given both
ymust be convertible to vectors and be in 3D
Arguments passed on to methods
# Get normals to a vector of directions d <- direction(sample(10, 5), sample(10,5)) normal(d) #> <2D directions > #>  <dx:-3, dy:9> <dx:-4, dy:1> <dx:-5, dy:6> <dx:-10, dy:2> <dx:-7, dy:7> # Get the normal of a triangle t <- triangle(point(4, 7, 1), point(9, 2, 1), point(1, 6, 8)) normal(t) #> <3D directions > #>  <dx:-35, dy:-35, dz:-20> # equivalent to the normal of the supporting plane normal(t) == normal(as_plane(t)) #>  TRUE # Get direction orthogonal to two vectors normal(vec(5, 2, -7), vec(-1, 4, 9)) #> <3D directions > #>  <dx:46, dy:-38, dz:22>