Edge2 {tessellation}R Documentation

R6 class representing an edge in dimension 2.

Description

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

Public 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$A
edge$A <- c(1, 0)
edge

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

Edge2$new(c(2, 0), c(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)
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()))

[Package tessellation version 2.3.0 Index]