Skip to contents

This function demonstrates a simple approach to connect five 2D points into a set of three triangles. For demonstration purposes only: the triangles here are formed by a fixed (toy) example.

Usage

connect_five_points(points)

Arguments

points

A matrix with exactly five rows (x and y coordinates).

Value

A list with two elements:

points

The original points (matrix).

edges

A matrix of edges (each row is a pair of point indices forming an edge).

Examples

data("sample_points")
result <- connect_five_points(sample_points)
print(result)
#> $points
#>      x y
#> [1,] 1 1
#> [2,] 2 2
#> [3,] 2 4
#> [4,] 4 5
#> [5,] 5 1
#> 
#> $edges
#>       [,1] [,2]
#>  [1,]    1    2
#>  [2,]    2    3
#>  [3,]    3    1
#>  [4,]    2    3
#>  [5,]    3    4
#>  [6,]    4    2
#>  [7,]    3    4
#>  [8,]    4    5
#>  [9,]    5    3
#>