New shape to load 3D objects#159
Merged
Merged
Conversation
ilateur
requested changes
Jun 5, 2026
lamoreel
approved these changes
Jun 5, 2026
6d603bb to
2b71a59
Compare
ilateur
approved these changes
Jun 5, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds a new
Shape, which can load a 3D object from STL, PLY, OBJ or GLTF/GLB files.This
ObjShapetakes quite a few arguments:min_point,max_point,center,scaleandsize. The last two of these parameters are mutually exclusive.keep_aspect(defaultFalse): expand to the bounding box defined by the previous parameters without distortion.repair(defaultFalse): try to make the shape watertight if it is not. A simply-connected object is assumed.rotate_z_up(defaultTrue): most 3D objects use the y-axis as the vertical direction, while in mumax this is the z-axis.Example: magnetization of a teapot
Other changes
trimeshandnetworkxto it. These optional dependencies should therefore now be installable alongside mumax⁺ withpip install mumaxplus[3D]shape_funcdirectly if it is already vectorized, otherwise it falls back to_np.vectorizelike beforeexamples/shape.ipynb, where the quintessential teapot is loadedTorusandrepeatdocumentation