Skip to content

Conversation

@EveCharbie
Copy link
Collaborator

@EveCharbie EveCharbie commented Apr 11, 2025

This change is Reviewable

@EveCharbie EveCharbie changed the title Added mesh scaling [RTR] Added mesh scaling Apr 13, 2025
Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, Thanks for contributing !

return self.segment.characteristics().mesh().path().absolutePath().to_string()

@cached_property
def mesh_scale(self) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell me if i'm wrong:

def mesh_scale(self) -> np.darray:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a one-line doc to say the format of the output; (3,1) (3,)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry

else:
self.__rerun_mesh = rr.Mesh3D(
vertex_positions=self.__mesh.vertices,
vertex_positions=transformed_trimesh.vertices,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the self.__mesh in the first if case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, let me know if what I did is ok

"""
A class to handle a trimesh object and its transformations
and always 'apply_transform' from its initial position
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the

'''
Attribute 
-------------
scaling_factor: np.ndarray
 A (3,1) or (3,0) or (1,3) vector for each direction x y z ?
'''

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented the init instead

if file_path.endswith(".stl") or file_path.endswith(".STL"):
mesh = load(file_path, file_type="stl")
return cls(name, mesh, transform_callable)
return cls(name, mesh, transform_callable, scaling_factor)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we apply the scaling to the mesh before line 80 it would save an attribute to the class that is meant to update the position of the mesh not to scale it. Maybe no, but if yes, it needs to be applied in the from_filemethod.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understood it, there were two options:

  1. Scale the mesh ourselves: modify the position of the mesh vertices (which I was afraid to do if I am honest)
  2. Scale the mesh during visualization at the same time as visualizing its position and orientation (I found this option easier since rerun does the hard work for us)

@Ipuch
Copy link
Collaborator

Ipuch commented May 2, 2025

I'll wait @aceglia PR because he might have done it too. On his side, and add an extra surprise (osim model viewer).

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 31d5fa4 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

@Ipuch
Copy link
Collaborator

Ipuch commented Jun 11, 2025

solved in #63

@Ipuch Ipuch closed this Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants