A sphere

Structural features

  1. \(R\) is the radius of the sphere

  2. \(\rho\) is the density of scatters in scatters (points) per unit volume.

Schematic

_images/Spheroid.png

The illustration of the uniform sphere

Structure Generation

We can generate a uniform sphere by sampling a uniform distribution in the box around it, then only including certain scatters.

  1. Define the bounding box

We frequently use a cube surrounding the sphere. The cube is mathematically defined by the bounding box in range \(B = [-R, R]^3\)

  1. Find the number of points

We first calculate the number of points that would correspond to the density in the cube volume: \((2R)^3 \rho = 8R^3\rho\). Since \(N\) must be an integer, we take the floor of this value to obtain \(N = \lfloor 8R^3\rho \rfloor\).

  1. Generate the uniform points in the sphere

First, we generate a uniform distribution \(U_{box}\) of scatters within \(B\) with \(N\) points

Then we only include scatters that are inside the cube to \(U_{sphere}\). Each vector \(\mathbf{v} = (x, y, z)\) in the distribution must satisfy \(\Vert \mathbf{v} \Vert \le R\).

Example

_images/Sphere_obj_example.png

Three examples of uniform spheres, with different densities and radii.

The example above showcases different parameters used to generate these spheres. The left image contains densely clustered scatters due to its high density, while the right image contains spread out scatters due to its lower density.

This structure is generated using the Ellipsoid class, with \(a = c\)

Code

Generate a sphere