MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testPlaneRotateConcat

Method testPlaneRotateConcat

tests/test_cadquery.py:352–369  ·  view source on GitHub ↗

Test the result of a well-known concatenated rotation example.

(self)

Source from the content-addressed store, hash-verified

350 assert rotated.origin.toTuple() == approx(origin)
351
352 def testPlaneRotateConcat(self):
353 """
354 Test the result of a well-known concatenated rotation example.
355 """
356 xdir = (1, 0, 0)
357 normal = (0, 0, 1)
358 k = 2.0 ** 0.5 / 2.0
359 origin = (2, -1, 1)
360 plane = Plane(origin=origin, xDir=xdir, normal=normal)
361 plane = plane.rotated((0, 0, 45))
362 assert plane.xDir.toTuple() == approx((k, k, 0))
363 assert plane.yDir.toTuple() == approx((-k, k, 0))
364 assert plane.zDir.toTuple() == approx((0, 0, 1))
365 plane = plane.rotated((0, 45, 0))
366 assert plane.xDir.toTuple() == approx((0.5, 0.5, -k))
367 assert plane.yDir.toTuple() == approx((-k, k, 0))
368 assert plane.zDir.toTuple() == approx((0.5, 0.5, k))
369 assert plane.origin.toTuple() == origin
370
371 def testPlaneRotateConcatRandom(self):
372 """

Callers

nothing calls this directly

Calls 3

rotatedMethod · 0.95
PlaneClass · 0.85
toTupleMethod · 0.45

Tested by

no test coverage detected