Line extensions

Inherited | `Finite` , `Infinite` , or `SemiInfinite` |

Objects | Extension Default Values |
---|---|

`plot::Line2d` , `plot::Line3d` | `Finite` |

`Extension`

allows to extent a line segment
to an infinite ray or an infinite line.

Lines of type `plot::Line2d`

and `plot::Line3d`

are defined
by specifying two points through which the line passes. For example: `plot::Line2d([x`

.
The first point _{1},
y_{1}], [x_{2}, y_{2}])`[x`

corresponds
to the attribute _{1}, y_{1}]`From`

, the second point `[x`

corresponds to the attribute _{2},
y_{2}]`To`

.

With `Extension`

= `Finite`

,
a line segment from `From`

to `To`

is drawn.

With `Extension`

= `SemiInfinite`

,
an infinite ray is drawn starting at `From`

passing through `To`

. The ray extends
to the border of the `ViewingBox`

.

With `Extension`

= `Infinite`

,
an infinite line is drawn passing through `From`

and `To`

. The line extends
in both directions to the border of the `ViewingBox`

.

We plot two lines with the default value `Extension`

= `Finite`

:

plot(plot::Line2d([0, 0], [1, 1], Color = RGB::Blue), plot::Line2d([1, 0], [2, 1], Color = RGB::Red), ViewingBox = [-1..3, -1..3])

Now, with `Extension`

= `SemiInfinite`

,
the blue line becomes a ray extending to the `ViewingBox`

in one direction:

plot(plot::Line2d([0, 0], [1, 1], Color = RGB::Blue, Extension = SemiInfinite), plot::Line2d([1, 0], [2, 1], Color = RGB::Red), ViewingBox = [-1..3, -1..3])

With `Extension`

= `Infinite`

,
the blue line extends to the `ViewingBox`

in both directions:

plot(plot::Line2d([0, 0], [1, 1], Color = RGB::Blue, Extension = Infinite), plot::Line2d([1, 0], [2, 1], Color = RGB::Red), ViewingBox = [-1..3, -1..3])

Here we define a finite line segment and use `plot::modify`

to
create an extended copy. It is drawn as an infinite dashed line:

line := plot::Line2d([0, 0], [1, 1]): plot(plot::modify(line, Extension = Infinite, LineStyle = Dashed), line, ViewingBox = [-1..2, -1..2]):

delete line:

Was this topic helpful?