Projection: R6 class representing a projection

ProjectionR Documentation

R6 class representing a projection

Description

A projection on a line D parallel to another line Delta is given by the line of projection (D) and the directrix line (Delta).

Active bindings

D

get or set the projection line

Delta

get or set the directrix line

Methods

Public methods


Method new()

Create a new Projection object.

Usage
Projection$new(D, Delta)
Arguments
D, Delta

two Line objects such that the two lines meet (not parallel); or Delta = NULL for orthogonal projection onto D

Returns

A new Projection object.

Examples
D <- Line$new(c(1,1), c(5,5))
Delta <- Line$new(c(0,0), c(3,4))
Projection$new(D, Delta)

Method print()

Show instance of a projection object.

Usage
Projection$print(...)
Arguments
...

ignored


Method project()

Project a point.

Usage
Projection$project(M)
Arguments
M

a point

Examples
D <- Line$new(c(1,1), c(5,5))
Delta <- Line$new(c(0,0), c(3,4))
P <- Projection$new(D, Delta)
M <- c(1,3)
Mprime <- P$project(M)
D$includes(Mprime) # should be TRUE
Delta$isParallel(Line$new(M, Mprime)) # should be TRUE

Method transform()

An alias of project.

Usage
Projection$transform(M)
Arguments
M

a point


Method getMatrix()

Augmented matrix of the projection.

Usage
Projection$getMatrix()
Returns

A 3x3 matrix.

Examples
P <- Projection$new(Line$new(c(2,2), c(4,5)), Line$new(c(0,0), c(1,1)))
M <- c(1,5)
P$project(M)
P$getMatrix() %*% c(M,1)

Method asAffine()

Convert the reference projection to an Affine object.

Usage
Projection$asAffine()

Method clone()

The objects of this class are cloneable with this method.

Usage
Projection$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Note

For an orthogonal projection, you can use the projection method of the Line R6 class.

Examples


## ------------------------------------------------
## Method `Projection$new`
## ------------------------------------------------

D <- Line$new(c(1,1), c(5,5))
Delta <- Line$new(c(0,0), c(3,4))
Projection$new(D, Delta)

## ------------------------------------------------
## Method `Projection$project`
## ------------------------------------------------

D <- Line$new(c(1,1), c(5,5))
Delta <- Line$new(c(0,0), c(3,4))
P <- Projection$new(D, Delta)
M <- c(1,3)
Mprime <- P$project(M)
D$includes(Mprime) # should be TRUE
Delta$isParallel(Line$new(M, Mprime)) # should be TRUE

## ------------------------------------------------
## Method `Projection$getMatrix`
## ------------------------------------------------

P <- Projection$new(Line$new(c(2,2), c(4,5)), Line$new(c(0,0), c(1,1)))
M <- c(1,5)
P$project(M)
P$getMatrix() %*% c(M,1)

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