Configuration object for generating the sphere geometry.
A 3D point (array of 3 numbers) indicating the center position of the sphere. Defaults to [0, 0, 0]
.
The number of latitudinal segments (bands from top to bottom). Default is 24.
The radius of the sphere. Default is 1.
The number of longitudinal segments (bands around the sphere). Default is 18.
Returns a SceneGeometry object containing the sphere geometry with the necessary positions, normals, UV coordinates, and indices for rendering.
const sphereGeometry = buildSphereGeometry({
radius: 2,
heightSegments: 24,
widthSegments: 18,
center: [0, 0, 0]
});
@returns {GeometryArrays} The geometry data for the sphere, including positions, normals, UV coordinates, and indices.
Creates a sphere-shaped SceneGeometry.
This function generates a sphere geometry by calculating the positions of vertices based on the specified parameters. The sphere is defined by its radius and the number of latitudinal and longitudinal segments. The resulting geometry includes the positions, normals, UVs, and indices necessary to render the sphere.
Usage
To create a sphere geometry, call the function with the desired configuration. For example:
This creates a sphere with a radius of 2 units, 24 latitudinal segments, 18 longitudinal segments, centered at
[0, 0, 0]
.Parameters: