mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
2.97k stars 576 forks source link

Using medial.entities for further use #828

Closed vivekbharadhwajsa closed 4 years ago

vivekbharadhwajsa commented 4 years ago

Hello mikedh,

I am new to trimesh. I would like some help with he package. I am trying to use trimesh to develop a path planning strategy for additive manufacturing. I have sliced and got the medial axis for every slice. And i would like to know what all functions or methods can be applied to the trimesh.path.entities.Line object so that further operations on each individual entity can be performed based on the required need for path planning? for example, if i want to take particular lines of the medial.entities and clip off the ends or remove certain lines from it or generate offsets of these lines, I would like to know how can that be done.

Thank you

mikedh commented 4 years ago

Hey, there's a lot of ways to do it but I would probably lean heavily on shapely.geometry.LineString for things like this. You might take a look at some similar logic I implemented here for tool paths:

https://github.com/mikedh/pocketing/blob/219271606fb685a8f7e2b76ba793893e60f7d221/pocketing/trochoidal.py#L63-L99

vivekbharadhwajsa commented 4 years ago

Hello mike, I referred to what you suggested. I'm a little confused with the node representation. The nodes property of the line, does it give the [x, y] at every single point on the Line or is it some other representation? When i add these nodes to an edge and plot using networkx, i get a graph like this ask What exactly is in the nodes property of a Line?

mikedh commented 4 years ago

Hey, I think you want entity.points. entity.nodes is not useful for most people, it is the "minimal number of points for graph purposes", i.e. a line has 2 points and 2 nodes, but a B-spline may have 10 points but 3 nodes.