# regular_circle_polyline

## `regular_circle_polyline(n)`

Triangle mesh of a square

Generates a regular polyline of a circle with radius 1 centered at the origin.

Parameters:

Name Type Description Default
`n` `int`

number of vertices on the circle. Must be at least 3.

required

Returns:

Name Type Description
`V` `numpy double array`

Matrix of triangle polyline vertex coordinates

`E` `numpy int array`

Matrix of edge vertex indices into V

``````# Generate a polyline with n vertices
Source code in `src/gpytoolbox/regular_circle_polyline.py`
 ``` 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45``` ``````def regular_circle_polyline(n): """Triangle mesh of a square Generates a regular polyline of a circle with radius 1 centered at the origin. Parameters ---------- n : int number of vertices on the circle. Must be at least 3. Returns ------- V : numpy double array Matrix of triangle polyline vertex coordinates E : numpy int array Matrix of edge vertex indices into V See Also -------- regular_square_mesh. Examples -------- ```python # Generate a polyline with n vertices n = 10 V, E = gpytoolbox.regular_circle_polyline(n) ``` """ assert n>=3, "At least 3 vertices on the boundary." φ = np.linspace(0., 2.*np.pi, n) x = np.cos(φ) y = np.sin(φ) V = np.stack((x,y), axis=-1) E = np.stack(( np.arange(0,n), np.concatenate((np.arange(1,n),[0])) ), axis=-1) return V,E ``````