Révision 179
| NBody/NBody.py (revision 179) | ||
|---|---|---|
| 381 | 381 |
ThetaA=acos(FromCoM.x/Length)+5.e-1f*PI; |
| 382 | 382 |
PhiA=atan(FromCoM.y/FromCoM.z); |
| 383 | 383 |
// Second tangential vector to sphere of length radius |
| 384 |
ThetaB=acos(FromCoM.x/Length);
|
|
| 385 |
PhiB=atan(FromCoM.y/FromCoM.z)+5.e-1f*PI;
|
|
| 384 |
ThetaB=acos((float)(FromCoM.x/Length));
|
|
| 385 |
PhiB=atan((float)(FromCoM.y/FromCoM.z))+5.e-1f*PI;
|
|
| 386 | 386 |
// (x,y) random coordonates to plane tangential to sphere |
| 387 | 387 |
Polar=MWCfp*2.e0f*PI; |
| 388 |
tA=cos(Polar); |
|
| 389 |
tB=sin(Polar); |
|
| 390 |
//tA=MWCfp*2.e0f-1.e0f; |
|
| 391 |
//tB=MWCfp*2.e0f-1.e0f; |
|
| 388 |
tA=cos((float)Polar); |
|
| 389 |
tB=sin((float)Polar); |
|
| 392 | 390 |
|
| 393 | 391 |
// Exception for 2 particules to ovoid shifting |
| 394 | 392 |
if (get_global_size(0)==2) {
|
| 395 | 393 |
CrossVector=(MYFLOAT4)(1.e0f,1.e0f,1.e0f,0.e0f); |
| 396 | 394 |
} else {
|
| 397 |
CrossVector.s0=tA*cos(ThetaA)+tB*cos(ThetaB);
|
|
| 398 |
CrossVector.s1=tA*sin(ThetaA)*sin(PhiA)+tB*sin(ThetaB)*sin(PhiB);
|
|
| 399 |
CrossVector.s2=tA*sin(ThetaA)*cos(PhiA)+tB*sin(ThetaB)*cos(PhiB);
|
|
| 395 |
CrossVector.s0=tA*cos((float)ThetaA)+tB*cos((float)ThetaB);
|
|
| 396 |
CrossVector.s1=tA*sin((float)ThetaA)*sin((float)PhiA)+tB*sin((float)ThetaB)*sin((float)PhiB);
|
|
| 397 |
CrossVector.s2=tA*sin((float)ThetaA)*cos((float)PhiA)+tB*sin((float)ThetaB)*cos((float)PhiB);
|
|
| 400 | 398 |
CrossVector.s3=0.e0f; |
| 401 | 399 |
} |
| 402 | 400 |
|
Formats disponibles : Unified diff