triangles: Extract a list of triangles from a triangulation object

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/triangles.R

Description

This function extracts a triangulation data structure from an triangulation object created by tri.mesh.

The vertices in the returned matrix (let's denote it with retval) are ordered counterclockwise with the first vertex taken to be the one with smallest index. Thus, retval[i,"node2"] and retval[i,"node3"] are larger than retval[i,"node3"] and index adjacent neighbors of node retval[i,"node1"]. The columns trx and arcx, x=1,2,3 index the triangle and arc, respectively, which are opposite (not shared by) node nodex, with trix= 0 if arcx indexes a boundary arc. Vertex indexes range from 1 to N, triangle indexes from 0 to NT, and, if included, arc indexes from 1 to NA = NT+N-1. The triangles are ordered on first (smallest) vertex indexes, except that the sets of constraint triangles (triangles contained in the closure of a constraint region) follow the non-constraint triangles.

Usage

1
triangles(tri.obj)

Arguments

tri.obj

object of class "tri"

Value

A matrix with columns node1,node2,node3, representing the vertex nodal indexes, tr1,tr2,tr3, representing neighboring triangle indexes and arc1,arc2,arc3 reresenting arc indexes.

Each row represents one triangle.

Author(s)

A. Gebhardt

References

R. J. Renka (1996). Algorithm 751: TRIPACK: a constrained two-dimensional Delaunay triangulation package. ACM Transactions on Mathematical Software. 22, 1-8.

See Also

tri, print.tri, plot.tri, summary.tri, triangles

Examples

1
2
3
4
# use a slighlty modified version of data(tritest)
data(tritest2)
tritest2.tr<-tri.mesh(tritest2$x,tritest2$y)
triangles(tritest2.tr)

Example output

      node1 node2 node3 tr1 tr2 tr3 arc1 arc2 arc3
 [1,]     1     2     3   6   2   0    7    2    1
 [2,]     1     3     4   8   3   1   10    4    2
 [3,]     1     4     7   9   0   2   12    3    4
 [4,]     2     8     5  11   5   0   15    6    5
 [5,]     2     5    10  12   6   4   16    8    6
 [6,]     2    10     3   7   1   5    9    7    8
 [7,]     3    10     9  17   8   6   26   11    9
 [8,]     3     9     4  10   2   7   14   10   11
 [9,]     4    12     7  14   3  10   19   12   13
[10,]     4     9    12  18   9   8   28   13   14
[11,]     5     8    11  16  12   4   22   17   15
[12,]     5    11    10  17   5  11   25   16   17
[13,]     6     8     7   0  14  16   18   20   23
[14,]     6     7    12   9  15  13   19   21   20
[15,]     6    12    11  18  16  14   27   24   21
[16,]     6    11     8  11  13  15   22   23   24
[17,]     9    10    11  12  18   7   25   29   26
[18,]     9    11    12  15  10  17   27   28   29

tripack documentation built on July 8, 2020, 5:59 p.m.

Related to triangles in tripack...