Public methods
Method new()
Create a new Line object.
Usage
Line$new(A, B, extendA = TRUE, extendB = TRUE)
Arguments
A, Bpoints
extendA, extendBlogical values
Returns
A new Line object.
Examples
l <- Line$new(c(1,1), c(1.5,1.5), FALSE, TRUE)
l
l$A
l$A <- c(0,0)
l
Method print()
Show instance of a line object.
Usage
Line$print(...)
Arguments
...ignored
Examples
Line$new(c(0,0), c(1,0), FALSE, TRUE)
Method directionAndOffset()
Direction (angle between 0 and 2pi)
and offset (positive number) of the reference line.
Usage
Line$directionAndOffset()
Details
The equation of the line is
where is the direction
and is the offset.
Method isEqual()
Check whether the reference line equals a given line,
without taking into account extendA and extendB.
Usage
Line$isEqual(line)
Arguments
linea Line object
Returns
TRUE or FALSE.
Method isParallel()
Check whether the reference line is parallel to a given line.
Usage
Line$isParallel(line)
Arguments
linea Line object
Returns
TRUE or FALSE.
Method includes()
Whether a point belongs to the reference line.
Usage
Line$includes(M, strict = FALSE, checkCollinear = TRUE)
Arguments
Mthe point for which we want to test whether it belongs to the line
strictlogical, whether to take into account extendA and extendB
checkCollinearlogical, whether to check the collinearity of
A, B, M; set to FALSE only if you are sure that
M is on the line (AB) (if you use strict=TRUE)
Returns
TRUE or FALSE.
Examples
A <- c(0,0); B <- c(1,2); M <- c(3,6)
l <- Line$new(A, B, FALSE, FALSE)
l$includes(M, strict = TRUE)
Method perpendicular()
Perpendicular line passing through a given point.
Usage
Line$perpendicular(M, extendH = FALSE, extendM = TRUE)
Arguments
Mthe point through which the perpendicular passes.
extendHlogical, whether to extend the perpendicular line
beyond the meeting point
extendMlogical, whether to extend the perpendicular line
beyond the point M
Returns
A Line object; its two points are the
meeting point and the point M.
Method parallel()
Parallel to the reference line passing through a given point.
Usage
Line$parallel(M)
Arguments
Ma point
Returns
A Line object.
Method projection()
Orthogonal projection of a point to the reference line.
Usage
Line$projection(M)
Arguments
Ma point
Returns
A point.
Method distance()
Distance from a point to the reference line.
Usage
Line$distance(M)
Arguments
Ma point
Returns
A positive number.
Method reflection()
Reflection of a point with respect to the reference line.
Usage
Line$reflection(M)
Arguments
Ma point
Returns
A point.
Method rotate()
Rotate the reference line.
Usage
Line$rotate(alpha, O, degrees = TRUE)
Arguments
alphaangle of rotation
Ocenter of rotation
degreeslogical, whether alpha is given in degrees
Returns
A Line object.
Method translate()
Translate the reference line.
Usage
Line$translate(v)
Arguments
vthe vector of translation
Returns
A Line object.
Method invert()
Invert the reference line.
Usage
Line$invert(inversion)
Arguments
inversionan Inversion object
Returns
A Circle object or a Line object.
Method clone()
The objects of this class are cloneable with this method.
Usage
Line$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.