k-Wave Toolbox |

# makeDisc

Create a binary map of a filled disc within a 2D grid

## Syntax

    disc = makeDisc(Nx, Nz, cx, cz, radius)
    disc = makeDisc(Nx, Nz, cx, cz, radius, plot_disc)

## Description

`makeDisc` creates a binary map of a filled disc within a two-dimensional grid (the disc position is denoted by 1's in the matrix with 0's elsewhere). A single pixel is taken as the disc centre thus the total diameter of the disc will always be an odd number of pixels. As the returned disc has a constant pixel radius, if used within a k-space grid where dx ~= dz, the disc will appear oval shaped. If part of the disc overlaps the grid edge, the rest of the disc will wrap to the grid edge on the opposite side. The plot that is displayed after calling `makeDisc(128, 128, 64, 64, 30, true)` is given below.

## Inputs

`Nx, Ny` | size of the 2D grid [number of pixels]
`cx, cy` | centre of the disc [pixel coordinates]
`radius` | disc radius [number of pixels]

## Optional Inputs

`plot_circle` | Boolean controlling whether the disc is plotted using `imagesc` (default = false)

## Outputs

`disc` | 2D binary map of a filled disc

## Examples

- Homogeneous Propagation Medium Example
- Using A Binary Sensor Mask Example
- Heterogeneous Propagation Medium Example
- Saving Movie Files Example
- Controlling The Absorbing Boundary Layer Example
- 2D FFT Reconstruction For A Planar Sensor Example
- 2D Time Reversal Reconstruction For A Planar Sensor Example

## See Also

`makeCircle`, `makeBall`

© 2009 Bradley Treeby and Ben Cox.