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

Method testPerpendicularDirFilter

tests/test_selectors.py:114–125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

112 self.assertEqual(0, c.edges("%HYPERBOLA").size())
113
114 def testPerpendicularDirFilter(self):
115 c = CQ(makeUnitCube())
116
117 perp_edges = c.edges("#Z")
118 self.assertEqual(8, perp_edges.size()) # 8 edges are perp. to z
119 # dot product of perpendicular vectors is zero
120 for e in perp_edges.vals():
121 self.assertAlmostEqual(e.tangentAt(0).dot(Vector(0, 0, 1)), 0.0)
122 perp_faces = c.faces("#Z")
123 self.assertEqual(4, perp_faces.size()) # 4 faces are perp to z too!
124 for f in perp_faces.vals():
125 self.assertAlmostEqual(f.normalAt(None).dot(Vector(0, 0, 1)), 0.0)
126
127 def testFaceDirFilter(self):
128 c = CQ(makeUnitCube())

Callers

nothing calls this directly

Calls 9

makeUnitCubeFunction · 0.90
VectorClass · 0.85
dotMethod · 0.80
edgesMethod · 0.45
sizeMethod · 0.45
valsMethod · 0.45
tangentAtMethod · 0.45
facesMethod · 0.45
normalAtMethod · 0.45

Tested by

no test coverage detected