MCPcopy
hub / github.com/CadQuery/cadquery / find_hull

Function find_hull

cadquery/hull.py:367–405  ·  view source on GitHub ↗
(edges: Iterable[Edge])

Source from the content-addressed store, hash-verified

365
366
367def find_hull(edges: Iterable[Edge]) -> Wire:
368
369 # initialize the hull
370 rv: Hull = []
371
372 # split into arcs and points
373 arcs, points = convert_and_validate(edges)
374
375 # select the starting element
376 start = select_lowest(arcs, points)
377 rv.append(start)
378
379 # initialize
380 entities: List[Entity] = []
381 entities.extend(arcs)
382 entities.extend(points)
383
384 current_e = start
385 current_angle = 0.0
386 finished = False
387
388 # march around
389 while not finished:
390
391 angles = []
392 segments = []
393
394 for e in entities:
395 angle, segment = get_angle(current_e, e)
396 angles.append(angle if angle >= current_angle else inf)
397 segments.append(segment)
398
399 next_ix = int(argmin(angles))
400 current_e, current_angle, finished = update_hull(
401 current_e, next_ix, entities, angles, segments, rv
402 )
403
404 # convert back to Edges and return
405 return finalize_hull(rv)

Callers 1

hullMethod · 0.85

Calls 7

convert_and_validateFunction · 0.85
select_lowestFunction · 0.85
get_angleFunction · 0.85
update_hullFunction · 0.85
finalize_hullFunction · 0.85
appendMethod · 0.80
extendMethod · 0.80

Tested by

no test coverage detected