MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ random_position_sphere()

glm::vec3 MayaFlux::Nodes::Network::ParticleNetwork::random_position_sphere ( float  radius) const
private

Random position in sphere.

Definition at line 636 of file ParticleNetwork.cpp.

637{
638 float theta = 2.0F * glm::pi<float>() * (static_cast<float>(rand()) / RAND_MAX);
639 float phi = std::acos(2.0F * (static_cast<float>(rand()) / RAND_MAX) - 1.0F);
640 float r = radius * std::cbrt(static_cast<float>(rand()) / RAND_MAX);
641
642 return {
643 r * std::sin(phi) * std::cos(theta),
644 r * std::sin(phi) * std::sin(theta),
645 r * std::cos(phi)
646 };
647}

Referenced by initialize_particle_positions().

+ Here is the caller graph for this function: