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

Function finalize_hull

cadquery/hull.py:335–364  ·  view source on GitHub ↗
(hull: Hull)

Source from the content-addressed store, hash-verified

333
334
335def finalize_hull(hull: Hull) -> Wire:
336
337 rv = []
338
339 for el_p, el, el_n in zip(hull, hull[1:], hull[2:]):
340
341 if isinstance(el, Segment):
342 rv.append(Edge.makeLine(Vector(el.a.x, el.a.y), Vector(el.b.x, el.b.y)))
343 elif (
344 isinstance(el, Arc)
345 and isinstance(el_p, Segment)
346 and isinstance(el_n, Segment)
347 ):
348 a1 = degrees(atan2p(el_p.b.x - el.c.x, el_p.b.y - el.c.y))
349 a2 = degrees(atan2p(el_n.a.x - el.c.x, el_n.a.y - el.c.y))
350
351 rv.append(
352 Edge.makeCircle(el.r, Vector(el.c.x, el.c.y), angle1=a1, angle2=a2)
353 )
354
355 el1 = hull[1]
356 if isinstance(el, Segment) and isinstance(el_n, Arc) and isinstance(el1, Segment):
357 a1 = degrees(atan2p(el.b.x - el_n.c.x, el.b.y - el_n.c.y))
358 a2 = degrees(atan2p(el1.a.x - el_n.c.x, el1.a.y - el_n.c.y))
359
360 rv.append(
361 Edge.makeCircle(el_n.r, Vector(el_n.c.x, el_n.c.y), angle1=a1, angle2=a2)
362 )
363
364 return Wire.assembleEdges(rv)
365
366
367def find_hull(edges: Iterable[Edge]) -> Wire:

Callers 1

find_hullFunction · 0.85

Calls 6

VectorClass · 0.85
atan2pFunction · 0.85
appendMethod · 0.80
makeLineMethod · 0.80
assembleEdgesMethod · 0.80
makeCircleMethod · 0.45

Tested by

no test coverage detected