Skip to content

Commit 3be3fc1

Browse files
committed
halfedge strip
1 parent 0aa8c23 commit 3be3fc1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* Added `redraw` flag to the `compas_rhino` methods `delete_object`, `delete_objects` and `purge_objects`.
1616
* Added the `__eq__` method for `compas.geometry.Circle` and `compas.geometry.Line`.
1717
* Added support for Pylance through static API definitions.
18+
* Added `halfedge_strip` method to `compas.datastructures.HalfEdge`.
1819

1920
### Changed
2021

src/compas/datastructures/mesh/core/halfedge.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,34 @@ def edge_strip(self, edge):
22422242
edges.append((u, v))
22432243
return edges
22442244

2245+
def halfedge_strip(self, edge):
2246+
"""Find all edges on the same strip as a given halfedge.
2247+
2248+
Parameters
2249+
----------
2250+
edge : tuple of int
2251+
The identifier of the starting edge.
2252+
2253+
Returns
2254+
-------
2255+
list of tuple of int
2256+
The edges on the same strip as the given halfedge.
2257+
"""
2258+
u, v = edge
2259+
edges = [(u, v)]
2260+
while True:
2261+
face = self.halfedge[u][v]
2262+
if face is None:
2263+
break
2264+
vertices = self.face_vertices(face)
2265+
if len(vertices) != 4:
2266+
break
2267+
i = vertices.index(u)
2268+
u = vertices[i - 1]
2269+
v = vertices[i - 2]
2270+
edges.append((u, v))
2271+
return edges
2272+
22452273
# --------------------------------------------------------------------------
22462274
# face topology
22472275
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)