calculateCircle: Generate points from a circle

Description Usage Arguments Value Author(s) Examples

View source: R/CVD.R

Description

calculateCircle generates points from a circle with many options, equally spaced, randomly spaced, with noise added to the radius or limited to a segment of angle alpha.

Usage

1
2
calculateCircle(x, y, r, steps=50,sector=c(0,360),randomDist=FALSE, 
randomFun=runif,...)

Arguments

x

center point x

y

center point y

r

radius

steps

number of points

sector

limited circular sector

randomDist

logical, TRUE = randomly spaced

randomFun

random function

...

optiomal parameters to pass to randomFun

Value

points

array n x 2 of point coordinates.

Author(s)

Jose Gama

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# 100 points from a circle at c(0,0) with radius=200
a<-calculateCircle(0,0,200,100)
plot(a[,1],a[,2],xlim=c(-200,200),ylim=c(-200,200))
par(new=TRUE)
# 12 points from a circle at c(0,0) with radius=190, points between 0 and 90
# degrees
a<-calculateCircle(0,0,190,12,c(0,90))
plot(a[,1],a[,2],xlim=c(-200,200),ylim=c(-200,200),col='red')
par(new=TRUE)
# 12 points from a circle at c(0,0) with radius=180, points between 0 and 180
# degrees, uniform random distribution
a<-calculateCircle(0,0,180,12,c(0,180),TRUE)
plot(a[,1],a[,2],xlim=c(-200,200),ylim=c(-200,200),col='green')
par(new=TRUE)
# 12 points from a circle at c(0,0) with radius=170, points between 0 and 180
# degrees, normal random distribution
a<-calculateCircle(0,0,170,12,c(0,180),TRUE,rnorm)
plot(a[,1],a[,2],xlim=c(-200,200),ylim=c(-200,200),col='blue')

## End(Not run)

Example output



CVD documentation built on May 2, 2019, 1:58 p.m.

Related to calculateCircle in CVD...