EllipticalArc: R6 class representing an elliptical arc

EllipticalArcR Documentation

R6 class representing an elliptical arc

Description

An arc is given by an ellipse (Ellipse object), a starting angle and an ending angle. They are respectively named ell, alpha1 and alpha2.

Active bindings

ell

get or set the ellipse

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 EllipticalArc object.

Usage
EllipticalArc$new(ell, alpha1, alpha2, degrees = TRUE)
Arguments
ell

the ellipse

alpha1

the starting angle

alpha2

the ending angle

degrees

logical, whether alpha1 and alpha2 are given in degrees

Returns

A new EllipticalArc object.

Examples
ell <- Ellipse$new(c(-4,0), 4, 2.5, 140)
EllipticalArc$new(ell, 45, 90)

Method print()

Show instance of an EllipticalArc object.

Usage
EllipticalArc$print(...)
Arguments
...

ignored


Method startingPoint()

Starting point of the reference elliptical arc.

Usage
EllipticalArc$startingPoint()

Method endingPoint()

Ending point of the reference elliptical arc.

Usage
EllipticalArc$endingPoint()

Method isEqual()

Check whether the reference elliptical arc equals another elliptical arc.

Usage
EllipticalArc$isEqual(arc)
Arguments
arc

an EllipticalArc object


Method complementaryArc()

Complementary elliptical arc of the reference elliptical arc.

Usage
EllipticalArc$complementaryArc()
Examples
ell <- Ellipse$new(c(-4,0), 4, 2.5, 140)
arc <- EllipticalArc$new(ell, 30, 60)
plot(NULL, type = "n", asp = 1, xlim = c(-8,0), ylim = c(-3.2,3.2),
     xlab = NA, ylab = NA)
draw(arc, lwd = 3, col = "red")
draw(arc$complementaryArc(), lwd = 3, col = "green")

Method path()

The reference elliptical arc as a path.

Usage
EllipticalArc$path(npoints = 100L)
Arguments
npoints

number of points of the path

Returns

A matrix with two columns x and y of length npoints.


Method length()

The length of the elliptical arc.

Usage
EllipticalArc$length()
Returns

A number, the arc length.


Method clone()

The objects of this class are cloneable with this method.

Usage
EllipticalArc$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `EllipticalArc$new`
## ------------------------------------------------

ell <- Ellipse$new(c(-4,0), 4, 2.5, 140)
EllipticalArc$new(ell, 45, 90)

## ------------------------------------------------
## Method `EllipticalArc$complementaryArc`
## ------------------------------------------------

ell <- Ellipse$new(c(-4,0), 4, 2.5, 140)
arc <- EllipticalArc$new(ell, 30, 60)
plot(NULL, type = "n", asp = 1, xlim = c(-8,0), ylim = c(-3.2,3.2),
     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.