Inversion: R6 class representing an inversion

InversionR Documentation

R6 class representing an inversion

Description

An inversion is given by a pole (a point) and a power (a number, possibly negative, but not zero).

Active bindings

pole

get or set the pole

power

get or set the power

Methods

Public methods


Method new()

Create a new Inversion object.

Usage
Inversion$new(pole, power)
Arguments
pole

the pole

power

the power

Returns

A new Inversion object.


Method print()

Show instance of an inversion object.

Usage
Inversion$print(...)
Arguments
...

ignored

Examples
Inversion$new(c(0,0), 2)

Method invert()

Inversion of a point.

Usage
Inversion$invert(M)
Arguments
M

a point or Inf

Returns

A point or Inf, the image of M.


Method transform()

An alias of invert.

Usage
Inversion$transform(M)
Arguments
M

a point or Inf

Returns

A point or Inf, the image of M.


Method invertCircle()

Inversion of a circle.

Usage
Inversion$invertCircle(circ)
Arguments
circ

a Circle object

Returns

A Circle object or a Line object.

Examples
# A Pappus chain
# https://www.cut-the-knot.org/Curriculum/Geometry/InversionInArbelos.shtml
opar <- par(mar = c(0,0,0,0))
plot(0, 0, type = "n", asp = 1, xlim = c(0,6), ylim = c(-4,4),
     xlab = NA, ylab = NA, axes = FALSE)
A <- c(0,0); B <- c(6,0)
ABsqr <- c(crossprod(A-B))
iota <- Inversion$new(A, ABsqr)
C <- iota$invert(c(8,0))
Sigma1 <- Circle$new((A+B)/2, sqrt(ABsqr)/2)
Sigma2 <- Circle$new((A+C)/2, sqrt(c(crossprod(A-C)))/2)
draw(Sigma1); draw(Sigma2)
circ0 <- Circle$new(c(7,0), 1)
iotacirc0 <- iota$invertCircle(circ0)
draw(iotacirc0)
for(i in 1:6){
  circ <- circ0$translate(c(0,2*i))
  iotacirc <- iota$invertCircle(circ)
  draw(iotacirc)
  circ <- circ0$translate(c(0,-2*i))
  iotacirc <- iota$invertCircle(circ)
  draw(iotacirc)
}
par(opar)

Method transformCircle()

An alias of invertCircle.

Usage
Inversion$transformCircle(circ)
Arguments
circ

a Circle object

Returns

A Circle object or a Line object.


Method invertLine()

Inversion of a line.

Usage
Inversion$invertLine(line)
Arguments
line

a Line object

Returns

A Circle object or a Line object.


Method transformLine()

An alias of invertLine.

Usage
Inversion$transformLine(line)
Arguments
line

a Line object

Returns

A Circle object or a Line object.


Method invertGcircle()

Inversion of a generalized circle (i.e. a circle or a line).

Usage
Inversion$invertGcircle(gcircle)
Arguments
gcircle

a Circle object or a Line object

Returns

A Circle object or a Line object.


Method compose()

Compose the reference inversion with another inversion. The result is a Möbius transformation.

Usage
Inversion$compose(iota1, left = TRUE)
Arguments
iota1

an Inversion object

left

logical, whether to compose at left or at right (i.e. returns iota1 o iota0 or iota0 o iota1)

Returns

A Mobius object.


Method clone()

The objects of this class are cloneable with this method.

Usage
Inversion$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

inversionSwappingTwoCircles, inversionFixingTwoCircles, inversionFixingThreeCircles to create some inversions.

Examples


## ------------------------------------------------
## Method `Inversion$print`
## ------------------------------------------------

Inversion$new(c(0,0), 2)

## ------------------------------------------------
## Method `Inversion$invertCircle`
## ------------------------------------------------

# A Pappus chain
# https://www.cut-the-knot.org/Curriculum/Geometry/InversionInArbelos.shtml
opar <- par(mar = c(0,0,0,0))
plot(0, 0, type = "n", asp = 1, xlim = c(0,6), ylim = c(-4,4),
     xlab = NA, ylab = NA, axes = FALSE)
A <- c(0,0); B <- c(6,0)
ABsqr <- c(crossprod(A-B))
iota <- Inversion$new(A, ABsqr)
C <- iota$invert(c(8,0))
Sigma1 <- Circle$new((A+B)/2, sqrt(ABsqr)/2)
Sigma2 <- Circle$new((A+C)/2, sqrt(c(crossprod(A-C)))/2)
draw(Sigma1); draw(Sigma2)
circ0 <- Circle$new(c(7,0), 1)
iotacirc0 <- iota$invertCircle(circ0)
draw(iotacirc0)
for(i in 1:6){
  circ <- circ0$translate(c(0,2*i))
  iotacirc <- iota$invertCircle(circ)
  draw(iotacirc)
  circ <- circ0$translate(c(0,-2*i))
  iotacirc <- iota$invertCircle(circ)
  draw(iotacirc)
}
par(opar)

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