TriPlot: Triangulation Plot

View source: R/TriPlot.R

TriPlotR Documentation

Triangulation Plot

Description

This function plots a 2D triangulation.

Usage

TriPlot(V, Tr, col = 1, lwd = 1)

Arguments

V

an N by two matrix that lists vertices with the ith row storing in Cartesian coordinates for the ith vertex. N is the number of vertices.

Tr

a K by three matrix that each row represents one triangle. All the elements are the integers that stand for the indices of vertices in V.

col

A specification for the plotting color, defaulting to 1.

lwd

The line width, a positive number, defaulting to 1. The interpretation is device-specific, and some devices do not implement line widths less than one.

Value

A triangulation plot of a 2D region.

Examples

# rectangular domain
bb=rbind(c(0,0),c(1,0),c(1,1),c(0,1))
VT=TriMesh(bb,2)
TriPlot(VT$V,VT$Tr)

# irregular domains
data("horseshoe")
VT=TriMesh(horseshoe,n=8)
TriPlot(VT$V,VT$Tr)

data('shape')
VT=TriMesh(shape,15)
TriPlot(VT$V,VT$Tr)

data('weird')
VT=TriMesh(weird,25)
TriPlot(VT$V,VT$Tr)

# region with holes
data("BMP")
VT=TriMesh(BMP$bound,25,list(as.matrix(BMP$H1),as.matrix(BMP$H2)))
TriPlot(VT$V,VT$Tr)

data("mymontreal")
VT=TriMesh(mymontreal$bound,25,list(mymontreal$H1,mymontreal$H2))
TriPlot(VT$V,VT$Tr)

funstatpackages/Triangulation documentation built on July 3, 2024, 5:52 p.m.