A line is an undirected infinite line. For 2D it can be defined by the line equation ax + by + c = 0 whereas for 3D it is usually defined by a point and a direction in the same way as rays, but implicitly extending to infinity in the opposite direction as well.

line(..., default_dim = 2)

is_line(x)

as_line(x)

Arguments

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

Value

An euclid_line vector

Constructors

2 dimensional rays

• Providing 3 numerics will create lines with the given line equation

• Providing two points will construct lines going through those

• Providing a point and a vector will construct lines going through the point and extending in the direction of the vector.

• Providing a point and a direction will construct lines going through the point and extending in the given direction.

• Providing a ray will construct the supporting line for the ray

• Providing a segment will construct the supporting line for the segment

3 dimensional rays

• Providing two points will construct lines going through those

• Providing a point and a vector will construct lines going through the point and extending in the direction of the vector.

• Providing a point and a direction will construct lines going through the point and extending in the given direction.

• Providing a ray will construct the supporting line for the ray

• Providing a segment will construct the supporting line for the segment

Examples

# Construction
l <- line(sample(10, 2), sample(10, 2), sample(10, 2))
l
#> <2D lines [2]>
#> [1] <a:8, b:3, c:1> <a:5, b:4, c:9>
# 3D lines cannot be constructed from coefficients
p <- point(sample(6), sample(6), sample(6))
line(p[1:3], p[4:6])
#> <3D lines [3]>
#> [1] <x:5, y:2, z:2, dx:-4, dy:3, dz:-1> <x:2, y:3, z:6, dx:2, dy:1, dz:-1>
#> [3] <x:3, y:1, z:3, dx:3, dy:5, dz:1>
# Construction from point and vector
line(p, vec(4, -2, 0))
#> <3D lines [6]>
#> [1] <x:5, y:2, z:2, dx:4, dy:-2, dz:0> <x:2, y:3, z:6, dx:4, dy:-2, dz:0>
#> [3] <x:3, y:1, z:3, dx:4, dy:-2, dz:0> <x:1, y:5, z:1, dx:4, dy:-2, dz:0>
#> [5] <x:4, y:4, z:5, dx:4, dy:-2, dz:0> <x:6, y:6, z:4, dx:4, dy:-2, dz:0>