Closed jkunimune closed 3 months ago
The recent updates to the cell_normals
method in vedo/mesh.py
enhance error handling to improve user guidance and robustness. The method now checks if the computed normal vectors are empty and if the mesh contains cells. If both conditions are true, a ValueError
is raised, prompting users to first compute normals using Mesh.compute_normals()
. This improvement aims to prevent errors during later processing by ensuring correct usage of the method.
Files | Change Summary |
---|---|
vedo/mesh.py | Enhanced error handling in cell_normals method. Added checks for empty normal vectors and mesh cells. Raised ValueError for clearer user guidance on method usage. |
(Sequence diagrams are not applicable as the changes are straightforward and do not introduce complex interactions.)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Thanks!
Right now if you call cell_normals before calling compute_normals(), it will simply return an empty array. This is incorrect, and is especially confusing because if a user is new to vedo they will have no way of knowing that there's another function they need to call first, unless they happen to notice it in the API.
This PR has it raise an error instead, thus preventing it from returning the wrong answer while also letting the user know how to fix the problem.