File: test_so2.py

package info (click to toggle)
manif 0.0.5-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,576 kB
  • sloc: cpp: 11,789; ansic: 8,774; python: 2,158; sh: 24; makefile: 23; xml: 21
file content (40 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import numpy as np
import pytest

from manifpy import SO2, SO2Tangent


def test_constructor():
    state = SO2(0.17)
    assert 0.17 == state.angle()

    state = SO2(1, 0)
    assert 0 == state.angle()

    delta = SO2Tangent(0.17)
    assert 0.17 == delta.angle()

def test_accessors():
    state = SO2.Identity()

    assert 1 == state.real()
    assert 0 == state.imag()
    assert 0 == state.angle()

    delta = SO2Tangent.Zero()

    assert 0 == delta.angle()

def test_transform():
    state = SO2.Identity()
    transform = state.transform()

    assert (3, 3) == transform.shape
    assert (np.identity(3) == transform).all()

def test_rotation():
    state = SO2.Identity()
    rotation = state.rotation()

    assert (2, 2) == rotation.shape
    assert (np.identity(2) == rotation).all()