Skip to contents

Given a point within a channel, generate a line segment that goes from bank to bank, for a specified angle.

Usage

xt_span_banks(pt, angle, bankline)

Arguments

pt

A point within the channel.

angle

The angle of the line segment, in radians.

bankline

The bankline of the channel.

Value

A line segment spanning from bank to bank.

Note

This function is the precursor to generating cross sections with xt_generate_xsc().

Examples

# Pick a point in the channel, and an angle
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
pt <- st_centroid(demo_bankline) - c(0, 30)
plot(demo_bankline)
plot(pt, add = TRUE)

## 45 degrees:
span <- xt_span_banks(pt, angle = pi / 4, bankline = demo_bankline)
plot(span, add = TRUE, col = "blue")

## 0 degrees:
span <- xt_span_banks(pt, angle = 0, bankline = demo_bankline)
plot(span, add = TRUE, col = "blue")