fm_split_lines: Split lines at triangle edges

View source: R/split_lines.R

fm_split_linesR Documentation

Split lines at triangle edges

Description

Compute intersections between line segments and triangle edges, and filter out segment of length zero.

Usage

fm_split_lines(mesh, ...)

## S3 method for class 'fm_mesh_2d'
fm_split_lines(mesh, segm, ...)

## S3 method for class 'inla.mesh'
fm_split_lines(mesh, ...)

Arguments

mesh

An fm_mesh_2d or inla.mesh object

...

Unused.

segm

An fm_segm() object with segments to be split

Value

An fm_segm() object with the same crs as the mesh, with an added field origin, that for each new segment gives the originator index into to original segm object for each new line segment.

Author(s)

Finn Lindgren finn.lindgren@gmail.com

Examples

mesh <- fm_mesh_2d(
  boundary = fm_segm(rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1)), is.bnd = TRUE)
)
splitter <- fm_segm(rbind(c(0.8, 0.2), c(0.2, 0.8)))
segm_split <- fm_split_lines(mesh, splitter)

plot(mesh)
lines(splitter)
points(segm_split$loc)

fmesher documentation built on July 1, 2024, 5:07 p.m.