Triangles are sets of three vertices in either 2 or three dimensions. In three dimensions the order of the vertices determines the orientation of the triangle with vertices being in counter-clockwise order from the facing side. If the 3 vertices are colinear the triangle is considered to be degenerate

triangle(..., default_dim = 2)

is_triangle(x)

as_triangle(x)

## Arguments

... Various input. See the Constructor section. The dimensionality when constructing an empty vector A vector of triangles or an object to convert to it

## Value

An euclid_triangle vector

## Constructors

2 and 3 dimensional triangles

• Providing three points will construct triangles in the order the points are given.

## Examples

# Construction
p <- point(sample(6), sample(6))
t <- triangle(p[1:2], p[3:4], p[5:6])
t
#> <2D triangles >
#>  [<x:1, y:4>, <x:6, y:2>, <x:4, y:3>] [<x:3, y:5>, <x:5, y:6>, <x:2, y:1>]plot(t) # 3D triangles can be converted to planes
p <- point(sample(6), sample(6), sample(6))
t <- triangle(p[1:2], p[3:4], p[5:6])
as_plane(t)
#> <3D euclid_planes >
#>  <a:-3, b:7, c:-1, d:-3> <a:3, b:-2, c:7, d:-31>