{"id":3548,"library":"manifold3d","title":"Manifold3d","description":"Manifold3d is a Python library providing bindings to the Manifold C++ geometry kernel (v3.4.1). It specializes in creating and operating on topologically robust, manifold triangle meshes, making it ideal for applications in CAD, 3D printing, and simulations. The library guarantees manifold output and leverages parallelization for performance. It has an active development cycle with regular releases.","status":"active","version":"3.4.1","language":"en","source_language":"en","source_url":"https://github.com/elalish/manifold","tags":["3D geometry","CAD","mesh","boolean operations","manifold","computational geometry"],"install":[{"cmd":"pip install manifold3d","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Required for array manipulations and data structures.","package":"numpy","optional":false},{"reason":"Strongly recommended for robust 3D file I/O (e.g., OBJ, GLB, STL) and interop with vertex properties/materials, as Manifold3d's built-in MeshIO was removed from public API in v3.4.0.","package":"trimesh","optional":true}],"imports":[{"symbol":"manifold3d","correct":"import manifold3d"}],"quickstart":{"code":"import manifold3d\n\n# Create a sphere with radius 1 and 60 facets\nsphere = manifold3d.Sphere(1, 60)\n\n# Create a cube with dimensions [1, 1, 1]\nbox = manifold3d.Box([1, 1, 1])\n\n# Translate the box to intersect the sphere\nbox_translated = box.translate([0.5, 0.5, 0.5])\n\n# Perform a boolean union operation\nunion_result = sphere.union(box_translated)\n\n# Perform a boolean difference operation\ndifference_result = sphere.difference(box_translated)\n\nprint(f\"Sphere triangles: {sphere.num_triangles()}\")\nprint(f\"Union result triangles: {union_result.num_triangles()}\")\nprint(f\"Difference result triangles: {difference_result.num_triangles()}\")\n\n# To export, consider using the 'trimesh' library:\n# import trimesh\n# mesh_data = union_result.to_mesh()\n# trimesh_mesh = trimesh.Trimesh(\n#     vertices=mesh_data.vert_properties[:, :3], \n#     faces=mesh_data.tri_verts\n# )\n# trimesh_mesh.export('union_result.stl')\n","lang":"python","description":"This quickstart demonstrates creating basic 3D primitives (sphere, box) and performing common boolean operations like union and difference. It showcases the core functionality of combining and modifying manifold meshes. For saving or loading complex 3D file formats, integrating with a dedicated mesh I/O library like `trimesh` is recommended."},"warnings":[{"fix":"Migrate 3D file I/O operations to `trimesh` or similar libraries. Example: `pip install trimesh` and use `trimesh.Trimesh` for imports/exports.","message":"The `MeshIO` public API was removed in version 3.4.0. Users are advised to use external libraries like `trimesh` for Python (or `assimp` for C++) for 3D file input/output.","severity":"breaking","affected_versions":">=3.4.0"},{"fix":"Upgrade to `manifold3d==3.4.1` or a newer version.","message":"Version 3.4.0 introduced a 'lazy collider change' which could lead to numerical issues in some cases. This change was reverted in version 3.4.1. If experiencing unexpected numerical instability or mesh artifacts, ensure you are using v3.4.1 or later.","severity":"gotcha","affected_versions":"3.4.0"},{"fix":"Always use integer or exact float degree values for rotations (e.g., `manifold.rotate([90, 0, 0])`) instead of converting from radians or using approximations.","message":"Manifold3d's rotation API takes degrees, not radians. When performing rotations, it is critical to use exact degree values (e.g., 90, 45) rather than computed approximations (e.g., `math.degrees(math.pi / 2)` or `89.999999999999`) to guarantee precision and avoid mesh cracks due to floating-point errors. The library can optimize for exact degree values.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure input meshes are manifold. Consider using external mesh repair tools if starting with potentially non-manifold data.","message":"While Manifold3d guarantees manifold output, it requires manifold meshes as input. If you provide non-manifold mesh data, the library will return an error status. Users may need to preprocess their meshes using external repair tools to ensure they are manifold before inputting them to Manifold3d.","severity":"gotcha","affected_versions":"all"},{"fix":"For full-featured 3D file I/O, especially with vertex properties, use `trimesh` to handle mesh loading and saving.","message":"Manifold3d's direct OBJ file I/O is limited in functionality and primarily intended for testing purposes. For robust handling of vertex properties (e.g., normals, UVs, colors) and materials, using the `trimesh` library for OBJ or other 3D format imports/exports is strongly advised.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}