Skip to content

Commit

Permalink
merian-nodes: common: Add relative_distance_greather_than helper
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Sep 13, 2024
1 parent 94a874e commit acd8c6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/merian-shaders/common.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@

#define MERIAN_SQUARE(x) ((x) * (x))

bool merian_relative_distance_greather_than(const vec3 center, const vec3 p1, const vec3 p2, const float threshold) {
const float d1 = distance(center, p1);
const float d2 = distance(center, p2);
return abs(d1 - d2) / max(d1, d2) > threshold;
}

#endif // _MERIAN_SHADERS_COMMON_H_

0 comments on commit acd8c6b

Please sign in to comment.