Closed TalalWasim closed 3 years ago
Hey, I think you want path2D.medial_axis()
, as that call doesn't require the path to be passed back:
In [1]: import trimesh
In [2]: m = trimesh.load('temp_file.svg')
In [3]: m
Out[3]: <trimesh.Path2D(vertices.shape=(48, 2), len(entities)=16)>
In [4]: m.show()
In [5]: m.medial_axis()
Out[5]: <trimesh.Path2D(vertices.shape=(197, 2), len(entities)=5)>
In [6]: m.medial_axis?
Signature: m.medial_axis(resolution=None, clip=None)
Docstring:
Find the approximate medial axis based
on a voronoi diagram of evenly spaced points on the
boundary of the polygon.
Parameters
----------
resolution : None or float
Distance between each sample on the polygon boundary
clip : None, or (2,) float
Min, max number of samples
Returns
----------
medial : Path2D object
Contains only medial axis of Path
File: ~/trimesh/trimesh/path/path.py
Hello,
I am having trouble calculating the medial axis of an SVG image by loading it into a Path2D object. I have zipped and attached the svg file as well (because directly uploading svg is not supported by github apparently) temp_file.zip
I get the following error:
Please guide me about what I am doing wrong.