# sl.elem2linepairs: Extract Unique Edges from Triangular Mesh In helgegoessling/spheRlab: Spherical Geometry, Analysis, and Plotting of Geoscientific Data on Arbitrary Grids

## Description

Extract unique lines from elements (polygons) of an unstructured mesh. Useful for plotting to half the figure size (vector format). By default, the edges are concatenated and returned as a vector composed of segments divided by NAs.

## Usage

 `1` ```sl.elem2linepairs(elem, concat = TRUE, verbose = FALSE) ```

## Arguments

 `elem` an `N`x`3` matrix with the node indices of the triangular elements of an unstructured mesh. `concat` a logical value indicating whether the resulting unique edges are concatenated and returned as a vector composed of segments divided by NAs. This can be computationally advantageous, for example for line plotting. Otherwise, a two-column matrix with each row giving one pair of nodes is returned. `verbose` a logical value indicating whether print statements shall report on the function progess.

## Value

If `concat=TRUE` (default), the resulting unique edges are concatenated and returned as a vector composed of segments divided by NAs. Otherwise, a two-column matrix with each row giving one pair of nodes is returned.

Helge Goessling

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```elem = matrix(c(c(1,2,3),c(3,2,4),c(4,2,5),c(5,2,6)),ncol=3,byrow=TRUE) sl.elem2linepairs(elem,concat=TRUE) ## Should return: ## [1] 1 2 3 4 5 6 2 4 NA 1 3 NA 2 5 sl.elem2linepairs(elem,concat=FALSE) ## Should return: ## [,1] [,2] ## [1,] 1 2 ## [2,] 1 3 ## [3,] 2 3 ## [4,] 2 4 ## [5,] 2 5 ## [6,] 2 6 ## [7,] 3 4 ## [8,] 4 5 ## [9,] 5 6 ```

helgegoessling/spheRlab documentation built on Sept. 29, 2017, 6:36 a.m.