This function extracts a list of triangles from an triangulation object created by tri.mesh.

triangles(tri.obj)

Arguments

tri.obj

object of class triSht

Details

The vertices in the returned matrix (let's denote it with retval) are ordered counterclockwise. The columns tr\(x\) and arc\(x\), \(x=1,2,3\) index the triangle and arc, respectively, which are opposite (not shared by) node node\(x\), with tri\(x=0\) if arc\(x\) indexes a boundary arc. Vertex indexes range from 1 to \(n\), the number of nodes, triangle indexes from 0 to \(nt\), and arc indexes from 1 to \(na = nt+n-1\).

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

Albrecht Gebhardt <albrecht.gebhardt@aau.at>, Roger Bivand <roger.bivand@nhh.no>

Examples

# use the smallest Franke data set
data(franke)
fr3.tr<-tri.mesh(franke$ds3$x, franke$ds3$y)
triangles(fr3.tr)
#>       node1 node2 node3 tr1 tr2 tr3 arc1 arc2 arc3
#>  [1,]     1    11     4   2   3   0    1    2    3
#>  [2,]    12     4    11   1   7   5    1    4    5
#>  [3,]     8     1     4   1   9   0    2    6    7
#>  [4,]    10     4     6   5  15   9    8    9   10
#>  [5,]     4    12     6   8   4   2   11    8    5
#>  [6,]    12     5    16  13   8   7   12   13   14
#>  [7,]     5    12    11   2   0   6    4   15   14
#>  [8,]    12    16     6  11   5   6   16   11   13
#>  [9,]    10     8     4   3   4  14    6   10   17
#> [10,]    13     3     6  15  18  24   18   19   20
#> [11,]    21     6    16   8  17  18   16   21   22
#> [12,]    16    22    17  19  17  13   23   24   25
#> [13,]    22    16     5   6  20  12   12   26   25
#> [14,]     3     8    10   9  15  23   17   27   28
#> [15,]     6     3    10  14   4  10   27    9   18
#> [16,]    15    21    17  17  22  21   29   30   31
#> [17,]    16    17    21  16  11  12   29   21   24
#> [18,]    13     6    21  11  21  10   22   32   19
#> [19,]    19    17    22  12  31  28   23   33   34
#> [20,]    25    22     5  13  30  31   26   35   36
#> [21,]    15    13    21  18  16  26   32   31   37
#> [22,]    17    23    15  27  16  28   38   30   39
#> [23,]     2     8     3  14  34   0   28   40   41
#> [24,]     9     3    13  10  25  34   20   42   43
#> [25,]     9    13    14  26  35  24   44   45   42
#> [26,]    13    15    14  32  25  21   46   44   37
#> [27,]    15    23    18  39  32  22   47   48   38
#> [28,]    19    23    17  22  19  33   39   34   49
#> [29,]    25     7    19  40  31  30   50   51   52
#> [30,]     7    25     5  20   0  29   35   53   52
#> [31,]    19    22    25  20  29  19   36   51   33
#> [32,]    15    18    14  36  26  27   54   46   48
#> [33,]    24    23    19  28  40  39   49   55   56
#> [34,]     9     2     3  23  24   0   40   43   57
#> [35,]    14    20     9  38  25  36   58   45   59
#> [36,]    14    18    20  37  35  32   60   59   54
#> [37,]    18    24    20  38  36  39   61   60   62
#> [38,]    24     9    20  35  37   0   58   61   63
#> [39,]    24    18    23  27  33  37   47   56   62
#> [40,]    24    19     7  29   0  33   50   64   55