Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
nbody_internal.h
Go to the documentation of this file.
1#ifndef NBODY_INTERNAL_H
2#define NBODY_INTERNAL_H
3
4#include "nbody_types.h"
5
6static const double HALF = 0.5;
7
8/* Per-pair Plummer softening: ε² = max(NBODY_SOFTENING_SQ, (F·(r_i+r_j))²). */
9static inline double pair_softening_sq(double radius_i, double radius_j)
10{
11 double sum_r = radius_i + radius_j;
12 double eps = (double)NBODY_SOFTENING_FACTOR * sum_r;
13 double eps_sq = eps * eps;
14 return eps_sq > (double)NBODY_SOFTENING_SQ ? eps_sq
15 : (double)NBODY_SOFTENING_SQ;
16}
17
18#endif /* NBODY_INTERNAL_H */
static const double HALF
Definition nbody_internal.h:6
static double pair_softening_sq(double radius_i, double radius_j)
Definition nbody_internal.h:9
static const float NBODY_SOFTENING_FACTOR
Definition nbody_types.h:17
static const float NBODY_SOFTENING_SQ
Definition nbody_types.h:14