runif.circ: Generation of Uniform Points in a Circle

runif.circR Documentation

Generation of Uniform Points in a Circle

Description

An object of class "SpatPatterns".

Generates n 2D points uniformly in the circle with center=cent and radius=rad using the rejection sampling approach (i.e., the function generates points in the smallest square containing the circle, keeping only the points inside the circle until n points are generated). The defaults for cent=c(0,0) and rad=1.

Usage

runif.circ(n, cent = c(0, 0), rad = 1)

Arguments

n

A positive integer representing the number of points to be generated uniformly in the circle

cent

A 2D point representing the center of the circle, with default=c(0,0)

rad

A positive real number representing the radius of the circle.

Value

A list with the elements

pat.type

"1c" for the 1-class pattern of the uniform data in the circle

type

The type of the point pattern

parameters

center of the circle, cent, and the radius of the circle, rad

lab

The class labels of the generated points, NULL for this function, since points belong to the same class

init.cases

The initial points, NULL for this function

gen.points

The output set of generated points uniform in the circle.

ref.points

The input set of reference points, it is NULL for this function.

desc.pat

Description of the point pattern

mtitle

The "main" title for the plot of the point pattern

num.points

The number of generated points.

xlimit,ylimit

The possible ranges of the x- and y-coordinates of the generated points

Author(s)

Elvan Ceyhan

See Also

runif

Examples

n<-20  #or try sample(1:20,1);  #try also 10, 100, or 1000;
r<-.1; #try also r<-.3 or .5
cent<-c(1,2)

#data generation
Xdat<-runif.circ(n,cent,r) #generated data
Xdat

summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.