luizaspan icon

nucleo oblato 1

luizaspan | PRO | 08/17/17 02:53:20 PM UTC | 0 ⭐ | 691 👁️ | Never ⏰ | []
C |

580 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include <math.h>
 
 
#define M_PI 3.14159265358979323846
 
int main()
{
    double b, g, t, p, r;
 
    b=1.3; // beta = 1.3 (desvio da esfericidade)
    g=60.0*M_PI/180.0; // nucleo oblato gamma = 60º
 
    for (t=0 ; t<=(M_PI) ; t+=(M_PI/90.0))
    {
        for (p = 0.0; p <= (2.0*M_PI); p+=(M_PI/45.0))
        {
            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));
 
            double x = r*sin(t)*cos(p);
            double y = r*sin(t)*sin(p);
            double z = r*cos(t);
 
            printf("%f %f %f\n",x,y,z);
        }
    }
 
    return 0;
}

Comments