-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
204 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
\name{grid.minkowski} | ||
\alias{grid.minkowski} | ||
\alias{minkowskiGrob} | ||
\title{ | ||
Generate Minkowski Sums of Grobs | ||
} | ||
\description{ | ||
Given a polygonal \dfn{pattern} and a polygonal \dfn{path}, | ||
generate the Minkowski Sum by adding the pattern to the path. | ||
} | ||
\usage{ | ||
minkowskiGrob(A, B, | ||
grobFn=xyListToPath, | ||
name=NULL, gp=gpar(), ...) | ||
grid.minkowski(A, B, ...) | ||
} | ||
\arguments{ | ||
\item{A}{ | ||
A grob, gList, or gTree, or a gPath or a character value | ||
identifying a grob that has already been drawn. This is known as the | ||
\dfn{pattern} grob. | ||
} | ||
\item{B}{ | ||
A grob, gList, or gTree, or a gPath or a character value | ||
identifying a grob that has already been drawn. This is known as the | ||
\dfn{path} grob. | ||
} | ||
\item{grobFn}{ | ||
The function that is used to create the final grob result. | ||
Predefined options are: \code{\link{xyListToPath}}, | ||
\code{\link{xyListToPolygon}}, and | ||
\code{\link{xyListToLine}}. | ||
} | ||
\item{name}{ | ||
A name for the resulting grob. | ||
} | ||
\item{gp}{ | ||
Graphical parameter settings for the resulting grob. | ||
} | ||
\item{\dots}{ | ||
For \code{minkowskiGrob}, arguments passed on to | ||
\code{polyclip::polyminkowski}. | ||
} | ||
} | ||
\details{ | ||
Both \code{A} and \code{B} should not contain self-intersections, | ||
though they can be non-convex. | ||
} | ||
\value{ | ||
\code{minkowskiGrob} returns a gTree. | ||
|
||
\code{grid.minkowski} is only used for its side-effect of drawing | ||
on the current graphics device. | ||
} | ||
\author{ | ||
Jack Wong | ||
} | ||
\seealso{ | ||
\code{\link{xyListToPath}}, | ||
\code{\link{xyListToPolygon}}, | ||
\code{\link{xyListToLine}}, | ||
\code{\link{polyminkowski}} | ||
} | ||
\examples{ | ||
pattern <- circleGrob(x = 0, y = 0, r = .1) | ||
path <- rectGrob(width = 0.5, height = 0.5) | ||
minkowski <- minkowskiGrob(pattern, path) | ||
grid.draw(minkowski) | ||
} | ||
\keyword{ dplot } | ||
\keyword{ aplot } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
\name{polyminkowski} | ||
\alias{polyminkowski} | ||
\alias{polyminkowski.grob} | ||
\alias{polyminkowski.gList} | ||
\alias{polyminkowski.gPath} | ||
\alias{polyminkowski.character} | ||
\title{ | ||
Generate Minkowski Sums on Coordinates | ||
} | ||
\description{ | ||
This function generates the Minkowski Sum of two sets of coordinates. | ||
} | ||
\usage{ | ||
polyminkowski(A, B, ...) | ||
\method{polyminkowski}{grob}(A, B, closed=isClosedShape(B), | ||
reduceA = "union", | ||
reduceB = "union", | ||
...) | ||
\method{polyminkowski}{gList}(A, B, closed=isClosedShape(B), | ||
reduceA = "union", | ||
reduceB = "union", | ||
...) | ||
\method{polyminkowski}{gPath}(A, B, closed, | ||
strict=FALSE, grep=FALSE, global=FALSE, | ||
reduceA = "union", | ||
reduceB = "union", | ||
...) | ||
\method{polyminkowski}{character}(A, B, closed, | ||
strict=FALSE, grep=FALSE, global=FALSE, | ||
reduceA = "union", | ||
reduceB = "union", | ||
...) | ||
} | ||
\arguments{ | ||
\item{A}{ | ||
A set of coordinates describing a | ||
\dfn{pattern} shape. | ||
Or a grob, gList, or a gPath (or a character value) | ||
identifying a grob that has already been drawn from which | ||
coordinates are generated. | ||
} | ||
\item{B}{ | ||
A set of coordinates describing a | ||
\dfn{path} shape. | ||
Or a grob, gList, or a gPath (or a character value) | ||
identifying a grob that has already been drawn from which | ||
coordinates are generated. | ||
} | ||
\item{closed}{ | ||
A logical value indicating whether the \code{B} coordinates describe | ||
a closed shape or an open shape. | ||
} | ||
\item{reduceA, reduceB}{ | ||
A character value describing the operation to be used if either | ||
\code{A} or \code{B} need to be reduced to a single set of | ||
coordinates. One of | ||
\code{"intersection"}, \code{"minus"}, \code{"union"}, or | ||
\code{"xor"}, in which case \code{polyminkowski} is used to | ||
reduce multiple shapes, or \code{"flatten"}, in which case | ||
coordinates for all shapes are returned. | ||
} | ||
\item{strict, grep, global}{ | ||
Arguments controlling the interpretation of the gPath | ||
(passed to \code{grid.get}). | ||
} | ||
\item{\dots}{ | ||
Arguments used by methods. | ||
} | ||
} | ||
\details{ | ||
The shape described by the pattern coordinates is added | ||
to the shape described by the path coordinates. | ||
} | ||
\value{ | ||
The result is a new set of coordinates. | ||
} | ||
\author{ | ||
Paul Murrell | ||
} | ||
\seealso{ | ||
\code{\link{grid.minkowski}} | ||
} | ||
\examples{ | ||
c <- circleGrob(x=0, y=0, r=.1) | ||
r <- rectGrob(width=.5, height=.5) | ||
polyminkowski(c, r) | ||
} | ||
\keyword{ dplot } | ||
\keyword{ aplot } |