Skip to contents

An edge is given by two vertices in the 2D space, named A and B. This is for example an edge of a Voronoï cell of a 2D Delaunay tessellation.

Active bindings

A

get or set the vertex A

B

get or set the vertex B

Methods


Method new()

Create a new Edge2 object.

Usage

Edge2$new(A, B)

Arguments

A

the vertex A

B

the vertex B

Returns

A new Edge2 object.

Examples

edge <- Edge2$new(c(1, 1), c(2, 3))
edge
edge$A
edge$A <- c(1, 0)
edge


Method print()

Show instance of an Edge2 object.

Usage

Edge2$print(...)

Arguments

...

ignored

Examples

Edge2$new(c(2, 0), c(3, -1))


Method plot()

Plot an Edge2 object.

Usage

Edge2$plot(color = "black", ...)

Arguments

color

the color of the edge

...

graphical parameters such as lty or lwd

Examples

library(tessellation)
centricSquare <- rbind(
  c(-1, 1), c(1, 1), c(1, -1), c(-1, -1), c(0, 0)
)
d <- delaunay(centricSquare)
v <- voronoi(d)
cell5 <- v[[5]] # the cell of the point (0, 0), at the center
isBoundedCell(cell5) # TRUE
plot(centricSquare, type = "n")
invisible(lapply(cell5[["cell"]], function(edge) edge$plot()))


Method stack()

Stack the two vertices of the edge (this is for internal purpose).

Usage

Edge2$stack()


Method clone()

The objects of this class are cloneable with this method.

Usage

Edge2$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Edge2$new`
## ------------------------------------------------

edge <- Edge2$new(c(1, 1), c(2, 3))
edge
#> Edge:
#>  vertex A: 1, 1
#>  vertex B: 2, 3
edge$A
#> [1] 1 1
edge$A <- c(1, 0)
edge
#> Edge:
#>  vertex A: 1, 0
#>  vertex B: 2, 3

## ------------------------------------------------
## Method `Edge2$print`
## ------------------------------------------------

Edge2$new(c(2, 0), c(3, -1))
#> Edge:
#>  vertex A: 2, 0
#>  vertex B: 3, -1

## ------------------------------------------------
## Method `Edge2$plot`
## ------------------------------------------------

library(tessellation)
centricSquare <- rbind(
  c(-1, 1), c(1, 1), c(1, -1), c(-1, -1), c(0, 0)
)
d <- delaunay(centricSquare)
v <- voronoi(d)
#> Voronoï diagram with one bounded cell.
cell5 <- v[[5]] # the cell of the point (0, 0), at the center
isBoundedCell(cell5) # TRUE
#> [1] TRUE
plot(centricSquare, type = "n")
invisible(lapply(cell5[["cell"]], function(edge) edge$plot()))