Beispiel #1
0
    def test_to_quaternion(self):
        rot_d = Rotation('d')
        numpy.testing.assert_array_equal(rot_d.quaternion(),
                                         [0, 0, 0, 1])

        rot_f = Rotation('f')
        numpy.testing.assert_array_equal(rot_f.quaternion(),
                                         [0, 0, 0, 1])
Beispiel #2
0
    def test_to_quaternion(self):
        rot_d = Rotation(ctypes.c_double)
        numpy.testing.assert_array_equal(rot_d.quaternion(),
                                         [[0], [0], [0], [1]])

        rot_f = Rotation(ctypes.c_float)
        numpy.testing.assert_array_equal(rot_f.quaternion(),
                                         [[0], [0], [0], [1]])
Beispiel #3
0
    def test_to_quaternion(self):
        rot_d = Rotation(ctypes.c_double)
        numpy.testing.assert_array_equal(rot_d.quaternion(),
                                         [[0],
                                          [0],
                                          [0],
                                          [1]])

        rot_f = Rotation(ctypes.c_float)
        numpy.testing.assert_array_equal(rot_f.quaternion(),
                                         [[0],
                                          [0],
                                          [0],
                                          [1]])
Beispiel #4
0
    def _new(self, s, r, t):
        """
        :type s: float
        :type r: Rotation | None
        :type t: collections.Iterable[float] | None
        """
        # noinspection PyProtectedMember
        if r is None:
            r = Rotation(self._ctype)
        elif r._ctype != self._ctype:
            # Create new Rotation sharing our type
            r = Rotation.from_quaternion(r.quaternion(), self._ctype)

        if t is None:
            t = EigenArray.from_iterable((0, 0, 0), self._ctype)
        else:
            t = EigenArray.from_iterable(t, self._ctype, (3, 1))

        return self._call_cfunc('vital_similarity_%s_new' % self._tchar, [
            self._ctype,
            Rotation.c_ptr_type(self._ctype),
            EigenArray.c_ptr_type(3, 1, self._ctype)
        ], [s, r, t], self.C_TYPE_PTR)
Beispiel #5
0
    def test_to_quaternion(self):
        rot_d = Rotation('d')
        numpy.testing.assert_array_equal(rot_d.quaternion(), [0, 0, 0, 1])

        rot_f = Rotation('f')
        numpy.testing.assert_array_equal(rot_f.quaternion(), [0, 0, 0, 1])