Skip to content

Commit

Permalink
Fix TypeError in _process_path for curved elements simplification
Browse files Browse the repository at this point in the history
Refactored the line simplification in _process_path to avoid the numpy TypeError caused by changing data-type for an object array. Replaced np.array(LineString(line).simplify(tolerance=quantization)) with separate LineString simplification and conversion of its 
coordinates to a numpy array. This ensures the correct handling.
  • Loading branch information
nataquinones authored May 20, 2024
1 parent 3d82012 commit 204a1d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vpype/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ def _process_path(path):
line = seg.npoint(np.linspace(0, 1, step))

if simplify:
line = np.array(LineString(line).simplify(tolerance=quantization))
line = LineString(line).simplify(tolerance=quantization)
line = np.array(line.coords, dtype=float)

line = line.view(dtype=complex).reshape(len(line))

Expand Down

0 comments on commit 204a1d6

Please sign in to comment.