Advertisement
Guest User

Untitled

a guest
May 28th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. float singular_weight(Vec3 a, Vec3 b, float radius, int w)
  2. {
  3.     float r = (a-b).length();
  4.     if (r < radius)
  5.         return pow(r / radius, -w);
  6.     else
  7.         return 0.f;
  8. }
  9.  
  10. float gaussian_weight(Vec3 a, Vec3 b, float radius)
  11. {
  12.     float r = (a-b).length();
  13.     if (r < radius)
  14.         return exp(- r * r / (radius * radius));
  15.     else
  16.         return 0.f;
  17. }
  18.  
  19. float wendland_weight(Vec3 a, Vec3 b, float radius)
  20. {
  21.     float r = (a-b).length();
  22.     if (r < radius)
  23.         return pow(1 - r / radius, 4) * (1 + 4 * r / radius);
  24.     else
  25.         return 0.f;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement