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.

## Usage

line(..., default_dim = 2)

is_line(x)

as_line(x)

## Arguments

...

Various input. See the Constructor section.

default_dim

The dimensionality when constructing an empty vector

x

A vector of lines or an object to convert to it

## Value

An euclid_line vector

## Constructors

2 dimensional line

• 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 line

• 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

Other Geometries: circle(), direction(), iso_cube(), iso_rect(), plane(), point(), ray(), segment(), sphere(), tetrahedron(), triangle(), vec(), weighted_point()

Other Curves: ray(), segment()

## Examples

# Construction
l <- line(sample(10, 2), sample(10, 2), sample(10, 2))
l
#> <2D lines [2]>
#> [1] <a:9, b:2, c:5> <a:5, b:9, c:2>

# 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:6, y:1, z:5, dx:-4, dy:3, dz:-4> <x:5, y:5, z:4, dx:-1, dy:1, dz:-1>
#> [3] <x:3, y:2, z:6, dx:-2, dy:1, dz:-4>

# Construction from point and vector
line(p, vec(4, -2, 0))
#> <3D lines [6]>
#> [1] <x:6, y:1, z:5, dx:4, dy:-2, dz:0> <x:5, y:5, z:4, dx:4, dy:-2, dz:0>
#> [3] <x:3, y:2, z:6, dx:4, dy:-2, dz:0> <x:2, y:4, z:1, dx:4, dy:-2, dz:0>
#> [5] <x:4, y:6, z:3, dx:4, dy:-2, dz:0> <x:1, y:3, z:2, dx:4, dy:-2, dz:0>