trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

Question: Does trimesh do any kind of transformation on coordinates when loading an stl

Open Benjamin-Fouquet opened this issue 4 years ago • 2 comments

Hello,

When loading a stl file in world coordinate from 3D slicer, I do not find "back" the same points when accessing mesh.vertices. It seems there is some kind of coordinate transformation that I fail to understand, could you help me on that ?

Additional question, is there a way to ensure I stay in world coordinate system using trimesh?

Benjamin-Fouquet avatar Aug 05 '21 08:08 Benjamin-Fouquet

Yeah by default it merges vertices and removes NaN/inf values, you can turn that it off by loading with mesh = trimesh.load(file_name, process=False).

With regard to 'world coordinates' STL's don't have transforms so it should just be an array of points unless you create a trimesh.Scene to hold the mesh.

mikedh avatar Aug 05 '21 21:08 mikedh

Currently having the same issue. Blender and meshlab agree on the vertex ordering, but trimesh has a different one. It seems blender and meshlab go vertex by vertex in the file, only loading a new one, if it hasn't already been loaded. trimesh seems to load all vertices as-is (i.e. almost all of them are duplicates) and merges them later on in a second step (losing the ordering). Did I get that correctly @mikedh ?

Btw: Fantastic library, I'm a huge fan!

Edit: I made a small gist to help me load the stl: https://gist.github.com/whateverforever/d7c12573f2fafed0ea7855408bb77e06

whateverforever avatar Mar 13 '22 18:03 whateverforever