Hello, I have trimesh 4.1.3 and I am trying to apply a translation, rotation and scale to three meshes and rendering them together in a scene. Translation and rotation are fine but as soon as I set scale to anything other than 1.0 it messes up the visualization as shown below:
Translation and rotation (no scaling)
Translation and rotation and 0.5 equal scaling on every axis
code snippet
def render_scene_from_name(self, scn_name):
if self.scenes is not None and scn_name in self.scenes:
print(
f"Rengering scene: {scn_name} of type: {self.scenes[scn_name]['type']}"
)
obj_list = []
for obj_name, obj_yaml in self.scenes[scn_name]["objects"].items():
print(f"Rendering object {obj_name}")
obj_mesh = self.get_object_from_name(obj_name)
scaling = np.array(
[
obj_yaml["scale"]["x"],
obj_yaml["scale"]["y"],
obj_yaml["scale"]["z"],
]
)
translation = np.array(
[
obj_yaml["position"]["x"],
obj_yaml["position"]["y"],
obj_yaml["position"]["z"],
]
)
rotation = trimesh.transformations.euler_from_quaternion(
[
obj_yaml["orientation"]["w"],
obj_yaml["orientation"]["x"],
obj_yaml["orientation"]["y"],
obj_yaml["orientation"]["z"]
]
)
transform = trimesh.transformations.compose_matrix(
scale=scaling,
shear=None,
angles=rotation,
translate=translation,
perspective=None,
)
obj_mesh.apply_transform(transform)
obj_list.append(obj_mesh)
else:
return None
if len(obj_list) > 0:
trimesh.Scene([trimesh.creation.axis(axis_length=1), obj_list]).show()
Hello, I have trimesh 4.1.3 and I am trying to apply a translation, rotation and scale to three meshes and rendering them together in a scene. Translation and rotation are fine but as soon as I set scale to anything other than 1.0 it messes up the visualization as shown below:
Translation and rotation (no scaling)
Translation and rotation and 0.5 equal scaling on every axis
code snippet
Am I doing something wrong? Thanks