Arc: R6 class representing a circular arc

ArcR 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

center

get or set the center

radius

get or set the radius

alpha1

get or set the starting angle

alpha2

get or set the ending angle

degrees

get or set the degrees field

Methods

Public methods


Method new()

Create a new Arc object.

Usage
Arc$new(center, radius, alpha1, alpha2, degrees = TRUE)
Arguments
center

the center

radius

the radius

alpha1

the starting angle

alpha2

the ending angle

degrees

logical, whether alpha1 and alpha2 are 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
arc

an Arc object


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
npoints

number 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
deep

Whether 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")

PlaneGeometry documentation built on Aug. 10, 2023, 1:09 a.m.