Method new()
Create a new Line
object.
Usage
Line$new(A, B, extendA = TRUE, extendB = TRUE)
extendA, extendB
logical 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
Show instance of a line object.
Examples
Line$new(c(0,0), c(1,0), FALSE, TRUE)
Segment length, returns the length of the segment joining
the two points defining the line.
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
cos(θ)x+sin(θ)y=d
where θ is the direction
and d is the offset.
Method isEqual()
Check whether the reference line equals a given line,
without taking into account extendA
and extendB
.
Arguments
line
a Line
object
Method isParallel()
Check whether the reference line is parallel to a given line.
Usage
Line$isParallel(line)
Arguments
line
a Line
object
Method isPerpendicular()
Check whether the reference line is perpendicular to a given line.
Usage
Line$isPerpendicular(line)
Arguments
line
a Line
object
Method includes()
Whether a point belongs to the reference line.
Usage
Line$includes(M, strict = FALSE, checkCollinear = TRUE)
Arguments
M
the point for which we want to test whether it belongs to the
line
strict
logical, whether to take into account extendA
and extendB
checkCollinear
logical, whether to check the collinearity of
A
, B
, M
; set to FALSE
only if you are sure
that M
is on the line (AB)
in case if you use
strict=TRUE
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
M
the point through which the perpendicular passes.
extendH
logical, whether to extend the perpendicular line
beyond the meeting point
extendM
logical, 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.
Method projection()
Orthogonal projection of a point to the reference line.
Method distance()
Distance from a point to the reference line.
Returns
A positive number.
Method reflection()
Reflection of a point with respect to the reference line.
Method rotate()
Rotate the reference line.
Usage
Line$rotate(alpha, O, degrees = TRUE)
Arguments
alpha
angle of rotation
O
center of rotation
degrees
logical, whether alpha
is given in degrees
Method translate()
Translate the reference line.
Arguments
v
the vector of translation
Method invert()
Invert the reference line.
Usage
Line$invert(inversion)
Arguments
inversion
an 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
deep
Whether to make a deep clone.