Skip to content

[feature request] Auto center mesh  #23

Open
@twaddellberkeley

Description

@twaddellberkeley

Center the mesh based on bounding box.
import trimesh

Load the mesh

mesh = trimesh.load('path/to/your/mesh_file.obj') # Replace with your file path

Center the mesh at the origin

mesh.apply_translation(-mesh.center_mass)

Alternatively, to center it based on the bounding box center

mesh.apply_translation(-mesh.bounds.mean(axis=0))

Save or display the centered mesh

mesh.show() # Display if you want to visualize

mesh.export('path/to/centered_mesh.obj') # Save if needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions