| in.circle {pcds} | R Documentation |
Check whether a point is inside a circle
Description
Checks if the point p lies
in the circle with center cent and radius rad,
denoted as C(cent,rad).
So, it returns 1 or TRUE if p is
inside the circle, and 0 otherwise.
boundary is a logical argument (default=FALSE)
to include boundary or not, so if it is TRUE,
the function checks if the point, p,
lies in the closure of the circle (i.e., interior and
boundary combined) else it checks
if p lies in the interior of the circle.
Usage
in.circle(p, cent, rad, boundary = TRUE)
Arguments
p |
A 2D point to be checked whether it is inside the circle or not. |
cent |
A 2D point in Cartesian coordinates which serves as the center of the circle. |
rad |
A positive real number which serves as the radius of the circle. |
boundary |
A logical parameter (default= |
Value
Indicator for the point p being
inside the circle or not, i.e., returns 1 or TRUE
if p is inside the circle, and 0 otherwise.
Author(s)
Elvan Ceyhan
See Also
in.triangle, in.tetrahedron, and
on.convex.hull from the interp package
for documentation for in.convex.hull
Examples
cent<-c(1,1); rad<-1; p<-c(1.4,1.2)
#try also cent<-runif(2); rad<-runif(1); p<-runif(2);
in.circle(p,cent,rad)
p<-c(.4,-.2)
in.circle(p,cent,rad)
p<-c(1,0)
in.circle(p,cent,rad)
in.circle(p,cent,rad,boundary=FALSE)