| Line | R Documentation | 
A line is given by two distinct points,
named A and B, and two logical values extendA
and extendB, indicating whether the line must be extended
beyond A and B respectively. Depending on extendA
and extendB, the line is an infinite line, a half-line, or a segment.
Aget or set the point A
Bget or set the point B
extendAget or set extendA
extendBget or set extendB
new()Create a new Line object.
Line$new(A, B, extendA = TRUE, extendB = TRUE)
A, Bpoints
extendA, extendBlogical values
A new Line object.
l <- Line$new(c(1,1), c(1.5,1.5), FALSE, TRUE) l l$A l$A <- c(0,0) l
print()Show instance of a line object.
Line$print(...)
...ignored
Line$new(c(0,0), c(1,0), FALSE, TRUE)
length()Segment length, returns the length of the segment joining the two points defining the line.
Line$length()
directionAndOffset()Direction (angle between 0 and 2pi) and offset (positive number) of the reference line.
Line$directionAndOffset()
The equation of the line is cos(θ)x+sin(θ)y=d where θ is the direction and d is the offset.
isEqual()Check whether the reference line equals a given line,
without taking into account extendA and extendB.
Line$isEqual(line)
linea Line object
TRUE or FALSE.
isParallel()Check whether the reference line is parallel to a given line.
Line$isParallel(line)
linea Line object
TRUE or FALSE.
isPerpendicular()Check whether the reference line is perpendicular to a given line.
Line$isPerpendicular(line)
linea Line object
TRUE or FALSE.
includes()Whether a point belongs to the reference line.
Line$includes(M, strict = FALSE, checkCollinear = TRUE)
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) in case if you use
strict=TRUE
TRUE or FALSE.
A <- c(0,0); B <- c(1,2); M <- c(3,6) l <- Line$new(A, B, FALSE, FALSE) l$includes(M, strict = TRUE)
perpendicular()Perpendicular line passing through a given point.
Line$perpendicular(M, extendH = FALSE, extendM = TRUE)
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
A Line object; its two points are the
meeting point and the point M.
parallel()Parallel to the reference line passing through a given point.
Line$parallel(M)
Ma point
A Line object.
projection()Orthogonal projection of a point to the reference line.
Line$projection(M)
Ma point
A point.
distance()Distance from a point to the reference line.
Line$distance(M)
Ma point
A positive number.
reflection()Reflection of a point with respect to the reference line.
Line$reflection(M)
Ma point
A point.
rotate()Rotate the reference line.
Line$rotate(alpha, O, degrees = TRUE)
alphaangle of rotation
Ocenter of rotation
degreeslogical, whether alpha is given in degrees
A Line object.
translate()Translate the reference line.
Line$translate(v)
vthe vector of translation
A Line object.
invert()Invert the reference line.
Line$invert(inversion)
inversionan Inversion object
A Circle object or a Line object.
clone()The objects of this class are cloneable with this method.
Line$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `Line$new`
## ------------------------------------------------
l <- Line$new(c(1,1), c(1.5,1.5), FALSE, TRUE)
l
l$A
l$A <- c(0,0)
l
## ------------------------------------------------
## Method `Line$print`
## ------------------------------------------------
Line$new(c(0,0), c(1,0), FALSE, TRUE)
## ------------------------------------------------
## Method `Line$includes`
## ------------------------------------------------
A <- c(0,0); B <- c(1,2); M <- c(3,6)
l <- Line$new(A, B, FALSE, FALSE)
l$includes(M, strict = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.