Exemplo n.º 1
0
def testOffsetTrajectories():
    for i in range(10):
        T = RandomTrajectory()
        t = T.positionKeyFrames.timestamps
        dt = t[1] - t[0]
        p = T.position(t)
        r = T.rotation(t)
        offset = randomPosition()
        rotationOffset = randomRotation()
        oT = OffsetTrajectory(T, offset, rotationOffset)
        offsetPositions = p + r.rotateVector(offset)
        offsetRotations = r * rotationOffset
        yield checkTrajectory, oT, TimeSeries(t,offsetPositions), TimeSeries(t, offsetRotations)
def testOffsetTrajectories():
    for i in range(10):
        T = RandomTrajectory()
        t = T.positionKeyFrames.timestamps
        dt = t[1] - t[0]
        p = T.position(t)
        r = T.rotation(t)
        offset = randomPosition()
        rotationOffset = randomRotation()
        oT = OffsetTrajectory(T, offset, rotationOffset)
        offsetPositions = p + r.rotateVector(offset)
        offsetRotations = r * rotationOffset
        yield checkTrajectory, oT, TimeSeries(t, offsetPositions), TimeSeries(
            t, offsetRotations)
Exemplo n.º 3
0
def testStaticTrajectory():
    p = randomPosition()
    r = randomRotation()
    s = StaticTrajectory(p, r)
    assert_equal(s.position(0), p)
    assert_equal(s.velocity(0), vector(0,0,0))
    assert_equal(s.acceleration(0), vector(0,0,0))
    assert_equal(s.rotation(0).components, r.components)
    assert_equal(s.rotationalVelocity(0), vector(0,0,0))
    assert_equal(s.rotationalAcceleration(0), vector(0,0,0))
    assert s.startTime == 0
    assert s.endTime == np.inf

    qa = s.rotation((1,2))
    assert type(qa) == QuaternionArray
    assert len(qa) == 2
Exemplo n.º 4
0
def checkMatrixToEuler(order, degrees):
    q1 = randomRotation()
    m = q1.toMatrix()
    e = matrixToEuler(m, order, degrees)
    q2 = QuaternionFromEuler(e, order, degrees)
    assertQuaternionAlmostEqual(q1,q2)