picogl.core.geometry.sphere
Sphere geometry helpers (pure math, no OpenGL).
Attributes
Classes
Parameters controlling sphere mesh generation. |
|
Build origin-centered sphere geometry from a |
Functions
|
Yield longitude angles for each slice (including closure vertex). |
|
Latitude in radians for stack index |
|
Vertices on one latitude circle of a sphere centered at the origin. |
|
Build a sphere triangle mesh centered at the origin. |
|
|
|
|
|
|
|
Build a sphere triangle mesh centered at the origin. |
Module Contents
- picogl.core.geometry.sphere.iter_longitudes(slices: int) collections.abc.Iterator[float][source]
Yield longitude angles for each slice (including closure vertex).
- picogl.core.geometry.sphere.latitude_for_stack(stack: int, stacks: int) float[source]
Latitude in radians for stack index
stackin[0, stacks].
- picogl.core.geometry.sphere.generate_ring(radius: float, latitude: float, slices: int) list[picogl.core.vec3.Vec3][source]
Vertices on one latitude circle of a sphere centered at the origin.
- picogl.core.geometry.sphere.sphere_mesh_np(radius: float = 1.0, slices: int = 16, stacks: int = 16) picogl.renderer.mesh_arrays.MeshArrays[source]
Build a sphere triangle mesh centered at the origin.
This is a geometry producer only: it does not instance, color, or batch spheres.
- Parameters:
radius – Sphere radius.
slices – Longitudinal subdivisions.
stacks – Latitudinal subdivisions.
- Returns:
Origin-centered positions, normals, and triangle indices.
- Return type:
- picogl.core.geometry.sphere.generate_indices(v1: numpy.ndarray[Any, Any] | Any, v2: int | Any, v3: int | Any, v4: int | Any) ndarray[Any, dtype[Any]][source]
- picogl.core.geometry.sphere.generate_normals(cos_lat, cos_lng, sin_lat, sin_lng) numpy.ndarray[Any, numpy.dtype[Any]][source]
- picogl.core.geometry.sphere.generate_positions(cos_lat, cos_lng, radius: float, sin_lat, sin_lng) ndarray[Any, dtype[Any]][source]
- picogl.core.geometry.sphere.sphere_mesh_python(radius: float = 1.0, slices: int = 16, stacks: int = 16) picogl.renderer.mesh_arrays.MeshArrays[source]
Build a sphere triangle mesh centered at the origin.
This is a geometry producer only: it does not instance, color, or batch spheres.
- Parameters:
radius – Sphere radius
slices – Longitudinal subdivisions
stacks – Latitudinal subdivisions
- Returns:
MeshArrayswith origin-centered positions, normals, and triangle indices (no colors)
- class picogl.core.geometry.sphere.SphereGeometrySpec[source]
Parameters controlling sphere mesh generation.
This is configuration only: it does not build geometry. Pass an instance to
SphereMesh.
- class picogl.core.geometry.sphere.SphereMesh(spec: SphereGeometrySpec)[source]
Build origin-centered sphere geometry from a
SphereGeometrySpec.Derived vertex and index counts live here so the spec stays parameters only.
build()returns colorlessMeshArrays.- build() picogl.renderer.mesh_arrays.MeshArrays[source]
Build a sphere template centered at the origin.
- Returns:
Positions, normals, and indices with no colors