k-Wave Toolbox |
![]() ![]() |
Create a binary map of a circle within a 2D grid
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)
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.
|
size of the 2D grid [number of pixels] |
|
centre of the circle [pixel coordinates] |
|
circle radius [number of pixels] |
|
arc angle for incomplete circle [radians] (default = 2*pi) |
|
Boolean controlling whether the circle is plotted using |
|
2D binary map of a circle |
makeCartCircle
, makeDisc
![]() |
makeCartSphere | makeDisc | ![]() |
© 2009 Bradley Treeby and Ben Cox.