From a954451b27d806e67eca9d8fd04d973981bf6197 Mon Sep 17 00:00:00 2001 From: Bert Vandenbroucke <bert.vandenbroucke@ugent.be> Date: Mon, 13 Mar 2017 12:59:42 +0000 Subject: [PATCH] Started implementing 2D Voronoi algorithm. --- src/hydro/Shadowswift/voronoi2d_algorithm.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hydro/Shadowswift/voronoi2d_algorithm.h b/src/hydro/Shadowswift/voronoi2d_algorithm.h index a69d317fa9..d02f690cdc 100644 --- a/src/hydro/Shadowswift/voronoi2d_algorithm.h +++ b/src/hydro/Shadowswift/voronoi2d_algorithm.h @@ -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]; + + (void)r2; +} /** * @brief Finalize a 2D Voronoi cell -- GitLab