Document None conditions on compute_aabb (#11051)

The error conditions were not documented, this requires the user to
inspect the source code to know when to expect a `None`.

Error conditions should always be documented, so we document them.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This commit is contained in:
Nicola Papale 2023-12-22 00:29:43 +01:00 committed by GitHub
parent 049de6fcbe
commit fcb49a5d80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -566,6 +566,9 @@ impl Mesh {
}
/// Compute the Axis-Aligned Bounding Box of the mesh vertices in model space
///
/// Returns `None` if `self` doesn't have [`Mesh::ATTRIBUTE_POSITION`] of
/// type [`VertexAttributeValues::Float32x3`], or if `self` doesn't have any vertices.
pub fn compute_aabb(&self) -> Option<Aabb> {
let Some(VertexAttributeValues::Float32x3(values)) =
self.attribute(Mesh::ATTRIBUTE_POSITION)