| Circle | R Documentation |
A circle is given by a center and a radius,
named center and radius.
centerget or set the center
radiusget or set the radius
new()Create a new Circle object.
Circle$new(center, radius)
centerthe center
radiusthe radius
A new Circle object.
circ <- Circle$new(c(1,1), 1) circ circ$center circ$center <- c(0,0) circ
print()Show instance of a circle object.
Circle$print(...)
...ignored
Circle$new(c(0,0), 2)
pointFromAngle()Get a point on the reference circle from its polar angle.
Circle$pointFromAngle(alpha, degrees = TRUE)
alphaa number, the angle
degreeslogical, whether alpha is given in degrees
The point on the circle with polar angle alpha.
diameter()Diameter of the reference circle for a given polar angle.
Circle$diameter(alpha)
alphaan angle in radians, there is one diameter for each value of
alpha modulo pi
A segment (Line object).
circ <- Circle$new(c(1,1), 5)
diams <- lapply(c(0, pi/3, 2*pi/3), circ$diameter)
plot(NULL, type="n", asp=1, xlim = c(-4,6), ylim = c(-5,7),
xlab = NA, ylab = NA)
draw(circ, lwd = 2, col = "yellow")
invisible(lapply(diams, draw, col = "blue"))
tangent()Tangent of the reference circle at a given polar angle.
Circle$tangent(alpha)
alphaan angle in radians, there is one tangent for each value of
alpha modulo 2*pi
circ <- Circle$new(c(1,1), 5)
tangents <- lapply(c(0, pi/3, 2*pi/3, pi, 4*pi/3, 5*pi/3), circ$tangent)
plot(NULL, type="n", asp=1, xlim = c(-4,6), ylim = c(-5,7),
xlab = NA, ylab = NA)
draw(circ, lwd = 2, col = "yellow")
invisible(lapply(tangents, draw, col = "blue"))
tangentsThroughExternalPoint()Return the two tangents of the reference circle passing through an external point.
Circle$tangentsThroughExternalPoint(P)
Pa point external to the reference circle
A list of two Line objects, the two tangents; the
tangency points are in the B field of the lines.
isEqual()Check whether the reference circle equals another circle.
Circle$isEqual(circ)
circa Circle object
isDifferent()Check whether the reference circle differs from another circle.
Circle$isDifferent(circ)
circa Circle object
isOrthogonal()Check whether the reference circle is orthogonal to a given circle.
Circle$isOrthogonal(circ)
circa Circle object
angle()Angle between the reference circle and a given circle, if they intersect.
Circle$angle(circ)
circa Circle object
includes()Check whether a point belongs to the reference circle.
Circle$includes(M)
Ma point
orthogonalThroughTwoPointsOnCircle()Orthogonal circle passing through two points on the reference circle.
Circle$orthogonalThroughTwoPointsOnCircle(alpha1, alpha2, arc = FALSE)
alpha1, alpha2two angles defining two points on the reference circle
arclogical, whether to return only the arc at the interior of the reference circle
A Circle object if arc=FALSE, an Arc object
if arc=TRUE, or a Line object: the diameter
of the reference circle defined by the two points in case when the two
angles differ by pi.
# hyperbolic triangle circ <- Circle$new(c(5,5), 3) arc1 <- circ$orthogonalThroughTwoPointsOnCircle(0, 2*pi/3, arc = TRUE) arc2 <- circ$orthogonalThroughTwoPointsOnCircle(2*pi/3, 4*pi/3, arc = TRUE) arc3 <- circ$orthogonalThroughTwoPointsOnCircle(4*pi/3, 0, arc = TRUE) opar <- par(mar = c(0,0,0,0)) plot(0, 0, type = "n", asp = 1, xlim = c(2,8), ylim = c(2,8)) draw(circ) draw(arc1, col = "red", lwd = 2) draw(arc2, col = "green", lwd = 2) draw(arc3, col = "blue", lwd = 2) par(opar)
orthogonalThroughTwoPointsWithinCircle()Orthogonal circle passing through two points within the reference circle.
Circle$orthogonalThroughTwoPointsWithinCircle(P1, P2, arc = FALSE)
P1, P2two distinct points in the interior of the reference circle
arclogical, whether to return the arc joining the two points instead of the circle
A Circle object or an Arc object,
or a Line object if the two points are on a diameter.
circ <- Circle$new(c(0,0),3)
P1 <- c(1,1); P2 <- c(1, 2)
ocirc <- circ$orthogonalThroughTwoPointsWithinCircle(P1, P2)
arc <- circ$orthogonalThroughTwoPointsWithinCircle(P1, P2, arc = TRUE)
plot(0, 0, type = "n", asp = 1, xlab = NA, ylab = NA,
xlim = c(-3, 4), ylim = c(-3, 4))
draw(circ, lwd = 2)
draw(ocirc, lty = "dashed", lwd = 2)
draw(arc, lwd = 3, col = "blue")
power()Power of a point with respect to the reference circle.
Circle$power(M)
Mpoint
A number.
radicalCenter()Radical center of two circles.
Circle$radicalCenter(circ2)
circ2a Circle object
radicalAxis()Radical axis of two circles.
Circle$radicalAxis(circ2)
circ2a Circle object
A Line object.
rotate()Rotate the reference circle.
Circle$rotate(alpha, O, degrees = TRUE)
alphaangle of rotation
Ocenter of rotation
degreeslogical, whether alpha is given in degrees
A Circle object.
translate()Translate the reference circle.
Circle$translate(v)
vthe vector of translation
A Circle object.
invert()Invert the reference circle.
Circle$invert(inversion)
inversionan Inversion object
A Circle object or a Line object.
asEllipse()Convert the reference circle to an Ellipse object.
Circle$asEllipse()
randomPoints()Random points on or in the reference circle.
Circle$randomPoints(n, where = "in")
nan integer, the desired number of points
where"in" to generate inside the circle,
"on" to generate on the circle
The generated points in a two columns matrix with n rows.
clone()The objects of this class are cloneable with this method.
Circle$clone(deep = FALSE)
deepWhether to make a deep clone.
radicalCenter for the radical center of three circles.
## ------------------------------------------------
## Method `Circle$new`
## ------------------------------------------------
circ <- Circle$new(c(1,1), 1)
circ
circ$center
circ$center <- c(0,0)
circ
## ------------------------------------------------
## Method `Circle$print`
## ------------------------------------------------
Circle$new(c(0,0), 2)
## ------------------------------------------------
## Method `Circle$diameter`
## ------------------------------------------------
circ <- Circle$new(c(1,1), 5)
diams <- lapply(c(0, pi/3, 2*pi/3), circ$diameter)
plot(NULL, type="n", asp=1, xlim = c(-4,6), ylim = c(-5,7),
xlab = NA, ylab = NA)
draw(circ, lwd = 2, col = "yellow")
invisible(lapply(diams, draw, col = "blue"))
## ------------------------------------------------
## Method `Circle$tangent`
## ------------------------------------------------
circ <- Circle$new(c(1,1), 5)
tangents <- lapply(c(0, pi/3, 2*pi/3, pi, 4*pi/3, 5*pi/3), circ$tangent)
plot(NULL, type="n", asp=1, xlim = c(-4,6), ylim = c(-5,7),
xlab = NA, ylab = NA)
draw(circ, lwd = 2, col = "yellow")
invisible(lapply(tangents, draw, col = "blue"))
## ------------------------------------------------
## Method `Circle$orthogonalThroughTwoPointsOnCircle`
## ------------------------------------------------
# hyperbolic triangle
circ <- Circle$new(c(5,5), 3)
arc1 <- circ$orthogonalThroughTwoPointsOnCircle(0, 2*pi/3, arc = TRUE)
arc2 <- circ$orthogonalThroughTwoPointsOnCircle(2*pi/3, 4*pi/3, arc = TRUE)
arc3 <- circ$orthogonalThroughTwoPointsOnCircle(4*pi/3, 0, arc = TRUE)
opar <- par(mar = c(0,0,0,0))
plot(0, 0, type = "n", asp = 1, xlim = c(2,8), ylim = c(2,8))
draw(circ)
draw(arc1, col = "red", lwd = 2)
draw(arc2, col = "green", lwd = 2)
draw(arc3, col = "blue", lwd = 2)
par(opar)
## ------------------------------------------------
## Method `Circle$orthogonalThroughTwoPointsWithinCircle`
## ------------------------------------------------
circ <- Circle$new(c(0,0),3)
P1 <- c(1,1); P2 <- c(1, 2)
ocirc <- circ$orthogonalThroughTwoPointsWithinCircle(P1, P2)
arc <- circ$orthogonalThroughTwoPointsWithinCircle(P1, P2, arc = TRUE)
plot(0, 0, type = "n", asp = 1, xlab = NA, ylab = NA,
xlim = c(-3, 4), ylim = c(-3, 4))
draw(circ, lwd = 2)
draw(ocirc, lty = "dashed", lwd = 2)
draw(arc, lwd = 3, col = "blue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.