| Arc {PlaneGeometry} | R Documentation |
R6 class representing a circular arc
Description
An arc is given by a center, a radius, a starting angle and
an ending angle. They are respectively named center, radius,
alpha1 and alpha2.
Active bindings
centerget or set the center
radiusget or set the radius
alpha1get or set the starting angle
alpha2get or set the ending angle
degreesget or set the
degreesfield
Methods
Public methods
Method new()
Create a new Arc object.
Usage
Arc$new(center, radius, alpha1, alpha2, degrees = TRUE)
Arguments
centerthe center
radiusthe radius
alpha1the starting angle
alpha2the ending angle
degreeslogical, whether
alpha1andalpha2are given in degrees
Returns
A new Arc object.
Examples
arc <- Arc$new(c(1,1), 1, 45, 90) arc arc$center arc$center <- c(0,0) arc
Method print()
Show instance of an Arc object.
Usage
Arc$print(...)
Arguments
...ignored
Examples
Arc$new(c(0,0), 2, pi/4, pi/2, FALSE)
Method startingPoint()
Starting point of the reference arc.
Usage
Arc$startingPoint()
Method endingPoint()
Ending point of the reference arc.
Usage
Arc$endingPoint()
Method isEqual()
Check whether the reference arc equals another arc.
Usage
Arc$isEqual(arc)
Arguments
arcan
Arcobject
Method complementaryArc()
Complementary arc of the reference arc.
Usage
Arc$complementaryArc()
Examples
arc <- Arc$new(c(0,0), 1, 30, 60)
plot(NULL, type = "n", asp = 1, xlim = c(-1,1), ylim = c(-1,1),
xlab = NA, ylab = NA)
draw(arc, lwd = 3, col = "red")
draw(arc$complementaryArc(), lwd = 3, col = "green")
Method path()
The reference arc as a path.
Usage
Arc$path(npoints = 100L)
Arguments
npointsnumber of points of the path
Returns
A matrix with two columns x and y of length
npoints. See "Filling the lapping area of two circles" in the
vignette for an example.
Method clone()
The objects of this class are cloneable with this method.
Usage
Arc$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `Arc$new`
## ------------------------------------------------
arc <- Arc$new(c(1,1), 1, 45, 90)
arc
arc$center
arc$center <- c(0,0)
arc
## ------------------------------------------------
## Method `Arc$print`
## ------------------------------------------------
Arc$new(c(0,0), 2, pi/4, pi/2, FALSE)
## ------------------------------------------------
## Method `Arc$complementaryArc`
## ------------------------------------------------
arc <- Arc$new(c(0,0), 1, 30, 60)
plot(NULL, type = "n", asp = 1, xlim = c(-1,1), ylim = c(-1,1),
xlab = NA, ylab = NA)
draw(arc, lwd = 3, col = "red")
draw(arc$complementaryArc(), lwd = 3, col = "green")