k-Wave Toolbox Previous   Next

makeCircle

Create a binary map of a circle within a 2D grid

Syntax

circle = makeCircle(Nx, Nz, cx, cz, radius)
circle = makeCircle(Nx, Nz, cx, cz, radius, arc_angle)
circle = makeCircle(Nx, Nz, cx, cz, radius, arc_angle, plot_circle)

Description

makeCircle creates a binary map of a circle or arc (using the midpoint circle algorithm) within a two-dimensional grid (the circle position is denoted by 1's in the matrix with 0's elsewhere). A single pixel is taken as the circle centre thus the total diameter will always be an odd number of pixels. The plot that is displayed after calling makeCircle(128, 128, 64, 64, 30, (215/180)*pi, true) is given below.

Inputs

Nx, Ny

size of the 2D grid [number of pixels]

cx, cy

centre of the circle [pixel coordinates]

radius

circle radius [number of pixels]

Optional Inputs

arc_angle

arc angle for incomplete circle [radians] (default = 2*pi)

plot_circle

Boolean controlling whether the circle is plotted using imagesc (default = false)

Outputs

circle

2D binary map of a circle

Examples

See Also

makeCartCircle, makeDisc


© 2009, 2010 Bradley Treeby and Ben Cox.