Commit a954451b authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Started implementing 2D Voronoi algorithm.

parent fe9478bb
......@@ -105,7 +105,21 @@ __attribute__((always_inline)) INLINE void voronoi_cell_init(
* @param id ID of the interacting neighbour.
__attribute__((always_inline)) INLINE void voronoi_cell_interact(
struct voronoi_cell *cell, float *dx, unsigned long long id) {}
struct voronoi_cell *cell, float *dx, unsigned long long id) {
float half_dx[2];
float r2;
/* we need a vector with half the size of the vector joining generator and
neighbour, pointing to the neighbour */
half_dx[0] = -0.5f * dx[0];
half_dx[1] = -0.5f * dx[1];
/* we need the squared length of this vector */
r2 = half_dx[0] * half_dx[0] + half_dx[1] * half_dx[1];
* @brief Finalize a 2D Voronoi cell
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment