pygfx.geometries.sphere_geometry

pygfx.geometries.sphere_geometry(radius=1, width_segments=32, height_segments=16, phi_start=0, phi_length=6.283185307179586, theta_start=0, theta_length=3.141592653589793)

Generate a sphere.

Creates a sphere that has its center in the local origin. The sphere is constructed by creating a grid of longituidnal and latitudinal lines and placing vetices at the intersections. The area between 4 vertices is then approximated by a rectangular-shaped face.

Optionally, the geometry can be limited to a segment of the full sphere described by a longituidnal and latitudinal arc.

Parameters:
  • radius (float) – The radius of the sphere. Vertices are placed at this distance around the local origin.

  • width_segments (int) – The number of (evenly-spaced) longitudinal lines to draw within the selected sphere segment.

  • height_segments (int) – The number of (evenly-spaced) latitudinal lines to draw within the selected sphere segment.

  • phi_start (float) – The angle (in rad) at which to start the longitudinal lines. Zero means the first line is drawn in the xz-plane.

  • phi_length (float) – The central angle (in rad) of the sphere segments latitudinal segment.

  • theta_start (float) – The angle (in rad) at which to start the latitudinal lines. Zero means the first line is drawn at the “tip” of the sphere, i.e., at (0, 0, radius).

  • theta_length (float) – The central angle (in rad) of the sphere segment’s longitudinal segment.

Returns:

sphere – A geometry object that represents the requested sphere or sphere segment. Mathematically, it is an open orientable manifold.

Return type:

Geometry

Examples

Blending weighted_plus

Blending weighted_plus

Physical Based Bloom Effect Demo

Physical Based Bloom Effect Demo

Clearcoat effect

Clearcoat effect

Cloth Simulation with Compute Shaders

Cloth Simulation with Compute Shaders

Dynamic Environment Map

Dynamic Environment Map

Earth

Earth

Iridescence

Iridescence

Look At

Look At

Look At (Instanced Mesh)

Look At (Instanced Mesh)

Toon Rendering 2

Toon Rendering 2

PBR Rendering 2

PBR Rendering 2

Sphere Geometry

Sphere Geometry

Transparency 2

Transparency 2

Wireframe Material

Wireframe Material

Additive Blending

Additive Blending

Validate dither

Validate dither

Validate weighted

Validate weighted

Validate the grid

Validate the grid

Validate Skybox

Validate Skybox