def test_look_at(self, pnt, vec, x_axis, y_axis, z_axis, origin): t = Transform.look_at(pnt, vec, y_axis) assert_elem_eq(t(origin), pnt) assert_elem_eq(t.inverse()(pnt), origin) if not pnt == vec and not pnt == y_axis and not vec == y_axis: assert not t.has_scale()
1., 0., ), geo.Point(1., 0., 0.) ]) test_data['quat'].extend([quat.Quaternion(0., 0., 0., 0.)]) geometry_data = { 'trans_vec': [geo.Vector(1., 2., 3.)], 'scale_coef': [geo.Vector(1., 2., 3.)], 'origin': [geo.Point(0., 0., 0.)], 'x_axis': [geo.Vector(1., 0., 0.)], 'y_axis': [geo.Vector(0., 1., 0.)], 'z_axis': [geo.Vector(0., 0., 1.)], 't1': [ Transform.look_at(geo.Point(0., 0., 0.), geo.Point(0., 0., 1.), geo.Vector(0., 1., 0.)) ], 't2': [ Transform.look_at(geo.Point(0., 1., 1.), geo.Point(0., 0., 1.), geo.Vector(0., 0., 1.)) ], } def assert_almost_eq(a, b, thres=EPS): assert a == b or a == pytest.approx(b, abs=thres) def assert_elem_eq(a, b, thres=EPS): for i in range(len(a)): assert_almost_eq(a[i], b[i])