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

Method _isCoPlanar

cadquery/cq.py:504–520  ·  view source on GitHub ↗

Test if two faces are on the same plane.

(f0, f1)

Source from the content-addressed store, hash-verified

502 """
503
504 def _isCoPlanar(f0, f1):
505 """Test if two faces are on the same plane."""
506 p0 = f0.Center()
507 p1 = f1.Center()
508 n0 = f0.normalAt()
509 n1 = f1.normalAt()
510
511 # test normals (direction of planes)
512 if not (
513 (abs(n0.x - n1.x) < self.ctx.tolerance)
514 or (abs(n0.y - n1.y) < self.ctx.tolerance)
515 or (abs(n0.z - n1.z) < self.ctx.tolerance)
516 ):
517 return False
518
519 # test if p1 is on the plane of f0 (offset of planes)
520 return abs(n0.dot(p0.sub(p1))) < self.ctx.tolerance
521
522 def _computeXdir(normal):
523 """

Callers

nothing calls this directly

Calls 4

dotMethod · 0.80
subMethod · 0.80
CenterMethod · 0.45
normalAtMethod · 0.45

Tested by

no test coverage detected