mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Update src/distribution_spatial.cpp
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
31ebeb1327
commit
9073aa5f72
1 changed files with 2 additions and 2 deletions
|
|
@ -174,8 +174,8 @@ Position SphericalIndependent::sample(uint64_t* seed) const
|
|||
double cos_theta = cos_theta_->sample(seed);
|
||||
double phi = phi_->sample(seed);
|
||||
// sin(theta) by sin**2 + cos**2 = 1
|
||||
double x = r * std::pow(1 - std::pow(cos_theta, 2.0), 0.5) * cos(phi) + origin_.x;
|
||||
double y = r * std::pow(1 - std::pow(cos_theta, 2.0), 0.5) * sin(phi) + origin_.y;
|
||||
double x = r * std::sqrt(1 - cos_theta * cos_theta) * cos(phi) + origin_.x;
|
||||
double y = r * std::sqrt(1 - cos_theta * cos_theta) * sin(phi) + origin_.y;
|
||||
double z = r * cos_theta + origin_.z;
|
||||
return {x, y, z};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue