GeneratePolygon: Generate polypon points for Ramer–Douglas–Peucker algorithm...

Description Usage Arguments Value Examples

Description

Generate polypon points for Ramer–Douglas–Peucker algorithm visualization.

Usage

1
GeneratePolygon(pt1, pt2, dist = 1)

Arguments

pt1

.

pt2

.

dist

.

Value

a matrix with dimension 4*2 denoting the 4 vertices of the polygon.

Examples

1
2
3
4
5
library(ggplot2)
point_set <- rbind(c(0,0),c(2,2))
GeneratePolygon(point_set[1,],point_set[2,])
df <- data.frame(t(GeneratePolygon(point_set[1,],point_set[2,],dist=0.2)))
ggplot(df,aes(X1,X2)) + geom_polygon(fill='lightblue',alpha=0.5)

platypus1989/PathMatch documentation built on May 15, 2019, 5:51 p.m.