Advertisement
luizaspan

nucleo prolato 1

Aug 17th, 2017
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. #define M_PI 3.14159265358979323846
  6.  
  7. int main()
  8. {
  9.     double b, g, t, p, r;
  10.  
  11.     b=1.0; // beta = 1.0 (desvio da esfericidade)
  12.     g=0.0; // nucleo prolato gamma = 0º
  13.  
  14.     for (t=0 ; t<=(M_PI) ; t+=(M_PI/90.0))
  15.     {
  16.         for (p = 0.0; p <= (2.0*M_PI); p+=(M_PI/45.0))
  17.         {
  18.             r = 1.0 + b*sqrt(5.0/(16.0*M_PI))*(cos(g)*(3.0*pow(cos(t),2.0)-1.0)+(sqrt(3.0)/2.0)*sin(g)*pow(sin(t),2.0)*cos(2.0*p));
  19.  
  20.             double x = r*sin(t)*cos(p);
  21.             double y = r*sin(t)*sin(p);
  22.             double z = r*cos(t);
  23.  
  24.             printf("%f %f %f\n",x,y,z);
  25.         }
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement