wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.
http://numpy-stl.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
605 stars 103 forks source link

Added centroids as a mesh property. #194

Closed Xorgon closed 2 years ago

Xorgon commented 2 years ago

This PR adds mesh element centroids as a property of the mesh. This is useful for tasks such as visualising mesh normals where plotting the normals at the element centroids is desirable. It is also useful for some numerical methods where properties are evaluated at the centroid of a mesh element.

It is implemented here as the mean of the three element vertices. It is implemented following the same conventions as are used for areas.

wolph commented 2 years ago

Great fix, thank you! :)

Took me a while to look at it, but it's all looking great. I'm releasing a new version as we speak.

Xorgon commented 2 years ago

Awesome, thank you! :D