Example #1
0
def test_rotate():
    _test_rotate(
        Coord.from_nothing(),
        Coord.from_zx(Point(0, 0, 0), Point(0, 0, 1), Point(0, -1, 0)),
        Point(1, 1, 0), Point(1, -1, 0))

    _test_rotate(
        Coord.from_zx(Point(0, 0, 0), Point(0, 0, 1), Point(0, 1, 0)),
        Coord.from_zx(Point(0, 0, 0), Point(0, 0, 1), Point(0, -1, 0)),
        Point(1, 1, 0), Point(-1, -1, 0))
Example #2
0
def test_rotate():
    q = Quaternion.from_euler(Point(0, 0, np.pi / 2))

    c = Coord.from_nothing(10)

    rc = c.rotate(q)
    assert rc.origin == P0()
    np.testing.assert_almost_equal(rc.x_axis.data, PY(1, 10).data)
    np.testing.assert_almost_equal(rc.y_axis.data, PX(-1, 10).data)
    np.testing.assert_almost_equal(rc.z_axis.data, PZ(1, 10).data)
Example #3
0
def test_translate():
    ca = Coord.from_nothing()
    cb = Coord.from_nothing().translate(Point(1, 0, 0))
    transform = Transformation.from_coords(ca, cb)
    assert transform.translate(Point(0, 0, 0)) == Point(1, 0, 0)
Example #4
0
def test_rotation_matrix():
    np.testing.assert_array_equal(
        Coord.from_nothing(10).rotation_matrix(),
        np.tile(np.identity(3).reshape(1, 3, 3), (10, 1, 1)))