Skip to content

Commit fc2ba04

Browse files
authored
Merge pull request #860 from compas-dev/fix-trimesh-curvature-input
Fix processing of input of Rhino implementations of trimesh curvature functions
2 parents c68bd78 + db51dc9 commit fc2ba04

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
* Changed directory where ghuser components are installed.
2626
* Added ghuser components directory to those removed by the `clean` task.
2727
* Clean up the ghuser directory before building ghuser components.
28-
* Fixed bug in `compas.geometry.distance.closest_point_on_segment_xy`
28+
* Fixed bug in `compas.geometry.distance.closest_point_on_segment_xy`.
29+
* Fixed bug in Rhino implementations of `trimesh` curvature functions.
2930

3031
### Removed
3132

src/compas_rhino/geometry/trimesh/curvature.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ def trimesh_gaussian_curvature(M):
7676
# (0) see if input is already Rhino.Geometry.Mesh
7777
mesh = Rhino.Geometry.Mesh()
7878
if not isinstance(M, Rhino.Geometry.Mesh):
79-
for vertices, faces in M:
80-
for x, y, z in vertices:
81-
mesh.Vertices.Add(x, y, z)
82-
for face in faces:
83-
mesh.Faces.AddFace(*face)
79+
for x, y, z in M[0]:
80+
mesh.Vertices.Add(x, y, z)
81+
for face in M[1]:
82+
mesh.Faces.AddFace(*face)
8483
else:
8584
mesh = M
8685

@@ -170,11 +169,10 @@ def trimesh_mean_curvature(M):
170169
# (0) see if input is already Rhino.Geometry.Mesh
171170
mesh = Rhino.Geometry.Mesh()
172171
if not isinstance(M, Rhino.Geometry.Mesh):
173-
for vertices, faces in M:
174-
for x, y, z in vertices:
175-
mesh.Vertices.Add(x, y, z)
176-
for face in faces:
177-
mesh.Faces.AddFace(*face)
172+
for x, y, z in M[0]:
173+
mesh.Vertices.Add(x, y, z)
174+
for face in M[1]:
175+
mesh.Faces.AddFace(*face)
178176
else:
179177
mesh = M
180178

@@ -275,11 +273,10 @@ def trimesh_principal_curvature(M):
275273
# (0) see if input is already Rhino.Geometry.Mesh
276274
mesh = Rhino.Geometry.Mesh()
277275
if not isinstance(M, Rhino.Geometry.Mesh):
278-
for vertices, faces in M:
279-
for x, y, z in vertices:
280-
mesh.Vertices.Add(x, y, z)
281-
for face in faces:
282-
mesh.Faces.AddFace(*face)
276+
for x, y, z in M[0]:
277+
mesh.Vertices.Add(x, y, z)
278+
for face in M[1]:
279+
mesh.Faces.AddFace(*face)
283280
else:
284281
mesh = M
285282

0 commit comments

Comments
 (0)