/* Generated by Cython 0.21.1 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_21_1"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__cgtypes
#define __PYX_HAVE_API__cgtypes
#include "math.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "cgtypes.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_7cgtypes_vec3iter;
struct __pyx_obj_7cgtypes_vec3;
struct __pyx_obj_7cgtypes_vec4iter;
struct __pyx_obj_7cgtypes_vec4;
struct __pyx_obj_7cgtypes_mat3iter;
struct __pyx_obj_7cgtypes_mat3;
struct __pyx_obj_7cgtypes_mat4iter;
struct __pyx_obj_7cgtypes_mat4;
struct __pyx_obj_7cgtypes_quat;

/* "cgtypes.pyx":70
 * 
 * # vec3iter
 * cdef class vec3iter:             # <<<<<<<<<<<<<<
 *     """vec3 iterator."""
 *     cdef int idx
 */
struct __pyx_obj_7cgtypes_vec3iter {
  PyObject_HEAD
  int idx;
  PyObject *v;
};


/* "cgtypes.pyx":30
 * 
 * # Forward declarations
 * cdef class vec3             # <<<<<<<<<<<<<<
 * cdef class vec4
 * cdef class mat3
 */
struct __pyx_obj_7cgtypes_vec3 {
  PyObject_HEAD
  double x;
  double y;
  double z;
};


/* "cgtypes.pyx":803
 * 
 * # vec4iter
 * cdef class vec4iter:             # <<<<<<<<<<<<<<
 *     """vec4 iterator."""
 *     cdef int idx
 */
struct __pyx_obj_7cgtypes_vec4iter {
  PyObject_HEAD
  int idx;
  PyObject *v;
};


/* "cgtypes.pyx":31
 * # Forward declarations
 * cdef class vec3
 * cdef class vec4             # <<<<<<<<<<<<<<
 * cdef class mat3
 * cdef class mat4
 */
struct __pyx_obj_7cgtypes_vec4 {
  PyObject_HEAD
  double x;
  double y;
  double z;
  double w;
};


/* "cgtypes.pyx":1422
 * 
 * # mat3iter
 * cdef class mat3iter:             # <<<<<<<<<<<<<<
 *     """mat iterator."""
 *     cdef int idx
 */
struct __pyx_obj_7cgtypes_mat3iter {
  PyObject_HEAD
  int idx;
  PyObject *m;
};


/* "cgtypes.pyx":32
 * cdef class vec3
 * cdef class vec4
 * cdef class mat3             # <<<<<<<<<<<<<<
 * cdef class mat4
 * 
 */
struct __pyx_obj_7cgtypes_mat3 {
  PyObject_HEAD
  double m11;
  double m12;
  double m13;
  double m21;
  double m22;
  double m23;
  double m31;
  double m32;
  double m33;
};


/* "cgtypes.pyx":2507
 * 
 * # mat4iter
 * cdef class mat4iter:             # <<<<<<<<<<<<<<
 *     """mat iterator."""
 *     cdef int idx
 */
struct __pyx_obj_7cgtypes_mat4iter {
  PyObject_HEAD
  int idx;
  PyObject *m;
};


/* "cgtypes.pyx":33
 * cdef class vec4
 * cdef class mat3
 * cdef class mat4             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
struct __pyx_obj_7cgtypes_mat4 {
  PyObject_HEAD
  double m11;
  double m12;
  double m13;
  double m14;
  double m21;
  double m22;
  double m23;
  double m24;
  double m31;
  double m32;
  double m33;
  double m34;
  double m41;
  double m42;
  double m43;
  double m44;
};


/* "cgtypes.pyx":4372
 * 
 * # quat
 * cdef class quat:             # <<<<<<<<<<<<<<
 *     """Quaternion class.
 * 
 */
struct __pyx_obj_7cgtypes_quat {
  PyObject_HEAD
  double w;
  double x;
  double y;
  double z;
};

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback);

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name);

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj) \
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
 likely(PyInt_CheckExact(obj)) ? \
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj) \
((likely(PyFloat_CheckExact(obj))) ? \
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) : \
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact);

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static int __Pyx_check_binary_version(void);

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'cgtypes' */
static PyTypeObject *__pyx_ptype_7cgtypes_vec3 = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_vec4 = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_mat3 = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_mat4 = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_vec3iter = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_vec4iter = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_mat3iter = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_mat4iter = 0;
static PyTypeObject *__pyx_ptype_7cgtypes_quat = 0;
static double __pyx_v_7cgtypes_eps;
static double __pyx_f_7cgtypes__fmod(double, double); /*proto*/
static double __pyx_f_7cgtypes__subdet(double *, short, short); /*proto*/
#define __Pyx_MODULE_NAME "cgtypes"
int __pyx_module_is_main_cgtypes = 0;

/* Implementation of 'cgtypes' */
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ZeroDivisionError;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_pf_7cgtypes_setEpsilon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_7cgtypes_2getEpsilon(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static int __pyx_pf_7cgtypes_8vec3iter___cinit__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_7cgtypes_8vec3iter_2__iter__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_8vec3iter_4__next__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_4vec3___cinit__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_2__reduce__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_4__repr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_6__str__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_8__iter__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_12__add__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_14__sub__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec3_18__div__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4vec3_20__mod__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_22__neg__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_24__pos__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_26__iadd__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_28__isub__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_30__imul__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec3_32__idiv__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4vec3_34__imod__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_36__abs__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_38__getattr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_7cgtypes_4vec3_40__setattr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /* proto */
static Py_ssize_t __pyx_pf_7cgtypes_4vec3_42__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_44__getitem__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_7cgtypes_4vec3_46__setitem__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_48cross(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_50length(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_52normalize(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_54angle(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_56reflect(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_58refract(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_N, PyObject *__pyx_v_eta); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_60ortho(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_62fadd(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec3_64fnormalize(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a); /* proto */
static int __pyx_pf_7cgtypes_8vec4iter___cinit__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_7cgtypes_8vec4iter_2__iter__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_8vec4iter_4__next__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_4vec4___cinit__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_2__reduce__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_4__repr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_6__str__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_8__iter__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_12__add__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_14__sub__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec4_18__div__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4vec4_20__mod__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_22__neg__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_24__pos__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_26__iadd__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_28__isub__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_30__imul__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec4_32__idiv__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4vec4_34__imod__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_36__abs__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_38__getattr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_7cgtypes_4vec4_40__setattr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /* proto */
static Py_ssize_t __pyx_pf_7cgtypes_4vec4_42__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_44__getitem__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_7cgtypes_4vec4_46__setitem__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_48length(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4vec4_50normalize(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_8mat3iter___cinit__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_7cgtypes_8mat3iter_2__iter__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_8mat3iter_4__next__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_4mat3___cinit__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_2__reduce__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_4__repr__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_6__str__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_8__iter__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_12__add__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_14__sub__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat3_18__div__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4mat3_20__mod__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_22__neg__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_24__pos__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_26__iadd__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_28__isub__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_30__imul__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat3_32__idiv__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4mat3_34__imod__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static Py_ssize_t __pyx_pf_7cgtypes_4mat3_36__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_38__getitem__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_7cgtypes_4mat3_40__setitem__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_42getRow(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_44setRow(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_46getColumn(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_48setColumn(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_50toList(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_rowmajor); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_52identity(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_54transpose(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_56determinant(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_58inverse(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_60scaling(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_62rotation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_64scale(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_66rotate(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_68ortho(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat3_70decompose(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_8mat4iter___cinit__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_7cgtypes_8mat4iter_2__iter__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_8mat4iter_4__next__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self); /* proto */
static int __pyx_pf_7cgtypes_4mat4___cinit__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_2__reduce__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_4__repr__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_6__str__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_8__iter__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_12__add__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_14__sub__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat4_18__div__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4mat4_20__mod__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_22__neg__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_24__pos__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_26__iadd__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_28__isub__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_30__imul__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat4_32__idiv__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4mat4_34__imod__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static Py_ssize_t __pyx_pf_7cgtypes_4mat4_36__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_38__getitem__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_7cgtypes_4mat4_40__setitem__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_42getRow(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_44setRow(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_46getColumn(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_48setColumn(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_50toList(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_rowmajor); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_52identity(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_54transpose(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_56determinant(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_58_submat(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_M3, PyObject *__pyx_v_i, PyObject *__pyx_v_j); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_60inverse(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_62translation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_64scaling(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_66rotation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_68translate(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_70scale(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_72rotate(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_74orthographic(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_bottom, PyObject *__pyx_v_top, PyObject *__pyx_v_near, PyObject *__pyx_v_far); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_76frustum(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_bottom, PyObject *__pyx_v_top, PyObject *__pyx_v_near, PyObject *__pyx_v_far); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_78perspective(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_fovy, PyObject *__pyx_v_aspect, PyObject *__pyx_v_near, PyObject *__pyx_v_far); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_80lookAt(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_pos, PyObject *__pyx_v_target, PyObject *__pyx_v_up); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_82ortho(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_84decompose(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_86getMat3(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4mat4_88setMat3(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_m); /* proto */
static int __pyx_pf_7cgtypes_4quat___cinit__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_2__reduce__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_4__repr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_6__str__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_8__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_10__add__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_12__sub__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_14__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4quat_16__div__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4quat_18__pow__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_20__neg__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_22__pos__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_24__iadd__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_26__isub__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_28__imul__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4quat_30__idiv__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_7cgtypes_4quat_32__getattr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static int __pyx_pf_7cgtypes_4quat_34__setattr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_36__abs__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_38conjugate(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_40normalize(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_42inverse(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_44toAngleAxis(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_46fromAngleAxis(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_48toMat3(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_50toMat4(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_52fromMat(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_54dot(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_56log(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4quat_58exp(struct __pyx_obj_7cgtypes_quat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7cgtypes_4slerp(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, struct __pyx_obj_7cgtypes_quat *__pyx_v_q0, struct __pyx_obj_7cgtypes_quat *__pyx_v_q1); /* proto */
static PyObject *__pyx_pf_7cgtypes_6squad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b, struct __pyx_obj_7cgtypes_quat *__pyx_v_c, struct __pyx_obj_7cgtypes_quat *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7cgtypes_8_vec3construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_7cgtypes_10_vec4construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z, PyObject *__pyx_v_w); /* proto */
static PyObject *__pyx_pf_7cgtypes_12_mat3construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_b1, PyObject *__pyx_v_b2, PyObject *__pyx_v_b3); /* proto */
static PyObject *__pyx_pf_7cgtypes_14_mat4construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_b1, PyObject *__pyx_v_b2, PyObject *__pyx_v_b3, PyObject *__pyx_v_b4); /* proto */
static PyObject *__pyx_pf_7cgtypes_16_quatconstruct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_tp_new_7cgtypes_vec3(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_vec4(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_mat3(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_mat4(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_vec3iter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_vec4iter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_mat3iter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_mat4iter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7cgtypes_quat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_[] = ",";
static char __pyx_k_N[] = "N";
static char __pyx_k_a[] = "a";
static char __pyx_k_b[] = "b";
static char __pyx_k_c[] = "c";
static char __pyx_k_d[] = "d";
static char __pyx_k_e[] = "e";
static char __pyx_k_i[] = "i";
static char __pyx_k_j[] = "j";
static char __pyx_k_m[] = "m";
static char __pyx_k_o[] = "o";
static char __pyx_k_t[] = "t";
static char __pyx_k_v[] = "v";
static char __pyx_k_w[] = "w";
static char __pyx_k_x[] = "x";
static char __pyx_k_y[] = "y";
static char __pyx_k_z[] = "z";
static char __pyx_k_M3[] = "M3";
static char __pyx_k__2[] = " ";
static char __pyx_k__4[] = "  ";
static char __pyx_k__7[] = "";
static char __pyx_k__8[] = "'";
static char __pyx_k_b1[] = "b1";
static char __pyx_k_b2[] = "b2";
static char __pyx_k_b3[] = "b3";
static char __pyx_k_b4[] = "b4";
static char __pyx_k_q0[] = "q0";
static char __pyx_k_q1[] = "q1";
static char __pyx_k_so[] = "so";
static char __pyx_k_up[] = "up";
static char __pyx_k_dot[] = "dot";
static char __pyx_k_eta[] = "eta";
static char __pyx_k_exp[] = "exp";
static char __pyx_k_far[] = "far";
static char __pyx_k_idx[] = "idx";
static char __pyx_k_log[] = "log";
static char __pyx_k_pos[] = "pos";
static char __pyx_k_res[] = "res";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_top[] = "top";
static char __pyx_k_axis[] = "axis";
static char __pyx_k_fovy[] = "fovy";
static char __pyx_k_left[] = "left";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_near[] = "near";
static char __pyx_k_rmul[] = "__rmul__";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_angle[] = "angle";
static char __pyx_k_cross[] = "cross";
static char __pyx_k_ortho[] = "ortho";
static char __pyx_k_range[] = "range";
static char __pyx_k_right[] = "right";
static char __pyx_k_slerp[] = "slerp";
static char __pyx_k_split[] = "split";
static char __pyx_k_squad[] = "squad";
static char __pyx_k_strip[] = "strip";
static char __pyx_k_value[] = "value";
static char __pyx_k_aspect[] = "aspect";
static char __pyx_k_bottom[] = "bottom";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_length[] = "length";
static char __pyx_k_target[] = "target";
static char __pyx_k_cgtypes[] = "cgtypes";
static char __pyx_k_copyreg[] = "copyreg";
static char __pyx_k_frustum[] = "frustum";
static char __pyx_k_replace[] = "replace";
static char __pyx_k_copy_reg[] = "copy_reg";
static char __pyx_k_rotation[] = "rotation";
static char __pyx_k_rowmajor[] = "rowmajor";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_normalize[] = "normalize";
static char __pyx_k_IndexError[] = "IndexError";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_getEpsilon[] = "getEpsilon";
static char __pyx_k_setEpsilon[] = "setEpsilon";
static char __pyx_k_vec3_s_s_s[] = "vec3(%s, %s, %s)";
static char __pyx_k_constructor[] = "constructor";
static char __pyx_k_determinant[] = "determinant";
static char __pyx_k_mat3_modulo[] = "mat3 modulo";
static char __pyx_k_mat4_modulo[] = "mat4 modulo";
static char __pyx_k_vec3_modulo[] = "vec3 modulo";
static char __pyx_k_vec4_modulo[] = "vec4 modulo";
static char __pyx_k_quat_s_s_s_s[] = "quat(%s, %s, %s, %s)";
static char __pyx_k_vec4_s_s_s_s[] = "vec4(%s, %s, %s, %s)";
static char __pyx_k_version_info[] = "version_info";
static char __pyx_k_StopIteration[] = "StopIteration";
static char __pyx_k_fromAngleAxis[] = "fromAngleAxis";
static char __pyx_k_mat3_division[] = "mat3 division";
static char __pyx_k_mat3construct[] = "_mat3construct";
static char __pyx_k_mat4_division[] = "mat4 division";
static char __pyx_k_mat4construct[] = "_mat4construct";
static char __pyx_k_quat_division[] = "quat division";
static char __pyx_k_quatconstruct[] = "_quatconstruct";
static char __pyx_k_vec3_division[] = "vec3 division";
static char __pyx_k_vec3construct[] = "_vec3construct";
static char __pyx_k_vec4_division[] = "vec4 division";
static char __pyx_k_vec4construct[] = "_vec4construct";
static char __pyx_k_1_4f_1_4f_1_4f[] = "(%1.4f, %1.4f, %1.4f)";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_ZeroDivisionError[] = "ZeroDivisionError";
static char __pyx_k_math_domain_error[] = "math domain error";
static char __pyx_k_index_out_of_range[] = "index out of range";
static char __pyx_k_1_4f_1_4f_1_4f_1_4f[] = "(%1.4f, %1.4f, %1.4f, %1.4f)";
static char __pyx_k_3_sequence_expected[] = "3-sequence expected";
static char __pyx_k_4_sequence_expected[] = "4-sequence expected";
static char __pyx_k_vec3_angle_line_666[] = "vec3.angle (line 666)";
static char __pyx_k_vec3_cross_line_613[] = "vec3.cross (line 613)";
static char __pyx_k_vec3_ortho_line_744[] = "vec3.ortho (line 744)";
static char __pyx_k_vec3_length_line_633[] = "vec3.length (line 633)";
static char __pyx_k_index_must_be_integer[] = "index must be integer";
static char __pyx_k_mat4_toList_line_3669[] = "mat4.toList (line 3669)";
static char __pyx_k_matrix_not_invertible[] = "matrix not invertible";
static char __pyx_k_quat_has_no_attribute[] = "quat has no attribute '";
static char __pyx_k_unsupported_operation[] = "unsupported operation";
static char __pyx_k_vec3___abs___line_531[] = "vec3.__abs__ (line 531)";
static char __pyx_k_vec3___add___line_258[] = "vec3.__add__ (line 258)";
static char __pyx_k_vec3___div___line_340[] = "vec3.__div__ (line 340)";
static char __pyx_k_vec3___mod___line_365[] = "vec3.__mod__ (line 365)";
static char __pyx_k_vec3___mul___line_288[] = "vec3.__mul__ (line 288)";
static char __pyx_k_vec3___neg___line_400[] = "vec3.__neg__ (line 400)";
static char __pyx_k_vec3___pos___line_414[] = "vec3.__pos__ (line 414)";
static char __pyx_k_vec3___sub___line_273[] = "vec3.__sub__ (line 273)";
static char __pyx_k_vec3_has_no_attribute[] = "vec3 has no attribute '";
static char __pyx_k_vec3_reflect_line_693[] = "vec3.reflect (line 693)";
static char __pyx_k_vec3_refract_line_712[] = "vec3.refract (line 712)";
static char __pyx_k_vec4_has_no_attribute[] = "vec4 has no attribute '";
static char __pyx_k_vec4_length_line_1385[] = "vec4.length (line 1385)";
static char __pyx_k_mat3_s_s_s_s_s_s_s_s_s[] = "mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)";
static char __pyx_k_mat4___add___line_2821[] = "mat4.__add__ (line 2821)";
static char __pyx_k_mat4___div___line_3038[] = "mat4.__div__ (line 3038)";
static char __pyx_k_mat4___mod___line_3079[] = "mat4.__mod__ (line 3079)";
static char __pyx_k_mat4___mul___line_2881[] = "mat4.__mul__ (line 2881)";
static char __pyx_k_mat4___neg___line_3152[] = "mat4.__neg__ (line 3152)";
static char __pyx_k_mat4___pos___line_3182[] = "mat4.__pos__ (line 3182)";
static char __pyx_k_mat4___sub___line_2851[] = "mat4.__sub__ (line 2851)";
static char __pyx_k_mat4_inverse_line_3825[] = "mat4.inverse (line 3825)";
static char __pyx_k_quat___abs___line_4764[] = "quat.__abs__ (line 4764)";
static char __pyx_k_quat___add___line_4526[] = "quat.__add__ (line 4526)";
static char __pyx_k_quat___div___line_4607[] = "quat.__div__ (line 4607)";
static char __pyx_k_quat___mul___line_4556[] = "quat.__mul__ (line 4556)";
static char __pyx_k_quat___neg___line_4641[] = "quat.__neg__ (line 4641)";
static char __pyx_k_quat___pos___line_4656[] = "quat.__pos__ (line 4656)";
static char __pyx_k_quat___sub___line_4541[] = "quat.__sub__ (line 4541)";
static char __pyx_k_quat_inverse_line_4815[] = "quat.inverse (line 4815)";
static char __pyx_k_quat_is_not_invertible[] = "quat is not invertible";
static char __pyx_k_vec3___iadd___line_428[] = "vec3.__iadd__ (line 428)";
static char __pyx_k_vec3___idiv___line_475[] = "vec3.__idiv__ (line 475)";
static char __pyx_k_vec3___imod___line_496[] = "vec3.__imod__ (line 496)";
static char __pyx_k_vec3___imul___line_456[] = "vec3.__imul__ (line 456)";
static char __pyx_k_vec3___isub___line_442[] = "vec3.__isub__ (line 442)";
static char __pyx_k_vec4___abs___line_1295[] = "vec4.__abs__ (line 1295)";
static char __pyx_k_vec4___add___line_1008[] = "vec4.__add__ (line 1008)";
static char __pyx_k_vec4___div___line_1091[] = "vec4.__div__ (line 1091)";
static char __pyx_k_vec4___mod___line_1118[] = "vec4.__mod__ (line 1118)";
static char __pyx_k_vec4___mul___line_1040[] = "vec4.__mul__ (line 1040)";
static char __pyx_k_vec4___neg___line_1156[] = "vec4.__neg__ (line 1156)";
static char __pyx_k_vec4___pos___line_1171[] = "vec4.__pos__ (line 1171)";
static char __pyx_k_vec4___sub___line_1024[] = "vec4.__sub__ (line 1024)";
static char __pyx_k_mat4_identity_line_3694[] = "mat4.identity (line 3694)";
static char __pyx_k_vec3_normalize_line_646[] = "vec3.normalize (line 646)";
static char __pyx_k_vec4___iadd___line_1185[] = "vec4.__iadd__ (line 1185)";
static char __pyx_k_vec4___idiv___line_1235[] = "vec4.__idiv__ (line 1235)";
static char __pyx_k_vec4___imod___line_1257[] = "vec4.__imod__ (line 1257)";
static char __pyx_k_vec4___imul___line_1215[] = "vec4.__imul__ (line 1215)";
static char __pyx_k_vec4___isub___line_1200[] = "vec4.__isub__ (line 1200)";
static char __pyx_k_mat4_transpose_line_3723[] = "mat4.transpose (line 3723)";
static char __pyx_k_matrix_is_not_invertible[] = "matrix is not invertible";
static char __pyx_k_quat_conjugate_line_4775[] = "quat.conjugate (line 4775)";
static char __pyx_k_quat_normalize_line_4790[] = "quat.normalize (line 4790)";
static char __pyx_k_vec4_normalize_line_1398[] = "vec4.normalize (line 1398)";
static char __pyx_k_vec3___getitem___line_568[] = "vec3.__getitem__ (line 568)";
static char __pyx_k_vec3___setitem___line_592[] = "vec3.__setitem__ (line 592)";
static char __pyx_k_mat4_determinant_line_3753[] = "mat4.determinant (line 3753)";
static char __pyx_k_quat_toAngleAxis_line_4836[] = "quat.toAngleAxis (line 4836)";
static char __pyx_k_vec4___getitem___line_1336[] = "vec4.__getitem__ (line 1336)";
static char __pyx_k_vec4___setitem___line_1363[] = "vec4.__setitem__ (line 1363)";
static char __pyx_k_unsupported_operand_type_for[] = "unsupported operand type for *";
static char __pyx_k_index_tuple_must_be_a_2_tuple[] = "index tuple must be a 2-tuple";
static char __pyx_k_M_mat4_1_2_3_4_5_6_7_8_9_10_11[] = "\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print +M\n        [   1.0000,    2.0000,    3.0000,    4.0000]\n        [   5.0000,    6.0000,    7.0000,    8.0000]\n        [   9.0000,   10.0000,   11.0000,   12.0000]\n        [  13.0000,   14.0000,   15.0000,   16.0000]\n        ";
static char __pyx_k_a_vec4_3_0_2_5_1_8_0_2_print_a[] = "\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print +a\n        (3.0000, 2.5000, -1.8000, 0.2000)\n        ";
static char __pyx_k_mat3_arg_is_a_malformed_string[] = "mat3() arg is a malformed string";
static char __pyx_k_mat3_takes_at_most_9_arguments[] = "mat3() takes at most 9 arguments";
static char __pyx_k_mat4_arg_is_a_malformed_string[] = "mat4() arg is a malformed string";
static char __pyx_k_quat_arg_is_a_malformed_string[] = "quat() arg is a malformed string";
static char __pyx_k_quat_has_no_writable_attribute[] = "quat has no writable attribute '";
static char __pyx_k_unsupported_operand_type_for_2[] = "unsupported operand type for /";
static char __pyx_k_unsupported_operand_type_for_3[] = "unsupported operand type for %";
static char __pyx_k_unsupported_operand_type_for_4[] = "unsupported operand type for *=";
static char __pyx_k_unsupported_operand_type_for_5[] = "unsupported operand type for /=";
static char __pyx_k_unsupported_operand_type_for_6[] = "unsupported operand type for %=";
static char __pyx_k_vec3_arg_is_a_malformed_string[] = "vec3() arg is a malformed string";
static char __pyx_k_vec3_has_no_writable_attribute[] = "vec3 has no writable attribute '";
static char __pyx_k_vec3_takes_at_most_3_arguments[] = "vec3() takes at most 3 arguments";
static char __pyx_k_vec4_arg_is_a_malformed_string[] = "vec4() arg is a malformed string";
static char __pyx_k_vec4_has_no_writable_attribute[] = "vec4 has no writable attribute '";
static char __pyx_k_vec4_takes_at_most_4_arguments[] = "vec4() takes at most 4 arguments";
static char __pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9[] = "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]";
static char __pyx_k_Addition_q_quat_0_9689_0_2160_0[] = "Addition.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q+q\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        ";
static char __pyx_k_Division_M_mat4_1_2_3_4_5_6_7_8[] = "Division.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M/2.0\n        [   0.5000,    1.0000,    1.5000,    2.0000]\n        [   2.5000,    3.0000,    3.5000,    4.0000]\n        [   4.5000,    5.0000,    5.5000,    6.0000]\n        [   6.5000,    7.0000,    7.5000,    8.0000]\n        ";
static char __pyx_k_Division_by_scalar_a_vec3_1_0_0[] = "Division by scalar\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a/2.0\n        (0.5000, 0.2500, -0.9000)\n        ";
static char __pyx_k_Division_by_scalar_a_vec4_1_0_0[] = "Division by scalar.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a/2.0\n        (0.5000, 0.2500, -0.9000, 0.1000)\n        ";
static char __pyx_k_Division_q_quat_0_9689_0_2160_0[] = "Division.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q/2.0\n        (0.4844, 0.1080, 0.0540, 0.0270)\n        ";
static char __pyx_k_Inline_multiplication_only_with[] = "Inline multiplication (only with scalar)\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> a*=2.0\n        >>> print a\n        (2.0000, 1.0000, -3.6000)\n        ";
static char __pyx_k_Inline_vector_addition_a_vec3_1[] = "Inline vector addition.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> a+=b\n        >>> print a\n        (0.7000, 1.2500, -1.3000)\n        ";
static char __pyx_k_Inline_vector_addition_a_vec4_1[] = "Inline vector addition.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> a+=b\n        >>> print a\n        (0.7000, 1.2500, -1.3000, 0.5000)\n        ";
static char __pyx_k_Matrix_subtraction_M_mat4_1_2_3[] = "Matrix subtraction.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M-M\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        ";
static char __pyx_k_Modulo_M_mat4_1_2_3_4_5_6_7_8_9[] = "Modulo.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M%5.0\n        [   1.0000,    2.0000,    3.0000,    4.0000]\n        [   0.0000,    1.0000,    2.0000,    3.0000]\n        [   4.0000,    0.0000,    1.0000,    2.0000]\n        [   3.0000,    4.0000,    0.0000,    1.0000]\n        ";
static char __pyx_k_Multiplication_M_mat4_1_2_3_4_5[] = "Multiplication.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M*2.0\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        >>> print 2.0*M\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        >>> print M*M\n        [  90.0000,  100.0000,  110.0000,  120.0000]\n        [ 202.0000,  228.0000,  254.0000,  280.0000]\n        [ 314.0000,  356.0000,  398.0000,  440.0000]\n        [ 426.0000,  484.0000,  542.0000,  600.0000]\n        >>> print M*_vec3(1,2,3)\n        (0.1765, 0.4510, 0.7255)\n        >>> print _vec3(1,2,3)*M\n        (0.7083, 0.8056, 0.9028)\n        ";
static char __pyx_k_Multiplication_with_a_scalar_or[] = "Multiplication with a scalar or dot product.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a*2.0\n        (2.0000, 1.0000, -3.6000)\n        >>> print 2.0*a\n        (2.0000, 1.0000, -3.6000)\n        >>> print a*b\n        -0.825\n        ";
static char __pyx_k_Negation_M_mat4_1_2_3_4_5_6_7_8[] = "Negation.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print -M\n        [  -1.0000,   -2.0000,   -3.0000,   -4.0000]\n        [  -5.0000,   -6.0000,   -7.0000,   -8.0000]\n        [  -9.0000,  -10.0000,  -11.0000,  -12.0000]\n        [ -13.0000,  -14.0000,  -15.0000,  -16.0000]\n        ";
static char __pyx_k_Negation_a_vec4_3_0_2_5_1_8_0_2[] = "Negation.\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print -a\n        (-3.0000, -2.5000, 1.8000, -0.2000)\n        ";
static char __pyx_k_Negation_q_quat_0_9689_0_2160_0[] = "Negation.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print -q\n        (-0.9689, -0.2160, -0.1080, -0.0540)\n        ";
static char __pyx_k_Return_angle_in_radians_between[] = "Return angle (in radians) between self and other.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a.angle(b)\n        1.99306755584\n        ";
static char __pyx_k_Return_determinant_M_mat4_2_0_0[] = "Return determinant.\n\n        >>> M=mat4(2.0,0,0,0, 0,2.0,0,0, 0,0,2.0,0, 0,0,0,2.0)\n        >>> print M.determinant()\n        16.0\n        ";
static char __pyx_k_Return_inverse_q_quat_0_9_0_5_0[] = "Return inverse.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> print q.inverse()\n        (0.7563, -0.4202, -0.1681, -0.2521)\n        ";
static char __pyx_k_Return_normalized_vector_a_vec3[] = "Return normalized vector.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a.normalize()\n        (0.4719, 0.2360, -0.8495)\n        ";
static char __pyx_k_Return_normalized_vector_a_vec4[] = "Return normalized vector.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 1.2)\n        >>> print a.normalize()\n        (0.4107, 0.2053, -0.7392, 0.4928)\n        ";
static char __pyx_k_Return_the_length_of_the_vector[] = "Return the length of the vector.\n\n        abs(v) is equivalent to v.length().\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print abs(a)\n        2.11896201004\n        ";
static char __pyx_k_Return_the_transmitted_vector_N[] = "Return the transmitted vector.\n\n        N is the surface normal which has to be of unit length.\n        eta is the relative index of refraction. If the returned\n        vector is zero then there is no transmitted light because\n        of total internal reflection.\n\n        >>> a=vec3(1.0, -1.5, 0.8)\n        >>> print a.refract(vec3(0,1,0), 1.33)\n        (1.3300, -1.7920, 1.0640)\n        ";
static char __pyx_k_Vector_subtraction_a_vec3_1_0_0[] = "Vector subtraction.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a-b\n        (1.3000, -0.2500, -2.3000)\n        ";
static char __pyx_k_Vector_subtraction_a_vec4_1_0_0[] = "Vector subtraction.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a-b\n        (1.3000, -0.2500, -2.3000, -0.1000)\n        ";
static char __pyx_k_a_vec3_3_0_2_5_1_8_print_a_3_00[] = "\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print +a\n        (3.0000, 2.5000, -1.8000)\n        ";
static char __pyx_k_axis_mustn_t_be_the_null_vector[] = "axis mustn't be the null vector";
static char __pyx_k_mat4_takes_at_most_16_arguments[] = "mat4() takes at most 16 arguments";
static char __pyx_k_mnt_hgfs_Documents_src_cgkit1_c[] = "/mnt/hgfs/Documents/src/cgkit1/cgtypes.pyx";
static char __pyx_k_null_vector_can_t_be_normalized[] = "null vector can't be normalized";
static char __pyx_k_q_quat_0_9689_0_2160_0_1080_0_0[] = "\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print +q\n        (0.9689, 0.2160, 0.1080, 0.0540)\n        ";
static char __pyx_k_Cross_product_a_vec3_1_0_0_5_1_8[] = "Cross product.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> c=a.cross(b)\n        >>> print c\n        (1.6000, 0.0400, 0.9000)\n        ";
static char __pyx_k_Inline_division_with_scalar_a_ve[] = "Inline division with scalar\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> a/=2.0\n        >>> print a\n        (0.5000, 0.2500, -0.9000)\n        ";
static char __pyx_k_Inline_modulo_a_vec3_3_0_2_5_1_8[] = "Inline modulo.\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> a%=2.0\n        >>> print a\n        (1.0000, 0.5000, 0.2000)\n        ";
static char __pyx_k_Inline_modulo_a_vec4_3_0_2_5_1_8[] = "Inline modulo.\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> a%=2.0\n        >>> print a\n        (1.0000, 0.5000, 0.2000, 0.2000)\n        ";
static char __pyx_k_Inline_vector_subtraction_a_vec3[] = "Inline vector subtraction.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> a-=b\n        >>> print a\n        (1.3000, -0.2500, -2.3000)\n        ";
static char __pyx_k_Inline_vector_subtraction_a_vec4[] = "Inline vector subtraction.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> a-=b\n        >>> print a\n        (1.3000, -0.2500, -2.3000, -0.1000)\n        ";
static char __pyx_k_Matrix_addition_M_mat4_1_2_3_4_5[] = "Matrix addition.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M+M\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        ";
static char __pyx_k_Modulo_component_wise_a_vec3_3_0[] = "Modulo (component wise).\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print a%2.0\n        (1.0000, 0.5000, 0.2000)\n        ";
static char __pyx_k_Modulo_component_wise_a_vec4_3_0[] = "Modulo (component wise)\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print a%2.0\n        (1.0000, 0.5000, 0.2000, 0.2000)\n        ";
static char __pyx_k_Multiplication_q_quat_0_9689_0_2[] = "Multiplication.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q*2.0\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        >>> print 2.0*q\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        >>> print q*q\n        (0.8775, 0.4186, 0.2093, 0.1046)\n        ";
static char __pyx_k_Negation_a_vec3_3_0_2_5_1_8_prin[] = "Negation\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print -a\n        (-3.0000, -2.5000, 1.8000)\n        ";
static char __pyx_k_Return_a_component_by_index_0_ba[] = "Return a component by index (0-based)\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a[0]\n        1.0\n        >>> print a[1]\n        0.5\n        >>> print a[2]\n        -1.8\n        ";
static char __pyx_k_Return_a_list_containing_the_mat[] = "Return a list containing the matrix elements.\n\n        By default the list is in column-major order (which can directly be\n        used in OpenGL or RenderMan). If you set the optional argument\n        rowmajor to 1, you'll get the list in row-major order.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M.toList()\n        [1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]\n        >>> print M.toList(rowmajor=1)\n        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n        ";
static char __pyx_k_Return_angle_in_radians_and_rota[] = "Return angle (in radians) and rotation axis.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> angle, axis = q.toAngleAxis()\n        >>> print round(angle,4)\n        1.2011\n        >>> print axis\n        (0.8111, 0.3244, 0.4867)\n        ";
static char __pyx_k_Return_conjugate_q_quat_0_9689_0[] = "Return conjugate.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q.conjugate()\n        (0.9689, -0.2160, -0.1080, -0.0540)\n        ";
static char __pyx_k_Return_identity_matrix_print_mat[] = "Return identity matrix.\n\n        >>> print mat4().identity()\n        [   1.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    1.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    1.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    1.0000]\n        ";
static char __pyx_k_Return_inverse_matrix_M_mat4_0_2[] = "Return inverse matrix.\n\n        >>> M=mat4(0,-2.0,0,0, 2.0,0,0,0, 0,0,2,0, 0,0,0,2)\n        >>> print M.inverse()\n        [   0.0000,    0.5000,    0.0000,    0.0000]\n        [  -0.5000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.5000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.5000]\n        ";
static char __pyx_k_Return_magnitude_q_quat_0_9689_0[] = "Return magnitude.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print round(abs(q),5)\n        1.0\n        ";
static char __pyx_k_Return_normalized_quaternion_q_q[] = "Return normalized quaternion.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> q=q.normalize()\n        >>> print q\n        (0.8250, 0.4583, 0.1833, 0.2750)\n        >>> print abs(q)\n        1.0\n        ";
static char __pyx_k_Return_the_reflection_vector_N_i[] = "Return the reflection vector.\n\n        N is the surface normal which has to be of unit length.\n\n        >>> a=vec3(1.0, -1.0, 0.0)\n        >>> print a.reflect(vec3(0,1,0)\n        (1.0000, 1.0000, 0.0000)\n        ";
static char __pyx_k_Return_transpose_matrix_M_mat4_1[] = "Return transpose matrix.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M.transpose()\n        [   1.0000,    5.0000,    9.0000,   13.0000]\n        [   2.0000,    6.0000,   10.0000,   14.0000]\n        [   3.0000,    7.0000,   11.0000,   15.0000]\n        [   4.0000,    8.0000,   12.0000,   16.0000]\n        ";
static char __pyx_k_Returns_an_orthogonal_vector_Ret[] = "Returns an orthogonal vector.\n\n        Returns a vector that is orthogonal to self (where\n        self*self.ortho()==0).\n\n        >>> a=vec3(1.0, -1.5, 0.8)\n        >>> print round(a*a.ortho(),8)\n        0.0\n        ";
static char __pyx_k_Set_a_component_by_index_0_based[] = "Set a component by index (0-based)\n\n        >>> a=vec3()\n        >>> a[0]=1.5; a[1]=0.7; a[2]=-0.3\n        >>> print a\n        (1.5000, 0.7000, -0.3000)\n        ";
static char __pyx_k_Subtraction_q_quat_0_9689_0_2160[] = "Subtraction.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q-q\n        (0.0000, 0.0000, 0.0000, 0.0000)\n        ";
static char __pyx_k_Vector_addition_a_vec3_1_0_0_5_1[] = "Vector addition.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a+b\n        (0.7000, 1.2500, -1.3000)\n        ";
static char __pyx_k_Vector_addition_a_vec4_1_0_0_5_1[] = "Vector addition.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a+b\n        (0.7000, 1.2500, -1.3000, 0.5000)\n        ";
static char __pyx_k_angle_null_vector_can_t_be_norma[] = "angle(): null vector can't be normalized";
static char __pyx_k_far_value_must_be_greater_than_n[] = "far-value must be greater than near-value";
static char __pyx_k_index_must_be_integer_or_2_tuple[] = "index must be integer or 2-tuple";
static char __pyx_k_internal_error_illegal_rich_comp[] = "internal error: illegal rich comparison number";
static char __pyx_k_mat3_arg_can_t_be_converted_to_m[] = "mat3() arg can't be converted to mat3";
static char __pyx_k_mat4_arg_can_t_be_converted_to_m[] = "mat4() arg can't be converted to mat4";
static char __pyx_k_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s[] = "mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)";
static char __pyx_k_quat_arg_can_t_be_converted_to_q[] = "quat() arg can't be converted to quat";
static char __pyx_k_right_value_must_be_greater_than[] = "right-value must be greater than left-value";
static char __pyx_k_top_value_must_be_greater_than_b[] = "top-value must be greater than bottom-value";
static char __pyx_k_transformation_contains_a_0_scal[] = "transformation contains a 0 scaling";
static char __pyx_k_unsupported_operand_type_for_cro[] = "unsupported operand type for cross()";
static char __pyx_k_vec3_arg_can_t_be_converted_to_v[] = "vec3() arg can't be converted to vec3";
static char __pyx_k_vec4_arg_can_t_be_converted_to_v[] = "vec4() arg can't be converted to vec4";
static char __pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2[] = "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]";
static char __pyx_k_Inline_multiplication_only_with_2[] = "Inline multiplication (only with scalar)\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> a*=2.0\n        >>> print a\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        ";
static char __pyx_k_Multiplication_with_a_scalar_or_2[] = "Multiplication with a scalar or dot product.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a*2.0\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        >>> print 2.0*a\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        >>> print a*b\n        -0.765\n        ";
static char __pyx_k_Return_the_length_of_the_vector_2[] = "Return the length of the vector.\n\n        v.length() is equivalent to abs(v).\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a.length()\n        2.11896201004\n        ";
static char __pyx_k_Return_the_length_of_the_vector_3[] = "Return the length of the vector.\n\n        abs(v) is equivalent to v.length().\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print abs(a)\n        2.12837966538\n        ";
static char __pyx_k_Return_the_length_of_the_vector_4[] = "Return the length of the vector.\n\n        v.length() is equivalent to abs(v).\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a.length()\n        2.12837966538\n        ";
static char __pyx_k_Inline_division_with_scalar_a_ve_2[] = "Inline division with scalar\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> a/=2.0\n        >>> print a\n        (0.5000, 0.2500, -0.9000, 0.1000)\n        ";
static char __pyx_k_Return_a_component_by_index_0_ba_2[] = "Return a component by index (0-based).\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a[0]\n        1.0\n        >>> print a[1]\n        0.5\n        >>> print a[2]\n        -1.8\n        >>> print a[3]\n        0.2\n        ";
static char __pyx_k_Set_a_component_by_index_0_based_2[] = "Set a component by index (0-based).\n\n        >>> a=vec4()\n        >>> a[0]=1.5; a[1]=0.7; a[2]=-0.3; a[3]=0.2\n        >>> print a\n        (1.5000, 0.7000, -0.3000, 0.2000)\n        ";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_kp_s_1_4f_1_4f_1_4f;
static PyObject *__pyx_kp_s_1_4f_1_4f_1_4f_1_4f;
static PyObject *__pyx_kp_s_3_sequence_expected;
static PyObject *__pyx_kp_s_4_sequence_expected;
static PyObject *__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9;
static PyObject *__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2;
static PyObject *__pyx_kp_u_Addition_q_quat_0_9689_0_2160_0;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_kp_u_Cross_product_a_vec3_1_0_0_5_1_8;
static PyObject *__pyx_kp_u_Division_M_mat4_1_2_3_4_5_6_7_8;
static PyObject *__pyx_kp_u_Division_by_scalar_a_vec3_1_0_0;
static PyObject *__pyx_kp_u_Division_by_scalar_a_vec4_1_0_0;
static PyObject *__pyx_kp_u_Division_q_quat_0_9689_0_2160_0;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_u_Inline_division_with_scalar_a_ve;
static PyObject *__pyx_kp_u_Inline_division_with_scalar_a_ve_2;
static PyObject *__pyx_kp_u_Inline_modulo_a_vec3_3_0_2_5_1_8;
static PyObject *__pyx_kp_u_Inline_modulo_a_vec4_3_0_2_5_1_8;
static PyObject *__pyx_kp_u_Inline_multiplication_only_with;
static PyObject *__pyx_kp_u_Inline_multiplication_only_with_2;
static PyObject *__pyx_kp_u_Inline_vector_addition_a_vec3_1;
static PyObject *__pyx_kp_u_Inline_vector_addition_a_vec4_1;
static PyObject *__pyx_kp_u_Inline_vector_subtraction_a_vec3;
static PyObject *__pyx_kp_u_Inline_vector_subtraction_a_vec4;
static PyObject *__pyx_n_s_M3;
static PyObject *__pyx_kp_u_M_mat4_1_2_3_4_5_6_7_8_9_10_11;
static PyObject *__pyx_kp_u_Matrix_addition_M_mat4_1_2_3_4_5;
static PyObject *__pyx_kp_u_Matrix_subtraction_M_mat4_1_2_3;
static PyObject *__pyx_kp_u_Modulo_M_mat4_1_2_3_4_5_6_7_8_9;
static PyObject *__pyx_kp_u_Modulo_component_wise_a_vec3_3_0;
static PyObject *__pyx_kp_u_Modulo_component_wise_a_vec4_3_0;
static PyObject *__pyx_kp_u_Multiplication_M_mat4_1_2_3_4_5;
static PyObject *__pyx_kp_u_Multiplication_q_quat_0_9689_0_2;
static PyObject *__pyx_kp_u_Multiplication_with_a_scalar_or;
static PyObject *__pyx_kp_u_Multiplication_with_a_scalar_or_2;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_kp_u_Negation_M_mat4_1_2_3_4_5_6_7_8;
static PyObject *__pyx_kp_u_Negation_a_vec3_3_0_2_5_1_8_prin;
static PyObject *__pyx_kp_u_Negation_a_vec4_3_0_2_5_1_8_0_2;
static PyObject *__pyx_kp_u_Negation_q_quat_0_9689_0_2160_0;
static PyObject *__pyx_kp_u_Return_a_component_by_index_0_ba;
static PyObject *__pyx_kp_u_Return_a_component_by_index_0_ba_2;
static PyObject *__pyx_kp_u_Return_a_list_containing_the_mat;
static PyObject *__pyx_kp_u_Return_angle_in_radians_and_rota;
static PyObject *__pyx_kp_u_Return_angle_in_radians_between;
static PyObject *__pyx_kp_u_Return_conjugate_q_quat_0_9689_0;
static PyObject *__pyx_kp_u_Return_determinant_M_mat4_2_0_0;
static PyObject *__pyx_kp_u_Return_identity_matrix_print_mat;
static PyObject *__pyx_kp_u_Return_inverse_matrix_M_mat4_0_2;
static PyObject *__pyx_kp_u_Return_inverse_q_quat_0_9_0_5_0;
static PyObject *__pyx_kp_u_Return_magnitude_q_quat_0_9689_0;
static PyObject *__pyx_kp_u_Return_normalized_quaternion_q_q;
static PyObject *__pyx_kp_u_Return_normalized_vector_a_vec3;
static PyObject *__pyx_kp_u_Return_normalized_vector_a_vec4;
static PyObject *__pyx_kp_u_Return_the_length_of_the_vector;
static PyObject *__pyx_kp_u_Return_the_length_of_the_vector_2;
static PyObject *__pyx_kp_u_Return_the_length_of_the_vector_3;
static PyObject *__pyx_kp_u_Return_the_length_of_the_vector_4;
static PyObject *__pyx_kp_u_Return_the_reflection_vector_N_i;
static PyObject *__pyx_kp_u_Return_the_transmitted_vector_N;
static PyObject *__pyx_kp_u_Return_transpose_matrix_M_mat4_1;
static PyObject *__pyx_kp_u_Returns_an_orthogonal_vector_Ret;
static PyObject *__pyx_kp_u_Set_a_component_by_index_0_based;
static PyObject *__pyx_kp_u_Set_a_component_by_index_0_based_2;
static PyObject *__pyx_n_s_StopIteration;
static PyObject *__pyx_kp_u_Subtraction_q_quat_0_9689_0_2160;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_u_Vector_addition_a_vec3_1_0_0_5_1;
static PyObject *__pyx_kp_u_Vector_addition_a_vec4_1_0_0_5_1;
static PyObject *__pyx_kp_u_Vector_subtraction_a_vec3_1_0_0;
static PyObject *__pyx_kp_u_Vector_subtraction_a_vec4_1_0_0;
static PyObject *__pyx_n_s_ZeroDivisionError;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__4;
static PyObject *__pyx_kp_s__7;
static PyObject *__pyx_kp_s__8;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_kp_u_a_vec3_3_0_2_5_1_8_print_a_3_00;
static PyObject *__pyx_kp_u_a_vec4_3_0_2_5_1_8_0_2_print_a;
static PyObject *__pyx_n_s_angle;
static PyObject *__pyx_kp_s_angle_null_vector_can_t_be_norma;
static PyObject *__pyx_n_s_aspect;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_kp_s_axis_mustn_t_be_the_null_vector;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_b1;
static PyObject *__pyx_n_s_b2;
static PyObject *__pyx_n_s_b3;
static PyObject *__pyx_n_s_b4;
static PyObject *__pyx_n_s_bottom;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_cgtypes;
static PyObject *__pyx_n_s_constructor;
static PyObject *__pyx_n_s_copy_reg;
static PyObject *__pyx_n_s_copyreg;
static PyObject *__pyx_n_s_cross;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_determinant;
static PyObject *__pyx_n_s_dot;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_eta;
static PyObject *__pyx_n_s_exp;
static PyObject *__pyx_n_s_far;
static PyObject *__pyx_kp_s_far_value_must_be_greater_than_n;
static PyObject *__pyx_n_s_fovy;
static PyObject *__pyx_n_s_fromAngleAxis;
static PyObject *__pyx_n_s_frustum;
static PyObject *__pyx_n_s_getEpsilon;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_kp_s_index_must_be_integer;
static PyObject *__pyx_kp_s_index_must_be_integer_or_2_tuple;
static PyObject *__pyx_kp_s_index_out_of_range;
static PyObject *__pyx_kp_s_index_tuple_must_be_a_2_tuple;
static PyObject *__pyx_kp_s_internal_error_illegal_rich_comp;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_left;
static PyObject *__pyx_n_s_length;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_kp_s_mat3_arg_can_t_be_converted_to_m;
static PyObject *__pyx_kp_s_mat3_arg_is_a_malformed_string;
static PyObject *__pyx_kp_s_mat3_division;
static PyObject *__pyx_kp_s_mat3_modulo;
static PyObject *__pyx_kp_s_mat3_s_s_s_s_s_s_s_s_s;
static PyObject *__pyx_kp_s_mat3_takes_at_most_9_arguments;
static PyObject *__pyx_n_s_mat3construct;
static PyObject *__pyx_kp_u_mat4___add___line_2821;
static PyObject *__pyx_kp_u_mat4___div___line_3038;
static PyObject *__pyx_kp_u_mat4___mod___line_3079;
static PyObject *__pyx_kp_u_mat4___mul___line_2881;
static PyObject *__pyx_kp_u_mat4___neg___line_3152;
static PyObject *__pyx_kp_u_mat4___pos___line_3182;
static PyObject *__pyx_kp_u_mat4___sub___line_2851;
static PyObject *__pyx_kp_s_mat4_arg_can_t_be_converted_to_m;
static PyObject *__pyx_kp_s_mat4_arg_is_a_malformed_string;
static PyObject *__pyx_kp_u_mat4_determinant_line_3753;
static PyObject *__pyx_kp_s_mat4_division;
static PyObject *__pyx_kp_u_mat4_identity_line_3694;
static PyObject *__pyx_kp_u_mat4_inverse_line_3825;
static PyObject *__pyx_kp_s_mat4_modulo;
static PyObject *__pyx_kp_s_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s;
static PyObject *__pyx_kp_s_mat4_takes_at_most_16_arguments;
static PyObject *__pyx_kp_u_mat4_toList_line_3669;
static PyObject *__pyx_kp_u_mat4_transpose_line_3723;
static PyObject *__pyx_n_s_mat4construct;
static PyObject *__pyx_kp_s_math_domain_error;
static PyObject *__pyx_kp_s_matrix_is_not_invertible;
static PyObject *__pyx_kp_s_matrix_not_invertible;
static PyObject *__pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c;
static PyObject *__pyx_n_s_near;
static PyObject *__pyx_n_s_normalize;
static PyObject *__pyx_kp_s_null_vector_can_t_be_normalized;
static PyObject *__pyx_n_s_o;
static PyObject *__pyx_n_s_ortho;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_q0;
static PyObject *__pyx_n_s_q1;
static PyObject *__pyx_kp_u_q_quat_0_9689_0_2160_0_1080_0_0;
static PyObject *__pyx_kp_u_quat___abs___line_4764;
static PyObject *__pyx_kp_u_quat___add___line_4526;
static PyObject *__pyx_kp_u_quat___div___line_4607;
static PyObject *__pyx_kp_u_quat___mul___line_4556;
static PyObject *__pyx_kp_u_quat___neg___line_4641;
static PyObject *__pyx_kp_u_quat___pos___line_4656;
static PyObject *__pyx_kp_u_quat___sub___line_4541;
static PyObject *__pyx_kp_s_quat_arg_can_t_be_converted_to_q;
static PyObject *__pyx_kp_s_quat_arg_is_a_malformed_string;
static PyObject *__pyx_kp_u_quat_conjugate_line_4775;
static PyObject *__pyx_kp_s_quat_division;
static PyObject *__pyx_kp_s_quat_has_no_attribute;
static PyObject *__pyx_kp_s_quat_has_no_writable_attribute;
static PyObject *__pyx_kp_u_quat_inverse_line_4815;
static PyObject *__pyx_kp_s_quat_is_not_invertible;
static PyObject *__pyx_kp_u_quat_normalize_line_4790;
static PyObject *__pyx_kp_s_quat_s_s_s_s;
static PyObject *__pyx_kp_u_quat_toAngleAxis_line_4836;
static PyObject *__pyx_n_s_quatconstruct;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_replace;
static PyObject *__pyx_n_s_res;
static PyObject *__pyx_n_s_right;
static PyObject *__pyx_kp_s_right_value_must_be_greater_than;
static PyObject *__pyx_n_s_rmul;
static PyObject *__pyx_n_s_rotation;
static PyObject *__pyx_n_s_rowmajor;
static PyObject *__pyx_n_s_setEpsilon;
static PyObject *__pyx_n_s_slerp;
static PyObject *__pyx_n_s_so;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_squad;
static PyObject *__pyx_n_s_strip;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_target;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_top;
static PyObject *__pyx_kp_s_top_value_must_be_greater_than_b;
static PyObject *__pyx_kp_s_transformation_contains_a_0_scal;
static PyObject *__pyx_kp_s_unsupported_operand_type_for;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_2;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_3;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_4;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_5;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_6;
static PyObject *__pyx_kp_s_unsupported_operand_type_for_cro;
static PyObject *__pyx_kp_s_unsupported_operation;
static PyObject *__pyx_n_s_up;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_kp_u_vec3___abs___line_531;
static PyObject *__pyx_kp_u_vec3___add___line_258;
static PyObject *__pyx_kp_u_vec3___div___line_340;
static PyObject *__pyx_kp_u_vec3___getitem___line_568;
static PyObject *__pyx_kp_u_vec3___iadd___line_428;
static PyObject *__pyx_kp_u_vec3___idiv___line_475;
static PyObject *__pyx_kp_u_vec3___imod___line_496;
static PyObject *__pyx_kp_u_vec3___imul___line_456;
static PyObject *__pyx_kp_u_vec3___isub___line_442;
static PyObject *__pyx_kp_u_vec3___mod___line_365;
static PyObject *__pyx_kp_u_vec3___mul___line_288;
static PyObject *__pyx_kp_u_vec3___neg___line_400;
static PyObject *__pyx_kp_u_vec3___pos___line_414;
static PyObject *__pyx_kp_u_vec3___setitem___line_592;
static PyObject *__pyx_kp_u_vec3___sub___line_273;
static PyObject *__pyx_kp_u_vec3_angle_line_666;
static PyObject *__pyx_kp_s_vec3_arg_can_t_be_converted_to_v;
static PyObject *__pyx_kp_s_vec3_arg_is_a_malformed_string;
static PyObject *__pyx_kp_u_vec3_cross_line_613;
static PyObject *__pyx_kp_s_vec3_division;
static PyObject *__pyx_kp_s_vec3_has_no_attribute;
static PyObject *__pyx_kp_s_vec3_has_no_writable_attribute;
static PyObject *__pyx_kp_u_vec3_length_line_633;
static PyObject *__pyx_kp_s_vec3_modulo;
static PyObject *__pyx_kp_u_vec3_normalize_line_646;
static PyObject *__pyx_kp_u_vec3_ortho_line_744;
static PyObject *__pyx_kp_u_vec3_reflect_line_693;
static PyObject *__pyx_kp_u_vec3_refract_line_712;
static PyObject *__pyx_kp_s_vec3_s_s_s;
static PyObject *__pyx_kp_s_vec3_takes_at_most_3_arguments;
static PyObject *__pyx_n_s_vec3construct;
static PyObject *__pyx_kp_u_vec4___abs___line_1295;
static PyObject *__pyx_kp_u_vec4___add___line_1008;
static PyObject *__pyx_kp_u_vec4___div___line_1091;
static PyObject *__pyx_kp_u_vec4___getitem___line_1336;
static PyObject *__pyx_kp_u_vec4___iadd___line_1185;
static PyObject *__pyx_kp_u_vec4___idiv___line_1235;
static PyObject *__pyx_kp_u_vec4___imod___line_1257;
static PyObject *__pyx_kp_u_vec4___imul___line_1215;
static PyObject *__pyx_kp_u_vec4___isub___line_1200;
static PyObject *__pyx_kp_u_vec4___mod___line_1118;
static PyObject *__pyx_kp_u_vec4___mul___line_1040;
static PyObject *__pyx_kp_u_vec4___neg___line_1156;
static PyObject *__pyx_kp_u_vec4___pos___line_1171;
static PyObject *__pyx_kp_u_vec4___setitem___line_1363;
static PyObject *__pyx_kp_u_vec4___sub___line_1024;
static PyObject *__pyx_kp_s_vec4_arg_can_t_be_converted_to_v;
static PyObject *__pyx_kp_s_vec4_arg_is_a_malformed_string;
static PyObject *__pyx_kp_s_vec4_division;
static PyObject *__pyx_kp_s_vec4_has_no_attribute;
static PyObject *__pyx_kp_s_vec4_has_no_writable_attribute;
static PyObject *__pyx_kp_u_vec4_length_line_1385;
static PyObject *__pyx_kp_s_vec4_modulo;
static PyObject *__pyx_kp_u_vec4_normalize_line_1398;
static PyObject *__pyx_kp_s_vec4_s_s_s_s;
static PyObject *__pyx_kp_s_vec4_takes_at_most_4_arguments;
static PyObject *__pyx_n_s_vec4construct;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_2_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;

/* "cgtypes.pyx":38
 * 
 * # _fmod: A modulo function that also works with negative a
 * cdef double _fmod(double a, double b):             # <<<<<<<<<<<<<<
 *     cdef int n
 *     n = <int>(a/b)
 */

static double __pyx_f_7cgtypes__fmod(double __pyx_v_a, double __pyx_v_b) {
  int __pyx_v_n;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fmod", 0);

  /* "cgtypes.pyx":40
 * cdef double _fmod(double a, double b):
 *     cdef int n
 *     n = <int>(a/b)             # <<<<<<<<<<<<<<
 *     a = a-n*b
 *     if a<0:
 */
  if (unlikely(__pyx_v_b == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_n = ((int)(__pyx_v_a / __pyx_v_b));

  /* "cgtypes.pyx":41
 *     cdef int n
 *     n = <int>(a/b)
 *     a = a-n*b             # <<<<<<<<<<<<<<
 *     if a<0:
 *         a=a+b
 */
  __pyx_v_a = (__pyx_v_a - (__pyx_v_n * __pyx_v_b));

  /* "cgtypes.pyx":42
 *     n = <int>(a/b)
 *     a = a-n*b
 *     if a<0:             # <<<<<<<<<<<<<<
 *         a=a+b
 *     return a
 */
  __pyx_t_1 = ((__pyx_v_a < 0.0) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":43
 *     a = a-n*b
 *     if a<0:
 *         a=a+b             # <<<<<<<<<<<<<<
 *     return a
 * 
 */
    __pyx_v_a = (__pyx_v_a + __pyx_v_b);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":44
 *     if a<0:
 *         a=a+b
 *     return a             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
  __pyx_r = __pyx_v_a;
  goto __pyx_L0;

  /* "cgtypes.pyx":38
 * 
 * # _fmod: A modulo function that also works with negative a
 * cdef double _fmod(double a, double b):             # <<<<<<<<<<<<<<
 *     cdef int n
 *     n = <int>(a/b)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("cgtypes._fmod", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":49
 * 
 * # setEpsilon
 * def setEpsilon(e):             # <<<<<<<<<<<<<<
 *     """Sets a new epsilon threshold value.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_1setEpsilon(PyObject *__pyx_self, PyObject *__pyx_v_e); /*proto*/
static char __pyx_doc_7cgtypes_setEpsilon[] = "Sets a new epsilon threshold value.\n\n    Sets a new epsilon threshold value and returns the previously set\n    value. Two values are considered to be equal if their absolute\n    difference is less than or equal to epsilon.";
static PyMethodDef __pyx_mdef_7cgtypes_1setEpsilon = {"setEpsilon", (PyCFunction)__pyx_pw_7cgtypes_1setEpsilon, METH_O, __pyx_doc_7cgtypes_setEpsilon};
static PyObject *__pyx_pw_7cgtypes_1setEpsilon(PyObject *__pyx_self, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setEpsilon (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_setEpsilon(__pyx_self, ((PyObject *)__pyx_v_e));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_setEpsilon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e) {
  double __pyx_v_res;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setEpsilon", 0);

  /* "cgtypes.pyx":56
 *     difference is less than or equal to epsilon."""
 *     global eps
 *     res = eps             # <<<<<<<<<<<<<<
 *     eps = e
 *     return res
 */
  __pyx_v_res = __pyx_v_7cgtypes_eps;

  /* "cgtypes.pyx":57
 *     global eps
 *     res = eps
 *     eps = e             # <<<<<<<<<<<<<<
 *     return res
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_e); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7cgtypes_eps = __pyx_t_1;

  /* "cgtypes.pyx":58
 *     res = eps
 *     eps = e
 *     return res             # <<<<<<<<<<<<<<
 * 
 * # getEpsilon
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_res); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":49
 * 
 * # setEpsilon
 * def setEpsilon(e):             # <<<<<<<<<<<<<<
 *     """Sets a new epsilon threshold value.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.setEpsilon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":61
 * 
 * # getEpsilon
 * def getEpsilon():             # <<<<<<<<<<<<<<
 *     """Return the epsilon threshold which is used for doing comparisons."""
 *     return eps
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_3getEpsilon(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_2getEpsilon[] = "Return the epsilon threshold which is used for doing comparisons.";
static PyMethodDef __pyx_mdef_7cgtypes_3getEpsilon = {"getEpsilon", (PyCFunction)__pyx_pw_7cgtypes_3getEpsilon, METH_NOARGS, __pyx_doc_7cgtypes_2getEpsilon};
static PyObject *__pyx_pw_7cgtypes_3getEpsilon(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getEpsilon (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_2getEpsilon(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_2getEpsilon(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getEpsilon", 0);

  /* "cgtypes.pyx":63
 * def getEpsilon():
 *     """Return the epsilon threshold which is used for doing comparisons."""
 *     return eps             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_7cgtypes_eps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":61
 * 
 * # getEpsilon
 * def getEpsilon():             # <<<<<<<<<<<<<<
 *     """Return the epsilon threshold which is used for doing comparisons."""
 *     return eps
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.getEpsilon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":75
 *     cdef object v
 * 
 *     def __cinit__(self, v):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.v   = v
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_8vec3iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_8vec3iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec3iter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_8vec3iter___cinit__(((struct __pyx_obj_7cgtypes_vec3iter *)__pyx_v_self), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_8vec3iter___cinit__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":76
 * 
 *     def __cinit__(self, v):
 *         self.idx = 0             # <<<<<<<<<<<<<<
 *         self.v   = v
 * 
 */
  __pyx_v_self->idx = 0;

  /* "cgtypes.pyx":77
 *     def __cinit__(self, v):
 *         self.idx = 0
 *         self.v   = v             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_GIVEREF(__pyx_v_v);
  __Pyx_GOTREF(__pyx_v_self->v);
  __Pyx_DECREF(__pyx_v_self->v);
  __pyx_v_self->v = __pyx_v_v;

  /* "cgtypes.pyx":75
 *     cdef object v
 * 
 *     def __cinit__(self, v):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.v   = v
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":79
 *         self.v   = v
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8vec3iter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8vec3iter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8vec3iter_2__iter__(((struct __pyx_obj_7cgtypes_vec3iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8vec3iter_2__iter__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":80
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":79
 *         self.v   = v
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":82
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8vec3iter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8vec3iter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8vec3iter_4__next__(((struct __pyx_obj_7cgtypes_vec3iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8vec3iter_4__next__(struct __pyx_obj_7cgtypes_vec3iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "cgtypes.pyx":89
 *             self.idx=2
 *             return self.v.y
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.v.z
 */
  switch (__pyx_v_self->idx) {

    /* "cgtypes.pyx":83
 * 
 *     def __next__(self):
 *         if self.idx==0:             # <<<<<<<<<<<<<<
 *             self.idx=1
 *             return self.v.x
 */
    case 0:

    /* "cgtypes.pyx":84
 *     def __next__(self):
 *         if self.idx==0:
 *             self.idx=1             # <<<<<<<<<<<<<<
 *             return self.v.x
 *         elif self.idx==1:
 */
    __pyx_v_self->idx = 1;

    /* "cgtypes.pyx":85
 *         if self.idx==0:
 *             self.idx=1
 *             return self.v.x             # <<<<<<<<<<<<<<
 *         elif self.idx==1:
 *             self.idx=2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":86
 *             self.idx=1
 *             return self.v.x
 *         elif self.idx==1:             # <<<<<<<<<<<<<<
 *             self.idx=2
 *             return self.v.y
 */
    case 1:

    /* "cgtypes.pyx":87
 *             return self.v.x
 *         elif self.idx==1:
 *             self.idx=2             # <<<<<<<<<<<<<<
 *             return self.v.y
 *         elif self.idx==2:
 */
    __pyx_v_self->idx = 2;

    /* "cgtypes.pyx":88
 *         elif self.idx==1:
 *             self.idx=2
 *             return self.v.y             # <<<<<<<<<<<<<<
 *         elif self.idx==2:
 *             self.idx=3
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":89
 *             self.idx=2
 *             return self.v.y
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.v.z
 */
    case 2:

    /* "cgtypes.pyx":90
 *             return self.v.y
 *         elif self.idx==2:
 *             self.idx=3             # <<<<<<<<<<<<<<
 *             return self.v.z
 *         else:
 */
    __pyx_v_self->idx = 3;

    /* "cgtypes.pyx":91
 *         elif self.idx==2:
 *             self.idx=3
 *             return self.v.z             # <<<<<<<<<<<<<<
 *         else:
 *             raise StopIteration
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":93
 *             return self.v.z
 *         else:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":82
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3iter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":108
 *     cdef double x,y,z
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec3_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_4vec3_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7cgtypes_4vec3___cinit__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec3___cinit__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_arglen;
  int __pyx_v_seqlen;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_v = 0;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_v_s = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_seq = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":131
 *         cdef int arglen, seqlen
 *         cdef vec3 v
 *         arglen = len(args)             # <<<<<<<<<<<<<<
 * 
 *         if arglen==0:
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arglen = __pyx_t_1;

  /* "cgtypes.pyx":196
 *             self.z = 0.0
 * 
 *         elif arglen==3:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
  switch (__pyx_v_arglen) {

    /* "cgtypes.pyx":133
 *         arglen = len(args)
 * 
 *         if arglen==0:             # <<<<<<<<<<<<<<
 *             self.x = 0.0
 *             self.y = 0.0
 */
    case 0:

    /* "cgtypes.pyx":134
 * 
 *         if arglen==0:
 *             self.x = 0.0             # <<<<<<<<<<<<<<
 *             self.y = 0.0
 *             self.z = 0.0
 */
    __pyx_v_self->x = 0.0;

    /* "cgtypes.pyx":135
 *         if arglen==0:
 *             self.x = 0.0
 *             self.y = 0.0             # <<<<<<<<<<<<<<
 *             self.z = 0.0
 *         elif arglen==1:
 */
    __pyx_v_self->y = 0.0;

    /* "cgtypes.pyx":136
 *             self.x = 0.0
 *             self.y = 0.0
 *             self.z = 0.0             # <<<<<<<<<<<<<<
 *         elif arglen==1:
 *             T = type(args[0])
 */
    __pyx_v_self->z = 0.0;
    break;

    /* "cgtypes.pyx":137
 *             self.y = 0.0
 *             self.z = 0.0
 *         elif arglen==1:             # <<<<<<<<<<<<<<
 *             T = type(args[0])
 *             # scalar
 */
    case 1:

    /* "cgtypes.pyx":138
 *             self.z = 0.0
 *         elif arglen==1:
 *             T = type(args[0])             # <<<<<<<<<<<<<<
 *             # scalar
 *             if T==float or T==int or T==long:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2)));
    __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_t_2)));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":140
 *             T = type(args[0])
 *             # scalar
 *             if T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *                 self.x = args[0]
 *                 self.y = self.x
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":141
 *             # scalar
 *             if T==float or T==int or T==long:
 *                 self.x = args[0]             # <<<<<<<<<<<<<<
 *                 self.y = self.x
 *                 self.z = self.x
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":142
 *             if T==float or T==int or T==long:
 *                 self.x = args[0]
 *                 self.y = self.x             # <<<<<<<<<<<<<<
 *                 self.z = self.x
 *             # vec3
 */
      __pyx_t_5 = __pyx_v_self->x;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":143
 *                 self.x = args[0]
 *                 self.y = self.x
 *                 self.z = self.x             # <<<<<<<<<<<<<<
 *             # vec3
 *             elif T==vec3:
 */
      __pyx_t_5 = __pyx_v_self->x;
      __pyx_v_self->z = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":145
 *                 self.z = self.x
 *             # vec3
 *             elif T==vec3:             # <<<<<<<<<<<<<<
 *                 v = args[0]
 *                 self.x = v.x
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":146
 *             # vec3
 *             elif T==vec3:
 *                 v = args[0]             # <<<<<<<<<<<<<<
 *                 self.x = v.x
 *                 self.y = v.y
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_v = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":147
 *             elif T==vec3:
 *                 v = args[0]
 *                 self.x = v.x             # <<<<<<<<<<<<<<
 *                 self.y = v.y
 *                 self.z = v.z
 */
      __pyx_t_5 = __pyx_v_v->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":148
 *                 v = args[0]
 *                 self.x = v.x
 *                 self.y = v.y             # <<<<<<<<<<<<<<
 *                 self.z = v.z
 *             # String
 */
      __pyx_t_5 = __pyx_v_v->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":149
 *                 self.x = v.x
 *                 self.y = v.y
 *                 self.z = v.z             # <<<<<<<<<<<<<<
 *             # String
 *             elif T==str or T==unicode:
 */
      __pyx_t_5 = __pyx_v_v->z;
      __pyx_v_self->z = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":151
 *                 self.z = v.z
 *             # String
 *             elif T==str or T==unicode:             # <<<<<<<<<<<<<<
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":152
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":153
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:             # <<<<<<<<<<<<<<
 *                     s=[]
 *                 for i in range(len(s)):
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s__7);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__7);
      __Pyx_GIVEREF(__pyx_kp_s__7);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_s, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {

        /* "cgtypes.pyx":154
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 *                     s=[]             # <<<<<<<<<<<<<<
 *                 for i in range(len(s)):
 *                     try:
 */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":155
 *                 if s==[""]:
 *                     s=[]
 *                 for i in range(len(s)):             # <<<<<<<<<<<<<<
 *                     try:
 *                         s[i] = float(s[i])
 */
      __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "cgtypes.pyx":156
 *                     s=[]
 *                 for i in range(len(s)):
 *                     try:             # <<<<<<<<<<<<<<
 *                         s[i] = float(s[i])
 *                     except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cgtypes.pyx":157
 *                 for i in range(len(s)):
 *                     try:
 *                         s[i] = float(s[i])             # <<<<<<<<<<<<<<
 *                     except:
 *                         raise ValueError,"vec3() arg is a malformed string"
 */
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (unlikely(__Pyx_SetItemInt(__pyx_v_s, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cgtypes.pyx":158
 *                     try:
 *                         s[i] = float(s[i])
 *                     except:             # <<<<<<<<<<<<<<
 *                         raise ValueError,"vec3() arg is a malformed string"
 *                 v = vec3(s)
 */
          /*except:*/ {
            __Pyx_AddTraceback("cgtypes.vec3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_6);

            /* "cgtypes.pyx":159
 *                         s[i] = float(s[i])
 *                     except:
 *                         raise ValueError,"vec3() arg is a malformed string"             # <<<<<<<<<<<<<<
 *                 v = vec3(s)
 *                 self.x = v.x
 */
            __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_vec3_arg_is_a_malformed_string, 0, 0);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          }
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L19_try_end:;
        }
      }

      /* "cgtypes.pyx":160
 *                     except:
 *                         raise ValueError,"vec3() arg is a malformed string"
 *                 v = vec3(s)             # <<<<<<<<<<<<<<
 *                 self.x = v.x
 *                 self.y = v.y
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_v = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":161
 *                         raise ValueError,"vec3() arg is a malformed string"
 *                 v = vec3(s)
 *                 self.x = v.x             # <<<<<<<<<<<<<<
 *                 self.y = v.y
 *                 self.z = v.z
 */
      __pyx_t_5 = __pyx_v_v->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":162
 *                 v = vec3(s)
 *                 self.x = v.x
 *                 self.y = v.y             # <<<<<<<<<<<<<<
 *                 self.z = v.z
 *             # Sequence of floats
 */
      __pyx_t_5 = __pyx_v_v->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":163
 *                 self.x = v.x
 *                 self.y = v.y
 *                 self.z = v.z             # <<<<<<<<<<<<<<
 *             # Sequence of floats
 *             else:
 */
      __pyx_t_5 = __pyx_v_v->z;
      __pyx_v_self->z = __pyx_t_5;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cgtypes.pyx":166
 *             # Sequence of floats
 *             else:
 *                 seq = args[0]             # <<<<<<<<<<<<<<
 *                 try:
 *                     seqlen = len(seq)
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seq = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":167
 *             else:
 *                 seq = args[0]
 *                 try:             # <<<<<<<<<<<<<<
 *                     seqlen = len(seq)
 *                 except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cgtypes.pyx":168
 *                 seq = args[0]
 *                 try:
 *                     seqlen = len(seq)             # <<<<<<<<<<<<<<
 *                 except:
 *                     raise TypeError,"vec3() arg can't be converted to vec3"
 */
          __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __pyx_v_seqlen = __pyx_t_1;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cgtypes.pyx":169
 *                 try:
 *                     seqlen = len(seq)
 *                 except:             # <<<<<<<<<<<<<<
 *                     raise TypeError,"vec3() arg can't be converted to vec3"
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cgtypes.vec3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cgtypes.pyx":170
 *                     seqlen = len(seq)
 *                 except:
 *                     raise TypeError,"vec3() arg can't be converted to vec3"             # <<<<<<<<<<<<<<
 * 
 *                 if seqlen==3:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec3_arg_can_t_be_converted_to_v, 0, 0);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_L24_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L29_try_end:;
      }

      /* "cgtypes.pyx":172
 *                     raise TypeError,"vec3() arg can't be converted to vec3"
 * 
 *                 if seqlen==3:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 3) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":173
 * 
 *                 if seqlen==3:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":174
 *                 if seqlen==3:
 *                     self.x = seq[0]
 *                     self.y = seq[1]             # <<<<<<<<<<<<<<
 *                     self.z = seq[2]
 *                 elif seqlen==2:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":175
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 *                     self.z = seq[2]             # <<<<<<<<<<<<<<
 *                 elif seqlen==2:
 *                     self.x = seq[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->z = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":176
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 *                 elif seqlen==2:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 2) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":177
 *                     self.z = seq[2]
 *                 elif seqlen==2:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = seq[1]
 *                     self.z = 0.0
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":178
 *                 elif seqlen==2:
 *                     self.x = seq[0]
 *                     self.y = seq[1]             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                 elif seqlen==1:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":179
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                 elif seqlen==1:
 *                     self.x = seq[0]
 */
        __pyx_v_self->z = 0.0;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":180
 *                     self.y = seq[1]
 *                     self.z = 0.0
 *                 elif seqlen==1:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = self.x
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 1) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":181
 *                     self.z = 0.0
 *                 elif seqlen==1:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = self.x
 *                     self.z = self.x
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":182
 *                 elif seqlen==1:
 *                     self.x = seq[0]
 *                     self.y = self.x             # <<<<<<<<<<<<<<
 *                     self.z = self.x
 *                 elif seqlen==0:
 */
        __pyx_t_5 = __pyx_v_self->x;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":183
 *                     self.x = seq[0]
 *                     self.y = self.x
 *                     self.z = self.x             # <<<<<<<<<<<<<<
 *                 elif seqlen==0:
 *                     self.x = 0.0
 */
        __pyx_t_5 = __pyx_v_self->x;
        __pyx_v_self->z = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":184
 *                     self.y = self.x
 *                     self.z = self.x
 *                 elif seqlen==0:             # <<<<<<<<<<<<<<
 *                     self.x = 0.0
 *                     self.y = 0.0
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 0) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":185
 *                     self.z = self.x
 *                 elif seqlen==0:
 *                     self.x = 0.0             # <<<<<<<<<<<<<<
 *                     self.y = 0.0
 *                     self.z = 0.0
 */
        __pyx_v_self->x = 0.0;

        /* "cgtypes.pyx":186
 *                 elif seqlen==0:
 *                     self.x = 0.0
 *                     self.y = 0.0             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                 else:
 */
        __pyx_v_self->y = 0.0;

        /* "cgtypes.pyx":187
 *                     self.x = 0.0
 *                     self.y = 0.0
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError, "vec3() takes at most 3 arguments"
 */
        __pyx_v_self->z = 0.0;
        goto __pyx_L32;
      }
      /*else*/ {

        /* "cgtypes.pyx":189
 *                     self.z = 0.0
 *                 else:
 *                     raise TypeError, "vec3() takes at most 3 arguments"             # <<<<<<<<<<<<<<
 * 
 *         elif arglen==2:
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec3_takes_at_most_3_arguments, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L32:;
    }
    __pyx_L3:;
    break;

    /* "cgtypes.pyx":191
 *                     raise TypeError, "vec3() takes at most 3 arguments"
 * 
 *         elif arglen==2:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
    case 2:

    /* "cgtypes.pyx":192
 * 
 *         elif arglen==2:
 *             self.x = args[0]             # <<<<<<<<<<<<<<
 *             self.y = args[1]
 *             self.z = 0.0
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":193
 *         elif arglen==2:
 *             self.x = args[0]
 *             self.y = args[1]             # <<<<<<<<<<<<<<
 *             self.z = 0.0
 * 
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":194
 *             self.x = args[0]
 *             self.y = args[1]
 *             self.z = 0.0             # <<<<<<<<<<<<<<
 * 
 *         elif arglen==3:
 */
    __pyx_v_self->z = 0.0;
    break;

    /* "cgtypes.pyx":196
 *             self.z = 0.0
 * 
 *         elif arglen==3:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
    case 3:

    /* "cgtypes.pyx":197
 * 
 *         elif arglen==3:
 *             self.x = args[0]             # <<<<<<<<<<<<<<
 *             self.y = args[1]
 *             self.z = args[2]
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":198
 *         elif arglen==3:
 *             self.x = args[0]
 *             self.y = args[1]             # <<<<<<<<<<<<<<
 *             self.z = args[2]
 * 
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":199
 *             self.x = args[0]
 *             self.y = args[1]
 *             self.z = args[2]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->z = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":202
 * 
 *         else:
 *             raise TypeError, "vec3() takes at most 3 arguments"             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec3_takes_at_most_3_arguments, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":108
 *     cdef double x,y,z
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.vec3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":204
 *             raise TypeError, "vec3() takes at most 3 arguments"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_vec3construct, (self.x, self.y, self.z))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_2__reduce__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_2__reduce__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cgtypes.pyx":205
 * 
 *     def __reduce__(self):
 *         return (_vec3construct, (self.x, self.y, self.z))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vec3construct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":204
 *             raise TypeError, "vec3() takes at most 3 arguments"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_vec3construct, (self.x, self.y, self.z))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec3.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":207
 *         return (_vec3construct, (self.x, self.y, self.z))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'vec3(%s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_4__repr__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_4__repr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cgtypes.pyx":208
 * 
 *     def __repr__(self):
 *         return 'vec3(%s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_vec3_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":207
 *         return (_vec3construct, (self.x, self.y, self.z))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'vec3(%s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.vec3.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":210
 *         return 'vec3(%s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_6__str__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_6__str__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cgtypes.pyx":211
 * 
 *     def __str__(self):
 *         return "(%1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_1_4f_1_4f_1_4f, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":210
 *         return 'vec3(%s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.vec3.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":213
 *         return "(%1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return vec3iter(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_8__iter__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_8__iter__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":214
 * 
 *     def __iter__(self):
 *         return vec3iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(a,b,op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3iter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":213
 *         return "(%1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return vec3iter(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":216
 *         return vec3iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef vec3 va, vb
 *         cdef int cop
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec3.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4vec3_10__richcmp__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b), ((PyObject *)__pyx_v_op));

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vb = 0;
  int __pyx_v_cop;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cgtypes.pyx":220
 *         cdef int cop
 * 
 *         cop = op             # <<<<<<<<<<<<<<
 * 
 *         ta = type(a)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_op); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cop = __pyx_t_1;

  /* "cgtypes.pyx":222
 *         cop = op
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 *         if (ta!=vec3 or tb!=vec3):
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":223
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 *         if (ta!=vec3 or tb!=vec3):
 *             if cop==3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":224
 *         ta = type(a)
 *         tb = type(b)
 *         if (ta!=vec3 or tb!=vec3):             # <<<<<<<<<<<<<<
 *             if cop==3:
 *                 return 1
 */
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":225
 *         tb = type(b)
 *         if (ta!=vec3 or tb!=vec3):
 *             if cop==3:             # <<<<<<<<<<<<<<
 *                 return 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cop == 3) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":226
 *         if (ta!=vec3 or tb!=vec3):
 *             if cop==3:
 *                 return 1             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cgtypes.pyx":228
 *                 return 1
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *         va = a
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
    }
  }

  /* "cgtypes.pyx":230
 *                 return 0
 * 
 *         va = a             # <<<<<<<<<<<<<<
 *         vb = b
 * 
 */
  if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_a;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_va = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":231
 * 
 *         va = a
 *         vb = b             # <<<<<<<<<<<<<<
 * 
 *         # <
 */
  if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_b;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":251
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z)
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z)
 *         # sonst (Fehler)
 */
  switch (__pyx_v_cop) {

    /* "cgtypes.pyx":234
 * 
 *         # <
 *         if cop==0:             # <<<<<<<<<<<<<<
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z)
 *         # <=
 */
    case 0:

    /* "cgtypes.pyx":235
 *         # <
 *         if cop==0:
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z)             # <<<<<<<<<<<<<<
 *         # <=
 *         elif cop==1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_va->x < __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->y < __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->z < __pyx_v_vb->z);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":237
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z)
 *         # <=
 *         elif cop==1:             # <<<<<<<<<<<<<<
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z)
 *         # ==
 */
    case 1:

    /* "cgtypes.pyx":238
 *         # <=
 *         elif cop==1:
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z)             # <<<<<<<<<<<<<<
 *         # ==
 *         elif cop==2:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((__pyx_v_va->x - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->y - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->z - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->z);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L10_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":240
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z)
 *         # ==
 *         elif cop==2:             # <<<<<<<<<<<<<<
 * #            return (va.x==vb.x and va.y==vb.y and va.z==vb.z)
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)
 */
    case 2:

    /* "cgtypes.pyx":242
 *         elif cop==2:
 * #            return (va.x==vb.x and va.y==vb.y and va.z==vb.z)
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)             # <<<<<<<<<<<<<<
 *         # !=
 *         elif cop==3:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) <= __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L13_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":244
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)
 *         # !=
 *         elif cop==3:             # <<<<<<<<<<<<<<
 * #            return (va.x!=vb.x or va.y!=vb.y or va.z!=vb.z)
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)
 */
    case 3:

    /* "cgtypes.pyx":246
 *         elif cop==3:
 * #            return (va.x!=vb.x or va.y!=vb.y or va.z!=vb.z)
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)             # <<<<<<<<<<<<<<
 *         # >
 *         elif cop==4:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) > __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) > __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L16_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":248
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)
 *         # >
 *         elif cop==4:             # <<<<<<<<<<<<<<
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z)
 *         # >=
 */
    case 4:

    /* "cgtypes.pyx":249
 *         # >
 *         elif cop==4:
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z)             # <<<<<<<<<<<<<<
 *         # >=
 *         elif cop==5:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_va->x > __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->y > __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->z > __pyx_v_vb->z);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L19_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":251
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z)
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z)
 *         # sonst (Fehler)
 */
    case 5:

    /* "cgtypes.pyx":252
 *         # >=
 *         elif cop==5:
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z)             # <<<<<<<<<<<<<<
 *         # sonst (Fehler)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((__pyx_v_va->x + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L22_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->y + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L22_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->z + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->z);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L22_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":255
 *         # sonst (Fehler)
 *         else:
 *             raise ValueError,"internal error: illegal rich comparison number"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_internal_error_illegal_rich_comp, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":216
 *         return vec3iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef vec3 va, vb
 *         cdef int cop
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec3.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":258
 * 
 * 
 *     def __add__(vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         """Vector addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_12__add__[] = "Vector addition.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a+b\n        (0.7000, 1.2500, -1.3000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_12__add__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_vec3, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_12__add__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_12__add__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cgtypes.pyx":267
 *         """
 *         cdef vec3 res
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":268
 *         cdef vec3 res
 *         res = vec3()
 *         res.x = a.x+b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x + __pyx_v_b->x);

  /* "cgtypes.pyx":269
 *         res = vec3()
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z+b.z
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_a->y + __pyx_v_b->y);

  /* "cgtypes.pyx":270
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_a->z + __pyx_v_b->z);

  /* "cgtypes.pyx":271
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(vec3 a, vec3 b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":258
 * 
 * 
 *     def __add__(vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         """Vector addition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":273
 *         return res
 * 
 *     def __sub__(vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         """Vector subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_14__sub__[] = "Vector subtraction.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a-b\n        (1.3000, -0.2500, -2.3000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_14__sub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_vec3, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_14__sub__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_14__sub__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cgtypes.pyx":282
 *         """
 *         cdef vec3 res
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":283
 *         cdef vec3 res
 *         res = vec3()
 *         res.x = a.x-b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x - __pyx_v_b->x);

  /* "cgtypes.pyx":284
 *         res = vec3()
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z-b.z
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_a->y - __pyx_v_b->y);

  /* "cgtypes.pyx":285
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_a->z - __pyx_v_b->z);

  /* "cgtypes.pyx":286
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":273
 *         return res
 * 
 *     def __sub__(vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         """Vector subtraction.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":288
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication with a scalar or dot product.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_16__mul__[] = "Multiplication with a scalar or dot product.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a*2.0\n        (2.0000, 1.0000, -3.6000)\n        >>> print 2.0*a\n        (2.0000, 1.0000, -3.6000)\n        >>> print a*b\n        -0.825\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_16__mul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_16__mul__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cgtypes.pyx":303
 *         cdef double r
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 * 
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":304
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if ta==vec3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":306
 *         tb = type(b)
 * 
 *         if ta==vec3:             # <<<<<<<<<<<<<<
 *             va = a
 *             if tb==vec3:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":307
 * 
 *         if ta==vec3:
 *             va = a             # <<<<<<<<<<<<<<
 *             if tb==vec3:
 *                 # vec3*vec3   (dot product a*b)
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_va = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":308
 *         if ta==vec3:
 *             va = a
 *             if tb==vec3:             # <<<<<<<<<<<<<<
 *                 # vec3*vec3   (dot product a*b)
 *                 vb = b
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":310
 *             if tb==vec3:
 *                 # vec3*vec3   (dot product a*b)
 *                 vb = b             # <<<<<<<<<<<<<<
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z
 *             elif tb==float or tb==int or tb==long:
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":311
 *                 # vec3*vec3   (dot product a*b)
 *                 vb = b
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z             # <<<<<<<<<<<<<<
 *             elif tb==float or tb==int or tb==long:
 *                 # vec3*scalar
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble((((__pyx_v_va->x * __pyx_v_vb->x) + (__pyx_v_va->y * __pyx_v_vb->y)) + (__pyx_v_va->z * __pyx_v_vb->z))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":312
 *                 vb = b
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z
 *             elif tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *                 # vec3*scalar
 *                 res = vec3()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":314
 *             elif tb==float or tb==int or tb==long:
 *                 # vec3*scalar
 *                 res = vec3()             # <<<<<<<<<<<<<<
 *                 r   = b
 *                 res.x = va.x*r
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":315
 *                 # vec3*scalar
 *                 res = vec3()
 *                 r   = b             # <<<<<<<<<<<<<<
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":316
 *                 res = vec3()
 *                 r   = b
 *                 res.x = va.x*r             # <<<<<<<<<<<<<<
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 */
      __pyx_v_res->x = (__pyx_v_va->x * __pyx_v_r);

      /* "cgtypes.pyx":317
 *                 r   = b
 *                 res.x = va.x*r
 *                 res.y = va.y*r             # <<<<<<<<<<<<<<
 *                 res.z = va.z*r
 *                 return res
 */
      __pyx_v_res->y = (__pyx_v_va->y * __pyx_v_r);

      /* "cgtypes.pyx":318
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 *                 res.z = va.z*r             # <<<<<<<<<<<<<<
 *                 return res
 *             elif tb==mat3:
 */
      __pyx_v_res->z = (__pyx_v_va->z * __pyx_v_r);

      /* "cgtypes.pyx":319
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 *                 return res             # <<<<<<<<<<<<<<
 *             elif tb==mat3:
 *                 # vec3*mat3
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":320
 *                 res.z = va.z*r
 *                 return res
 *             elif tb==mat3:             # <<<<<<<<<<<<<<
 *                 # vec3*mat3
 *                 return b.__rmul__(a)
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":322
 *             elif tb==mat3:
 *                 # vec3*mat3
 *                 return b.__rmul__(a)             # <<<<<<<<<<<<<<
 *             elif tb==mat4:
 *                 # vec3*mat4
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_rmul); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_a);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_a);
        __Pyx_GIVEREF(__pyx_v_a);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":323
 *                 # vec3*mat3
 *                 return b.__rmul__(a)
 *             elif tb==mat4:             # <<<<<<<<<<<<<<
 *                 # vec3*mat4
 *                 return b.__rmul__(a)
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":325
 *             elif tb==mat4:
 *                 # vec3*mat4
 *                 return b.__rmul__(a)             # <<<<<<<<<<<<<<
 * 
 *         elif ta==float or ta==int or ta==long:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_rmul); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_a);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_a);
        __Pyx_GIVEREF(__pyx_v_a);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":327
 *                 return b.__rmul__(a)
 * 
 *         elif ta==float or ta==int or ta==long:             # <<<<<<<<<<<<<<
 *             if tb==vec3:
 *                 # scalar*vec3
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":328
 * 
 *         elif ta==float or ta==int or ta==long:
 *             if tb==vec3:             # <<<<<<<<<<<<<<
 *                 # scalar*vec3
 *                 res = vec3()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":330
 *             if tb==vec3:
 *                 # scalar*vec3
 *                 res = vec3()             # <<<<<<<<<<<<<<
 *                 vb  = b
 *                 r   = a
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":331
 *                 # scalar*vec3
 *                 res = vec3()
 *                 vb  = b             # <<<<<<<<<<<<<<
 *                 r   = a
 *                 res.x = r*vb.x
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":332
 *                 res = vec3()
 *                 vb  = b
 *                 r   = a             # <<<<<<<<<<<<<<
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_a); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":333
 *                 vb  = b
 *                 r   = a
 *                 res.x = r*vb.x             # <<<<<<<<<<<<<<
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 */
      __pyx_v_res->x = (__pyx_v_r * __pyx_v_vb->x);

      /* "cgtypes.pyx":334
 *                 r   = a
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y             # <<<<<<<<<<<<<<
 *                 res.z = r*vb.z
 *                 return res
 */
      __pyx_v_res->y = (__pyx_v_r * __pyx_v_vb->y);

      /* "cgtypes.pyx":335
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z             # <<<<<<<<<<<<<<
 *                 return res
 * 
 */
      __pyx_v_res->z = (__pyx_v_r * __pyx_v_vb->z);

      /* "cgtypes.pyx":336
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 *                 return res             # <<<<<<<<<<<<<<
 * 
 *         raise TypeError, "unsupported operand type for *"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":338
 *                 return res
 * 
 *         raise TypeError, "unsupported operand type for *"             # <<<<<<<<<<<<<<
 * 
 *     def __div__(vec3 a, b):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":288
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication with a scalar or dot product.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.vec3.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":340
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(vec3 a, b):             # <<<<<<<<<<<<<<
 *         """Division by scalar
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4vec3_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_18__div__[] = "Division by scalar\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a/2.0\n        (0.5000, 0.2500, -0.9000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_18__div__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_18__div__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec3_18__div__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cgtypes.pyx":350
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":352
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec3/scalar
 *             res = vec3()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":354
 *         if tb==float or tb==int or tb==long:
 *             # vec3/scalar
 *             res = vec3()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":355
 *             # vec3/scalar
 *             res = vec3()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":356
 *             res = vec3()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 division"
 *             res.x = a.x/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":357
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"             # <<<<<<<<<<<<<<
 *             res.x = a.x/r
 *             res.y = a.y/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":358
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"
 *             res.x = a.x/r             # <<<<<<<<<<<<<<
 *             res.y = a.y/r
 *             res.z = a.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->x = (__pyx_v_a->x / __pyx_v_r);

    /* "cgtypes.pyx":359
 *                 raise ZeroDivisionError,"vec3 division"
 *             res.x = a.x/r
 *             res.y = a.y/r             # <<<<<<<<<<<<<<
 *             res.z = a.z/r
 *             return res
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->y = (__pyx_v_a->y / __pyx_v_r);

    /* "cgtypes.pyx":360
 *             res.x = a.x/r
 *             res.y = a.y/r
 *             res.z = a.z/r             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->z = (__pyx_v_a->z / __pyx_v_r);

    /* "cgtypes.pyx":361
 *             res.y = a.y/r
 *             res.z = a.z/r
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":363
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for /"             # <<<<<<<<<<<<<<
 * 
 *     def __mod__(vec3 self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_2, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":340
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(vec3 a, b):             # <<<<<<<<<<<<<<
 *         """Division by scalar
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":365
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(vec3 self, b):             # <<<<<<<<<<<<<<
 *         """Modulo (component wise).
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_20__mod__[] = "Modulo (component wise).\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print a%2.0\n        (1.0000, 0.5000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_20__mod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mod__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_7cgtypes_vec3, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_20__mod__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_20__mod__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mod__", 0);

  /* "cgtypes.pyx":375
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":377
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec3%scalar
 *             res = vec3()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":379
 *         if tb==float or tb==int or tb==long:
 *             # vec3%scalar
 *             res = vec3()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":380
 *             # vec3%scalar
 *             res = vec3()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":381
 *             res = vec3()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x,r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":382
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"             # <<<<<<<<<<<<<<
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":383
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x,r)             # <<<<<<<<<<<<<<
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)
 */
    __pyx_v_res->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_r);

    /* "cgtypes.pyx":384
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)             # <<<<<<<<<<<<<<
 *             res.z = _fmod(self.z,r)
 *             return res
 */
    __pyx_v_res->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_r);

    /* "cgtypes.pyx":385
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)             # <<<<<<<<<<<<<<
 *             return res
 *         elif tb==vec3:
 */
    __pyx_v_res->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_r);

    /* "cgtypes.pyx":386
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)
 *             return res             # <<<<<<<<<<<<<<
 *         elif tb==vec3:
 *             # vec3%vec3
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":387
 *             res.z = _fmod(self.z,r)
 *             return res
 *         elif tb==vec3:             # <<<<<<<<<<<<<<
 *             # vec3%vec3
 *             res = vec3()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":389
 *         elif tb==vec3:
 *             # vec3%vec3
 *             res = vec3()             # <<<<<<<<<<<<<<
 *             vb = b
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":390
 *             # vec3%vec3
 *             res = vec3()
 *             vb = b             # <<<<<<<<<<<<<<
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":391
 *             res = vec3()
 *             vb = b
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x, vb.x)
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->x) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->y) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->z) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":392
 *             vb = b
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"             # <<<<<<<<<<<<<<
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":393
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x, vb.x)             # <<<<<<<<<<<<<<
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)
 */
    __pyx_v_res->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_vb->x);

    /* "cgtypes.pyx":394
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)             # <<<<<<<<<<<<<<
 *             res.z = _fmod(self.z, vb.z)
 *             return res
 */
    __pyx_v_res->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_vb->y);

    /* "cgtypes.pyx":395
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    __pyx_v_res->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_vb->z);

    /* "cgtypes.pyx":396
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":398
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for %"             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_3, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":365
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(vec3 self, b):             # <<<<<<<<<<<<<<
 *         """Modulo (component wise).
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":400
 *             raise TypeError, "unsupported operand type for %"
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_23__neg__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_22__neg__[] = "Negation\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print -a\n        (-3.0000, -2.5000, 1.8000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_22__neg__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_23__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_22__neg__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_22__neg__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cgtypes.pyx":408
 *         """
 *         cdef vec3 res
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         res.x = -self.x
 *         res.y = -self.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":409
 *         cdef vec3 res
 *         res = vec3()
 *         res.x = -self.x             # <<<<<<<<<<<<<<
 *         res.y = -self.y
 *         res.z = -self.z
 */
  __pyx_v_res->x = (-__pyx_v_self->x);

  /* "cgtypes.pyx":410
 *         res = vec3()
 *         res.x = -self.x
 *         res.y = -self.y             # <<<<<<<<<<<<<<
 *         res.z = -self.z
 *         return res
 */
  __pyx_v_res->y = (-__pyx_v_self->y);

  /* "cgtypes.pyx":411
 *         res.x = -self.x
 *         res.y = -self.y
 *         res.z = -self.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (-__pyx_v_self->z);

  /* "cgtypes.pyx":412
 *         res.y = -self.y
 *         res.z = -self.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":400
 *             raise TypeError, "unsupported operand type for %"
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":414
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> a=vec3(3.0, 2.5, -1.8)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_25__pos__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_24__pos__[] = "\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> print +a\n        (3.0000, 2.5000, -1.8000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_24__pos__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_25__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_24__pos__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_24__pos__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "cgtypes.pyx":421
 *         """
 *         cdef vec3 res
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         res.x = self.x
 *         res.y = self.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":422
 *         cdef vec3 res
 *         res = vec3()
 *         res.x = self.x             # <<<<<<<<<<<<<<
 *         res.y = self.y
 *         res.z = self.z
 */
  __pyx_t_2 = __pyx_v_self->x;
  __pyx_v_res->x = __pyx_t_2;

  /* "cgtypes.pyx":423
 *         res = vec3()
 *         res.x = self.x
 *         res.y = self.y             # <<<<<<<<<<<<<<
 *         res.z = self.z
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->y;
  __pyx_v_res->y = __pyx_t_2;

  /* "cgtypes.pyx":424
 *         res.x = self.x
 *         res.y = self.y
 *         res.z = self.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->z;
  __pyx_v_res->z = __pyx_t_2;

  /* "cgtypes.pyx":425
 *         res.y = self.y
 *         res.z = self.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":414
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> a=vec3(3.0, 2.5, -1.8)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":428
 * 
 * 
 *     def __iadd__(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Inline vector addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_26__iadd__[] = "Inline vector addition.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> a+=b\n        >>> print a\n        (0.7000, 1.2500, -1.3000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_26__iadd__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_26__iadd__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_26__iadd__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "cgtypes.pyx":437
 *         (0.7000, 1.2500, -1.3000)
 *         """
 *         self.x=self.x+other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x + __pyx_v_other->x);

  /* "cgtypes.pyx":438
 *         """
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z+other.z
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_self->y + __pyx_v_other->y);

  /* "cgtypes.pyx":439
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_self->z + __pyx_v_other->z);

  /* "cgtypes.pyx":440
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, vec3 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":428
 * 
 * 
 *     def __iadd__(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Inline vector addition.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":442
 *         return self
 * 
 *     def __isub__(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Inline vector subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_28__isub__[] = "Inline vector subtraction.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> a-=b\n        >>> print a\n        (1.3000, -0.2500, -2.3000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_28__isub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_28__isub__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_28__isub__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "cgtypes.pyx":451
 *         (1.3000, -0.2500, -2.3000)
 *         """
 *         self.x=self.x-other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x - __pyx_v_other->x);

  /* "cgtypes.pyx":452
 *         """
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z-other.z
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_self->y - __pyx_v_other->y);

  /* "cgtypes.pyx":453
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_self->z - __pyx_v_other->z);

  /* "cgtypes.pyx":454
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":442
 *         return self
 * 
 *     def __isub__(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Inline vector subtraction.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":456
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (only with scalar)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_30__imul__[] = "Inline multiplication (only with scalar)\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> a*=2.0\n        >>> print a\n        (2.0000, 1.0000, -3.6000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_30__imul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_30__imul__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_30__imul__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "cgtypes.pyx":465
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":466
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             self.x=self.x*r
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":467
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             self.x=self.x*r
 *             self.y=self.y*r
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":468
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             self.x=self.x*r             # <<<<<<<<<<<<<<
 *             self.y=self.y*r
 *             self.z=self.z*r
 */
    __pyx_v_self->x = (__pyx_v_self->x * __pyx_v_r);

    /* "cgtypes.pyx":469
 *             r=other
 *             self.x=self.x*r
 *             self.y=self.y*r             # <<<<<<<<<<<<<<
 *             self.z=self.z*r
 *             return self
 */
    __pyx_v_self->y = (__pyx_v_self->y * __pyx_v_r);

    /* "cgtypes.pyx":470
 *             self.x=self.x*r
 *             self.y=self.y*r
 *             self.z=self.z*r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->z = (__pyx_v_self->z * __pyx_v_r);

    /* "cgtypes.pyx":471
 *             self.y=self.y*r
 *             self.z=self.z*r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for *="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":473
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for *="             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_4, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":456
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (only with scalar)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":475
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4vec3_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_32__idiv__[] = "Inline division with scalar\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> a/=2.0\n        >>> print a\n        (0.5000, 0.2500, -0.9000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_32__idiv__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_32__idiv__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec3_32__idiv__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "cgtypes.pyx":484
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":485
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":486
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":487
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 division"
 *             self.x=self.x/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":488
 *             r=other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"             # <<<<<<<<<<<<<<
 *             self.x=self.x/r
 *             self.y=self.y/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":489
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 division"
 *             self.x=self.x/r             # <<<<<<<<<<<<<<
 *             self.y=self.y/r
 *             self.z=self.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->x = (__pyx_v_self->x / __pyx_v_r);

    /* "cgtypes.pyx":490
 *                 raise ZeroDivisionError,"vec3 division"
 *             self.x=self.x/r
 *             self.y=self.y/r             # <<<<<<<<<<<<<<
 *             self.z=self.z/r
 *             return self
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->y = (__pyx_v_self->y / __pyx_v_r);

    /* "cgtypes.pyx":491
 *             self.x=self.x/r
 *             self.y=self.y/r
 *             self.z=self.z/r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->z = (__pyx_v_self->z / __pyx_v_r);

    /* "cgtypes.pyx":492
 *             self.y=self.y/r
 *             self.z=self.z/r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":494
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for /="             # <<<<<<<<<<<<<<
 * 
 *     def __imod__(self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_5, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":475
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":496
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_34__imod__[] = "Inline modulo.\n\n        >>> a=vec3(3.0, 2.5, -1.8)\n        >>> a%=2.0\n        >>> print a\n        (1.0000, 0.5000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_34__imod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imod__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_34__imod__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_34__imod__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imod__", 0);

  /* "cgtypes.pyx":507
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":509
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec3%=scalar
 *             r = b
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":511
 *         if tb==float or tb==int or tb==long:
 *             # vec3%=scalar
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":512
 *             # vec3%=scalar
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x,r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":513
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"             # <<<<<<<<<<<<<<
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":514
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x,r)             # <<<<<<<<<<<<<<
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)
 */
    __pyx_v_self->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_r);

    /* "cgtypes.pyx":515
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)             # <<<<<<<<<<<<<<
 *             self.z = _fmod(self.z,r)
 *             return self
 */
    __pyx_v_self->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_r);

    /* "cgtypes.pyx":516
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==vec3:
 */
    __pyx_v_self->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_r);

    /* "cgtypes.pyx":517
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==vec3:
 *             # vec3%=vec3
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":518
 *             self.z = _fmod(self.z,r)
 *             return self
 *         elif tb==vec3:             # <<<<<<<<<<<<<<
 *             # vec3%=vec3
 *             vb = b
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":520
 *         elif tb==vec3:
 *             # vec3%=vec3
 *             vb = b             # <<<<<<<<<<<<<<
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":521
 *             # vec3%=vec3
 *             vb = b
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x, vb.x)
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->x) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->y) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->z) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":522
 *             vb = b
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"             # <<<<<<<<<<<<<<
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":523
 *             if fabs(vb.x)<=eps or fabs(vb.y)<=eps or fabs(vb.z)<=eps:
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x, vb.x)             # <<<<<<<<<<<<<<
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)
 */
    __pyx_v_self->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_vb->x);

    /* "cgtypes.pyx":524
 *                 raise ZeroDivisionError,"vec3 modulo"
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)             # <<<<<<<<<<<<<<
 *             self.z = _fmod(self.z, vb.z)
 *             return self
 */
    __pyx_v_self->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_vb->y);

    /* "cgtypes.pyx":525
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_vb->z);

    /* "cgtypes.pyx":526
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":528
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for %="             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_6, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":496
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__imod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":531
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_37__abs__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_36__abs__[] = "Return the length of the vector.\n\n        abs(v) is equivalent to v.length().\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print abs(a)\n        2.11896201004\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_36__abs__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_37__abs__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_36__abs__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_36__abs__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__abs__", 0);

  /* "cgtypes.pyx":541
 *         """
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z             # <<<<<<<<<<<<<<
 *         return sqrt(a)
 * 
 */
  __pyx_v_a = (((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z));

  /* "cgtypes.pyx":542
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z
 *         return sqrt(a)             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":531
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":544
 *         return sqrt(a)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             return self.x
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_39__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_39__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_38__getattr__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_38__getattr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "cgtypes.pyx":545
 * 
 *     def __getattr__(self, name):
 *         if name=="x":             # <<<<<<<<<<<<<<
 *             return self.x
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":546
 *     def __getattr__(self, name):
 *         if name=="x":
 *             return self.x             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             return self.y
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":547
 *         if name=="x":
 *             return self.x
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             return self.y
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":548
 *             return self.x
 *         elif name=="y":
 *             return self.y             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             return self.z
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":549
 *         elif name=="y":
 *             return self.y
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             return self.z
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":550
 *             return self.y
 *         elif name=="z":
 *             return self.z             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"vec3 has no attribute '"+name+"'"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":552
 *             return self.z
 *         else:
 *             raise AttributeError,"vec3 has no attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 *     def __setattr__(self, name, val):
 */
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_vec3_has_no_attribute, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":544
 *         return sqrt(a)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             return self.x
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.vec3.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":554
 *             raise AttributeError,"vec3 has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             self.x = val
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec3_41__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /*proto*/
static int __pyx_pw_7cgtypes_4vec3_41__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_40__setattr__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_val));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec3_40__setattr__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "cgtypes.pyx":555
 * 
 *     def __setattr__(self, name, val):
 *         if name=="x":             # <<<<<<<<<<<<<<
 *             self.x = val
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":556
 *     def __setattr__(self, name, val):
 *         if name=="x":
 *             self.x = val             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             self.y = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->x = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":557
 *         if name=="x":
 *             self.x = val
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             self.y = val
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":558
 *             self.x = val
 *         elif name=="y":
 *             self.y = val             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             self.z = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->y = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":559
 *         elif name=="y":
 *             self.y = val
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             self.z = val
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":560
 *             self.y = val
 *         elif name=="z":
 *             self.z = val             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"vec3 has no writable attribute '"+name+"'"
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->z = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":562
 *             self.z = val
 *         else:
 *             raise AttributeError,"vec3 has no writable attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __pyx_t_3 = PyNumber_Add(__pyx_kp_s_vec3_has_no_writable_attribute, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":554
 *             raise AttributeError,"vec3 has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             self.x = val
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.vec3.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":564
 *             raise AttributeError,"vec3 has no writable attribute '"+name+"'"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 3)"""
 *         return 3
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7cgtypes_4vec3_43__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_42__len__[] = "Length of the sequence (always 3)";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_42__len__;
#endif
static Py_ssize_t __pyx_pw_7cgtypes_4vec3_43__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_42__len__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_7cgtypes_4vec3_42__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "cgtypes.pyx":566
 *     def __len__(self):
 *         """Length of the sequence (always 3)"""
 *         return 3             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(vec3 self, key):
 */
  __pyx_r = 3;
  goto __pyx_L0;

  /* "cgtypes.pyx":564
 *             raise AttributeError,"vec3 has no writable attribute '"+name+"'"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 3)"""
 *         return 3
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":568
 *         return 3
 * 
 *     def __getitem__(vec3 self, key):             # <<<<<<<<<<<<<<
 *         """Return a component by index (0-based)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_45__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_44__getitem__[] = "Return a component by index (0-based)\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a[0]\n        1.0\n        >>> print a[1]\n        0.5\n        >>> print a[2]\n        -1.8\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_44__getitem__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec3_45__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_44__getitem__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_44__getitem__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_k;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "cgtypes.pyx":581
 *         cdef int k
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":582
 * 
 *         T=type(key)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError, "index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":583
 *         T=type(key)
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         k = key
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":585
 *             raise TypeError, "index must be integer"
 * 
 *         k = key             # <<<<<<<<<<<<<<
 *         if   k==0: return self.x
 *         elif k==1: return self.y
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_4;

  /* "cgtypes.pyx":588
 *         if   k==0: return self.x
 *         elif k==1: return self.y
 *         elif k==2: return self.z             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
  switch (__pyx_v_k) {

    /* "cgtypes.pyx":586
 * 
 *         k = key
 *         if   k==0: return self.x             # <<<<<<<<<<<<<<
 *         elif k==1: return self.y
 *         elif k==2: return self.z
 */
    case 0:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":587
 *         k = key
 *         if   k==0: return self.x
 *         elif k==1: return self.y             # <<<<<<<<<<<<<<
 *         elif k==2: return self.z
 *         else:
 */
    case 1:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":588
 *         if   k==0: return self.x
 *         elif k==1: return self.y
 *         elif k==2: return self.z             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
    case 2:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":590
 *         elif k==2: return self.z
 *         else:
 *             raise IndexError,"index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":568
 *         return 3
 * 
 *     def __getitem__(vec3 self, key):             # <<<<<<<<<<<<<<
 *         """Return a component by index (0-based)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":592
 *             raise IndexError,"index out of range"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a component by index (0-based)
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec3_47__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_46__setitem__[] = "Set a component by index (0-based)\n\n        >>> a=vec3()\n        >>> a[0]=1.5; a[1]=0.7; a[2]=-0.3\n        >>> print a\n        (1.5000, 0.7000, -0.3000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec3_46__setitem__;
#endif
static int __pyx_pw_7cgtypes_4vec3_47__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_46__setitem__(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec3_46__setitem__(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_v_k;
  PyObject *__pyx_v_T = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "cgtypes.pyx":602
 *         cdef int k
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":603
 * 
 *         T=type(key)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError, "index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":604
 *         T=type(key)
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         k = key
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":606
 *             raise TypeError, "index must be integer"
 * 
 *         k = key             # <<<<<<<<<<<<<<
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_4;

  /* "cgtypes.pyx":609
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
  switch (__pyx_v_k) {

    /* "cgtypes.pyx":607
 * 
 *         k = key
 *         if   k==0: self.x = value             # <<<<<<<<<<<<<<
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value
 */
    case 0:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->x = __pyx_t_5;
    break;

    /* "cgtypes.pyx":608
 *         k = key
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value             # <<<<<<<<<<<<<<
 *         elif k==2: self.z = value
 *         else:
 */
    case 1:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->y = __pyx_t_5;
    break;

    /* "cgtypes.pyx":609
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
    case 2:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->z = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":611
 *         elif k==2: self.z = value
 *         else:
 *             raise IndexError,"index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def cross(self, vec3 other):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":592
 *             raise IndexError,"index out of range"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a component by index (0-based)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":613
 *             raise IndexError,"index out of range"
 * 
 *     def cross(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Cross product.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_49cross(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_48cross[] = "Cross product.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> c=a.cross(b)\n        >>> print c\n        (1.6000, 0.0400, 0.9000)\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_49cross(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cross (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_48cross(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_48cross(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("cross", 0);

  /* "cgtypes.pyx":624
 *         cdef vec3 res
 * 
 *         if type(other)==vec3:             # <<<<<<<<<<<<<<
 *             res = vec3()
 *             res.x = self.y*other.z-self.z*other.y
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_other))), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":625
 * 
 *         if type(other)==vec3:
 *             res = vec3()             # <<<<<<<<<<<<<<
 *             res.x = self.y*other.z-self.z*other.y
 *             res.y = self.z*other.x-self.x*other.z
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":626
 *         if type(other)==vec3:
 *             res = vec3()
 *             res.x = self.y*other.z-self.z*other.y             # <<<<<<<<<<<<<<
 *             res.y = self.z*other.x-self.x*other.z
 *             res.z = self.x*other.y-self.y*other.x
 */
    __pyx_v_res->x = ((__pyx_v_self->y * __pyx_v_other->z) - (__pyx_v_self->z * __pyx_v_other->y));

    /* "cgtypes.pyx":627
 *             res = vec3()
 *             res.x = self.y*other.z-self.z*other.y
 *             res.y = self.z*other.x-self.x*other.z             # <<<<<<<<<<<<<<
 *             res.z = self.x*other.y-self.y*other.x
 *             return res
 */
    __pyx_v_res->y = ((__pyx_v_self->z * __pyx_v_other->x) - (__pyx_v_self->x * __pyx_v_other->z));

    /* "cgtypes.pyx":628
 *             res.x = self.y*other.z-self.z*other.y
 *             res.y = self.z*other.x-self.x*other.z
 *             res.z = self.x*other.y-self.y*other.x             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    __pyx_v_res->z = ((__pyx_v_self->x * __pyx_v_other->y) - (__pyx_v_self->y * __pyx_v_other->x));

    /* "cgtypes.pyx":629
 *             res.y = self.z*other.x-self.x*other.z
 *             res.z = self.x*other.y-self.y*other.x
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for cross()"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":631
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for cross()"             # <<<<<<<<<<<<<<
 * 
 *     def length(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_cro, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":613
 *             raise IndexError,"index out of range"
 * 
 *     def cross(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Cross product.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.cross", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":633
 *             raise TypeError, "unsupported operand type for cross()"
 * 
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_51length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_50length[] = "Return the length of the vector.\n\n        v.length() is equivalent to abs(v).\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a.length()\n        2.11896201004\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_51length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("length (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_50length(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_50length(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("length", 0);

  /* "cgtypes.pyx":643
 *         """
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z             # <<<<<<<<<<<<<<
 *         return sqrt(a)
 * 
 */
  __pyx_v_a = (((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z));

  /* "cgtypes.pyx":644
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z
 *         return sqrt(a)             # <<<<<<<<<<<<<<
 * 
 *     def normalize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":633
 *             raise TypeError, "unsupported operand type for cross()"
 * 
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":646
 *         return sqrt(a)
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_53normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_52normalize[] = "Return normalized vector.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> print a.normalize()\n        (0.4719, 0.2360, -0.8495)\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_53normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_52normalize(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_52normalize(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  double __pyx_v_nlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "cgtypes.pyx":656
 *         cdef double nlen
 * 
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)             # <<<<<<<<<<<<<<
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 */
  __pyx_v_nlen = sqrt((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)));

  /* "cgtypes.pyx":657
 * 
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         if nlen<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 */
  __pyx_t_1 = ((__pyx_v_nlen <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":658
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"             # <<<<<<<<<<<<<<
 *         nlen = 1.0/nlen
 *         res = vec3()
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_null_vector_can_t_be_normalized, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":659
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen             # <<<<<<<<<<<<<<
 *         res = vec3()
 *         res.x = self.x*nlen
 */
  if (unlikely(__pyx_v_nlen == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nlen = (1.0 / __pyx_v_nlen);

  /* "cgtypes.pyx":660
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":661
 *         nlen = 1.0/nlen
 *         res = vec3()
 *         res.x = self.x*nlen             # <<<<<<<<<<<<<<
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 */
  __pyx_v_res->x = (__pyx_v_self->x * __pyx_v_nlen);

  /* "cgtypes.pyx":662
 *         res = vec3()
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen             # <<<<<<<<<<<<<<
 *         res.z = self.z*nlen
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_self->y * __pyx_v_nlen);

  /* "cgtypes.pyx":663
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_self->z * __pyx_v_nlen);

  /* "cgtypes.pyx":664
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def angle(self, vec3 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":646
 *         return sqrt(a)
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec3.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":666
 *         return res
 * 
 *     def angle(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Return angle (in radians) between self and other.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_55angle(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_54angle[] = "Return angle (in radians) between self and other.\n\n        >>> a=vec3(1.0, 0.5, -1.8)\n        >>> b=vec3(-0.3, 0.75, 0.5)\n        >>> print a.angle(b)\n        1.99306755584\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_55angle(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("angle (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_54angle(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_54angle(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_other) {
  double __pyx_v_a;
  double __pyx_v_ls;
  double __pyx_v_lo;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("angle", 0);

  /* "cgtypes.pyx":677
 *         cdef double a, ls, lo
 * 
 *         ls = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)             # <<<<<<<<<<<<<<
 *         lo = sqrt(other.x*other.x + other.y*other.y + other.z*other.z)
 *         a  = ls*lo
 */
  __pyx_v_ls = sqrt((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)));

  /* "cgtypes.pyx":678
 * 
 *         ls = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         lo = sqrt(other.x*other.x + other.y*other.y + other.z*other.z)             # <<<<<<<<<<<<<<
 *         a  = ls*lo
 *         if a<=eps:
 */
  __pyx_v_lo = sqrt((((__pyx_v_other->x * __pyx_v_other->x) + (__pyx_v_other->y * __pyx_v_other->y)) + (__pyx_v_other->z * __pyx_v_other->z)));

  /* "cgtypes.pyx":679
 *         ls = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         lo = sqrt(other.x*other.x + other.y*other.y + other.z*other.z)
 *         a  = ls*lo             # <<<<<<<<<<<<<<
 *         if a<=eps:
 *             raise ZeroDivisionError,"angle(): null vector can't be normalized"
 */
  __pyx_v_a = (__pyx_v_ls * __pyx_v_lo);

  /* "cgtypes.pyx":680
 *         lo = sqrt(other.x*other.x + other.y*other.y + other.z*other.z)
 *         a  = ls*lo
 *         if a<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"angle(): null vector can't be normalized"
 *         a  = (self.x*other.x + self.y*other.y + self.z*other.z)/a
 */
  __pyx_t_1 = ((__pyx_v_a <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":681
 *         a  = ls*lo
 *         if a<=eps:
 *             raise ZeroDivisionError,"angle(): null vector can't be normalized"             # <<<<<<<<<<<<<<
 *         a  = (self.x*other.x + self.y*other.y + self.z*other.z)/a
 *         if a>1.0:
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_angle_null_vector_can_t_be_norma, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":682
 *         if a<=eps:
 *             raise ZeroDivisionError,"angle(): null vector can't be normalized"
 *         a  = (self.x*other.x + self.y*other.y + self.z*other.z)/a             # <<<<<<<<<<<<<<
 *         if a>1.0:
 *             a=1.0
 */
  __pyx_t_2 = (((__pyx_v_self->x * __pyx_v_other->x) + (__pyx_v_self->y * __pyx_v_other->y)) + (__pyx_v_self->z * __pyx_v_other->z));
  if (unlikely(__pyx_v_a == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a = (__pyx_t_2 / __pyx_v_a);

  /* "cgtypes.pyx":683
 *             raise ZeroDivisionError,"angle(): null vector can't be normalized"
 *         a  = (self.x*other.x + self.y*other.y + self.z*other.z)/a
 *         if a>1.0:             # <<<<<<<<<<<<<<
 *             a=1.0
 *         if a<-1.0:
 */
  __pyx_t_1 = ((__pyx_v_a > 1.0) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":684
 *         a  = (self.x*other.x + self.y*other.y + self.z*other.z)/a
 *         if a>1.0:
 *             a=1.0             # <<<<<<<<<<<<<<
 *         if a<-1.0:
 *             a=-1.0
 */
    __pyx_v_a = 1.0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "cgtypes.pyx":685
 *         if a>1.0:
 *             a=1.0
 *         if a<-1.0:             # <<<<<<<<<<<<<<
 *             a=-1.0
 *         return acos(a)
 */
  __pyx_t_1 = ((__pyx_v_a < -1.0) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":686
 *             a=1.0
 *         if a<-1.0:
 *             a=-1.0             # <<<<<<<<<<<<<<
 *         return acos(a)
 * #        if isinstance(other, vec3):
 */
    __pyx_v_a = -1.0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "cgtypes.pyx":687
 *         if a<-1.0:
 *             a=-1.0
 *         return acos(a)             # <<<<<<<<<<<<<<
 * #        if isinstance(other, vec3):
 * #            return math.acos((self*other) / (abs(self)*abs(other)))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(acos(__pyx_v_a)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":666
 *         return res
 * 
 *     def angle(self, vec3 other):             # <<<<<<<<<<<<<<
 *         """Return angle (in radians) between self and other.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.vec3.angle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":693
 * #            raise TypeError, "unsupported operand type for angle()"
 * 
 *     def reflect(self, vec3 N):             # <<<<<<<<<<<<<<
 *         """Return the reflection vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_57reflect(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_56reflect[] = "Return the reflection vector.\n\n        N is the surface normal which has to be of unit length.\n\n        >>> a=vec3(1.0, -1.0, 0.0)\n        >>> print a.reflect(vec3(0,1,0)\n        (1.0000, 1.0000, 0.0000)\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_57reflect(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reflect (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_N), __pyx_ptype_7cgtypes_vec3, 1, "N", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_56reflect(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_N));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_56reflect(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_N) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reflect", 0);

  /* "cgtypes.pyx":705
 *         cdef double a
 * 
 *         res = vec3()             # <<<<<<<<<<<<<<
 *         a = 2.0*(self.x*N.x + self.y*N.y + self.z*N.z)
 *         res.x = self.x - a*N.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":706
 * 
 *         res = vec3()
 *         a = 2.0*(self.x*N.x + self.y*N.y + self.z*N.z)             # <<<<<<<<<<<<<<
 *         res.x = self.x - a*N.x
 *         res.y = self.y - a*N.y
 */
  __pyx_v_a = (2.0 * (((__pyx_v_self->x * __pyx_v_N->x) + (__pyx_v_self->y * __pyx_v_N->y)) + (__pyx_v_self->z * __pyx_v_N->z)));

  /* "cgtypes.pyx":707
 *         res = vec3()
 *         a = 2.0*(self.x*N.x + self.y*N.y + self.z*N.z)
 *         res.x = self.x - a*N.x             # <<<<<<<<<<<<<<
 *         res.y = self.y - a*N.y
 *         res.z = self.z - a*N.z
 */
  __pyx_v_res->x = (__pyx_v_self->x - (__pyx_v_a * __pyx_v_N->x));

  /* "cgtypes.pyx":708
 *         a = 2.0*(self.x*N.x + self.y*N.y + self.z*N.z)
 *         res.x = self.x - a*N.x
 *         res.y = self.y - a*N.y             # <<<<<<<<<<<<<<
 *         res.z = self.z - a*N.z
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_self->y - (__pyx_v_a * __pyx_v_N->y));

  /* "cgtypes.pyx":709
 *         res.x = self.x - a*N.x
 *         res.y = self.y - a*N.y
 *         res.z = self.z - a*N.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_self->z - (__pyx_v_a * __pyx_v_N->z));

  /* "cgtypes.pyx":710
 *         res.y = self.y - a*N.y
 *         res.z = self.z - a*N.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def refract(self, vec3 N, eta):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":693
 * #            raise TypeError, "unsupported operand type for angle()"
 * 
 *     def reflect(self, vec3 N):             # <<<<<<<<<<<<<<
 *         """Return the reflection vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.reflect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":712
 *         return res
 * 
 *     def refract(self, vec3 N, eta):             # <<<<<<<<<<<<<<
 *         """Return the transmitted vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_59refract(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_58refract[] = "Return the transmitted vector.\n\n        N is the surface normal which has to be of unit length.\n        eta is the relative index of refraction. If the returned\n        vector is zero then there is no transmitted light because\n        of total internal reflection.\n\n        >>> a=vec3(1.0, -1.5, 0.8)\n        >>> print a.refract(vec3(0,1,0), 1.33)\n        (1.3300, -1.7920, 1.0640)\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_59refract(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_N = 0;
  PyObject *__pyx_v_eta = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("refract (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_eta,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_eta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("refract", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "refract") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_N = ((struct __pyx_obj_7cgtypes_vec3 *)values[0]);
    __pyx_v_eta = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("refract", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec3.refract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_N), __pyx_ptype_7cgtypes_vec3, 1, "N", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_58refract(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), __pyx_v_N, __pyx_v_eta);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_58refract(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_N, PyObject *__pyx_v_eta) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  double __pyx_v_dot;
  double __pyx_v_k;
  double __pyx_v_ceta;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("refract", 0);

  /* "cgtypes.pyx":727
 *         cdef double dot, k, ceta
 * 
 *         res = vec3()             # <<<<<<<<<<<<<<
 * 
 *         ceta = eta
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":729
 *         res = vec3()
 * 
 *         ceta = eta             # <<<<<<<<<<<<<<
 *         dot = self.x*N.x + self.y*N.y + self.z*N.z
 *         k   = 1.0 - ceta*ceta*(1.0 - dot*dot)
 */
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_eta); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ceta = __pyx_t_2;

  /* "cgtypes.pyx":730
 * 
 *         ceta = eta
 *         dot = self.x*N.x + self.y*N.y + self.z*N.z             # <<<<<<<<<<<<<<
 *         k   = 1.0 - ceta*ceta*(1.0 - dot*dot)
 *         if k<=eps:
 */
  __pyx_v_dot = (((__pyx_v_self->x * __pyx_v_N->x) + (__pyx_v_self->y * __pyx_v_N->y)) + (__pyx_v_self->z * __pyx_v_N->z));

  /* "cgtypes.pyx":731
 *         ceta = eta
 *         dot = self.x*N.x + self.y*N.y + self.z*N.z
 *         k   = 1.0 - ceta*ceta*(1.0 - dot*dot)             # <<<<<<<<<<<<<<
 *         if k<=eps:
 *             res.x = 0.0
 */
  __pyx_v_k = (1.0 - ((__pyx_v_ceta * __pyx_v_ceta) * (1.0 - (__pyx_v_dot * __pyx_v_dot))));

  /* "cgtypes.pyx":732
 *         dot = self.x*N.x + self.y*N.y + self.z*N.z
 *         k   = 1.0 - ceta*ceta*(1.0 - dot*dot)
 *         if k<=eps:             # <<<<<<<<<<<<<<
 *             res.x = 0.0
 *             res.y = 0.0
 */
  __pyx_t_3 = ((__pyx_v_k <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_3) {

    /* "cgtypes.pyx":733
 *         k   = 1.0 - ceta*ceta*(1.0 - dot*dot)
 *         if k<=eps:
 *             res.x = 0.0             # <<<<<<<<<<<<<<
 *             res.y = 0.0
 *             res.z = 0.0
 */
    __pyx_v_res->x = 0.0;

    /* "cgtypes.pyx":734
 *         if k<=eps:
 *             res.x = 0.0
 *             res.y = 0.0             # <<<<<<<<<<<<<<
 *             res.z = 0.0
 *         else:
 */
    __pyx_v_res->y = 0.0;

    /* "cgtypes.pyx":735
 *             res.x = 0.0
 *             res.y = 0.0
 *             res.z = 0.0             # <<<<<<<<<<<<<<
 *         else:
 *             k = ceta*dot + sqrt(k)
 */
    __pyx_v_res->z = 0.0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":737
 *             res.z = 0.0
 *         else:
 *             k = ceta*dot + sqrt(k)             # <<<<<<<<<<<<<<
 *             res.x = ceta*self.x - k*N.x
 *             res.y = ceta*self.y - k*N.y
 */
    __pyx_v_k = ((__pyx_v_ceta * __pyx_v_dot) + sqrt(__pyx_v_k));

    /* "cgtypes.pyx":738
 *         else:
 *             k = ceta*dot + sqrt(k)
 *             res.x = ceta*self.x - k*N.x             # <<<<<<<<<<<<<<
 *             res.y = ceta*self.y - k*N.y
 *             res.z = ceta*self.z - k*N.z
 */
    __pyx_v_res->x = ((__pyx_v_ceta * __pyx_v_self->x) - (__pyx_v_k * __pyx_v_N->x));

    /* "cgtypes.pyx":739
 *             k = ceta*dot + sqrt(k)
 *             res.x = ceta*self.x - k*N.x
 *             res.y = ceta*self.y - k*N.y             # <<<<<<<<<<<<<<
 *             res.z = ceta*self.z - k*N.z
 * 
 */
    __pyx_v_res->y = ((__pyx_v_ceta * __pyx_v_self->y) - (__pyx_v_k * __pyx_v_N->y));

    /* "cgtypes.pyx":740
 *             res.x = ceta*self.x - k*N.x
 *             res.y = ceta*self.y - k*N.y
 *             res.z = ceta*self.z - k*N.z             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
    __pyx_v_res->z = ((__pyx_v_ceta * __pyx_v_self->z) - (__pyx_v_k * __pyx_v_N->z));
  }
  __pyx_L3:;

  /* "cgtypes.pyx":742
 *             res.z = ceta*self.z - k*N.z
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def ortho(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":712
 *         return res
 * 
 *     def refract(self, vec3 N, eta):             # <<<<<<<<<<<<<<
 *         """Return the transmitted vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.refract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":744
 *         return res
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Returns an orthogonal vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_61ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_60ortho[] = "Returns an orthogonal vector.\n\n        Returns a vector that is orthogonal to self (where\n        self*self.ortho()==0).\n\n        >>> a=vec3(1.0, -1.5, 0.8)\n        >>> print round(a*a.ortho(),8)\n        0.0\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_61ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec3_60ortho(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_60ortho(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_res = 0;
  double __pyx_v_x;
  double __pyx_v_y;
  double __pyx_v_z;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ortho", 0);

  /* "cgtypes.pyx":756
 *         cdef vec3 res
 *         cdef double x,y,z
 *         res = vec3()             # <<<<<<<<<<<<<<
 * 
 *         x=fabs(self.x)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":758
 *         res = vec3()
 * 
 *         x=fabs(self.x)             # <<<<<<<<<<<<<<
 *         y=fabs(self.y)
 *         z=fabs(self.z)
 */
  __pyx_v_x = fabs(__pyx_v_self->x);

  /* "cgtypes.pyx":759
 * 
 *         x=fabs(self.x)
 *         y=fabs(self.y)             # <<<<<<<<<<<<<<
 *         z=fabs(self.z)
 *         # Is z the smallest element? Then use x and y
 */
  __pyx_v_y = fabs(__pyx_v_self->y);

  /* "cgtypes.pyx":760
 *         x=fabs(self.x)
 *         y=fabs(self.y)
 *         z=fabs(self.z)             # <<<<<<<<<<<<<<
 *         # Is z the smallest element? Then use x and y
 *         if z<=x and z<=y:
 */
  __pyx_v_z = fabs(__pyx_v_self->z);

  /* "cgtypes.pyx":762
 *         z=fabs(self.z)
 *         # Is z the smallest element? Then use x and y
 *         if z<=x and z<=y:             # <<<<<<<<<<<<<<
 *             res.x = -self.y
 *             res.y = self.x
 */
  __pyx_t_3 = ((__pyx_v_z <= __pyx_v_x) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_z <= __pyx_v_y) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":763
 *         # Is z the smallest element? Then use x and y
 *         if z<=x and z<=y:
 *             res.x = -self.y             # <<<<<<<<<<<<<<
 *             res.y = self.x
 *             res.z = 0.0
 */
    __pyx_v_res->x = (-__pyx_v_self->y);

    /* "cgtypes.pyx":764
 *         if z<=x and z<=y:
 *             res.x = -self.y
 *             res.y = self.x             # <<<<<<<<<<<<<<
 *             res.z = 0.0
 *         # Is y smallest element? Then use x and z
 */
    __pyx_t_4 = __pyx_v_self->x;
    __pyx_v_res->y = __pyx_t_4;

    /* "cgtypes.pyx":765
 *             res.x = -self.y
 *             res.y = self.x
 *             res.z = 0.0             # <<<<<<<<<<<<<<
 *         # Is y smallest element? Then use x and z
 *         elif y<=x and y<=z:
 */
    __pyx_v_res->z = 0.0;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":767
 *             res.z = 0.0
 *         # Is y smallest element? Then use x and z
 *         elif y<=x and y<=z:             # <<<<<<<<<<<<<<
 *             res.x = -self.z
 *             res.y = 0.0
 */
  __pyx_t_3 = ((__pyx_v_y <= __pyx_v_x) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_3 = ((__pyx_v_y <= __pyx_v_z) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":768
 *         # Is y smallest element? Then use x and z
 *         elif y<=x and y<=z:
 *             res.x = -self.z             # <<<<<<<<<<<<<<
 *             res.y = 0.0
 *             res.z = self.x
 */
    __pyx_v_res->x = (-__pyx_v_self->z);

    /* "cgtypes.pyx":769
 *         elif y<=x and y<=z:
 *             res.x = -self.z
 *             res.y = 0.0             # <<<<<<<<<<<<<<
 *             res.z = self.x
 *         # x is smallest
 */
    __pyx_v_res->y = 0.0;

    /* "cgtypes.pyx":770
 *             res.x = -self.z
 *             res.y = 0.0
 *             res.z = self.x             # <<<<<<<<<<<<<<
 *         # x is smallest
 *         else:
 */
    __pyx_t_4 = __pyx_v_self->x;
    __pyx_v_res->z = __pyx_t_4;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":773
 *         # x is smallest
 *         else:
 *             res.x = 0.0             # <<<<<<<<<<<<<<
 *             res.y = -self.z
 *             res.z = self.y
 */
    __pyx_v_res->x = 0.0;

    /* "cgtypes.pyx":774
 *         else:
 *             res.x = 0.0
 *             res.y = -self.z             # <<<<<<<<<<<<<<
 *             res.z = self.y
 * 
 */
    __pyx_v_res->y = (-__pyx_v_self->z);

    /* "cgtypes.pyx":775
 *             res.x = 0.0
 *             res.y = -self.z
 *             res.z = self.y             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
    __pyx_t_4 = __pyx_v_self->y;
    __pyx_v_res->z = __pyx_t_4;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":777
 *             res.z = self.y
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":744
 *         return res
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Returns an orthogonal vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec3.ortho", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":780
 * 
 * 
 *     def fadd(self, vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         self.x = a.x+b.x
 *         self.y = a.y+b.y
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_63fadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec3_63fadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fadd", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fadd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_a = ((struct __pyx_obj_7cgtypes_vec3 *)values[0]);
    __pyx_v_b = ((struct __pyx_obj_7cgtypes_vec3 *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fadd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec3.fadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_vec3, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_62fadd(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), __pyx_v_a, __pyx_v_b);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_62fadd(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fadd", 0);

  /* "cgtypes.pyx":781
 * 
 *     def fadd(self, vec3 a, vec3 b):
 *         self.x = a.x+b.x             # <<<<<<<<<<<<<<
 *         self.y = a.y+b.y
 *         self.z = a.z+b.z
 */
  __pyx_v_self->x = (__pyx_v_a->x + __pyx_v_b->x);

  /* "cgtypes.pyx":782
 *     def fadd(self, vec3 a, vec3 b):
 *         self.x = a.x+b.x
 *         self.y = a.y+b.y             # <<<<<<<<<<<<<<
 *         self.z = a.z+b.z
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_a->y + __pyx_v_b->y);

  /* "cgtypes.pyx":783
 *         self.x = a.x+b.x
 *         self.y = a.y+b.y
 *         self.z = a.z+b.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_a->z + __pyx_v_b->z);

  /* "cgtypes.pyx":784
 *         self.y = a.y+b.y
 *         self.z = a.z+b.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def fnormalize(self, vec3 a):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":780
 * 
 * 
 *     def fadd(self, vec3 a, vec3 b):             # <<<<<<<<<<<<<<
 *         self.x = a.x+b.x
 *         self.y = a.y+b.y
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":786
 *         return self
 * 
 *     def fnormalize(self, vec3 a):             # <<<<<<<<<<<<<<
 *         """Normalize vector a and store result in self.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec3_65fnormalize(PyObject *__pyx_v_self, PyObject *__pyx_v_a); /*proto*/
static char __pyx_doc_7cgtypes_4vec3_64fnormalize[] = "Normalize vector a and store result in self.\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec3_65fnormalize(PyObject *__pyx_v_self, PyObject *__pyx_v_a) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fnormalize (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec3_64fnormalize(((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_v_a));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec3_64fnormalize(struct __pyx_obj_7cgtypes_vec3 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a) {
  double __pyx_v_nlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fnormalize", 0);

  /* "cgtypes.pyx":791
 *         cdef double nlen
 * 
 *         nlen = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)             # <<<<<<<<<<<<<<
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 */
  __pyx_v_nlen = sqrt((((__pyx_v_a->x * __pyx_v_a->x) + (__pyx_v_a->y * __pyx_v_a->y)) + (__pyx_v_a->z * __pyx_v_a->z)));

  /* "cgtypes.pyx":792
 * 
 *         nlen = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         if nlen<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 */
  __pyx_t_1 = ((__pyx_v_nlen <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":793
 *         nlen = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"             # <<<<<<<<<<<<<<
 *         nlen = 1.0/nlen
 *         self.x = a.x*nlen
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_null_vector_can_t_be_normalized, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":794
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen             # <<<<<<<<<<<<<<
 *         self.x = a.x*nlen
 *         self.y = a.y*nlen
 */
  if (unlikely(__pyx_v_nlen == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nlen = (1.0 / __pyx_v_nlen);

  /* "cgtypes.pyx":795
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 *         self.x = a.x*nlen             # <<<<<<<<<<<<<<
 *         self.y = a.y*nlen
 *         self.z = a.z*nlen
 */
  __pyx_v_self->x = (__pyx_v_a->x * __pyx_v_nlen);

  /* "cgtypes.pyx":796
 *         nlen = 1.0/nlen
 *         self.x = a.x*nlen
 *         self.y = a.y*nlen             # <<<<<<<<<<<<<<
 *         self.z = a.z*nlen
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_a->y * __pyx_v_nlen);

  /* "cgtypes.pyx":797
 *         self.x = a.x*nlen
 *         self.y = a.y*nlen
 *         self.z = a.z*nlen             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_a->z * __pyx_v_nlen);

  /* "cgtypes.pyx":798
 *         self.y = a.y*nlen
 *         self.z = a.z*nlen
 *         return self             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":786
 *         return self
 * 
 *     def fnormalize(self, vec3 a):             # <<<<<<<<<<<<<<
 *         """Normalize vector a and store result in self.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cgtypes.vec3.fnormalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":808
 *     cdef object v
 * 
 *     def __cinit__(self, v):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.v   = v
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_8vec4iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_8vec4iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec4iter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_8vec4iter___cinit__(((struct __pyx_obj_7cgtypes_vec4iter *)__pyx_v_self), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_8vec4iter___cinit__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self, PyObject *__pyx_v_v) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":809
 * 
 *     def __cinit__(self, v):
 *         self.idx = 0             # <<<<<<<<<<<<<<
 *         self.v   = v
 * 
 */
  __pyx_v_self->idx = 0;

  /* "cgtypes.pyx":810
 *     def __cinit__(self, v):
 *         self.idx = 0
 *         self.v   = v             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_GIVEREF(__pyx_v_v);
  __Pyx_GOTREF(__pyx_v_self->v);
  __Pyx_DECREF(__pyx_v_self->v);
  __pyx_v_self->v = __pyx_v_v;

  /* "cgtypes.pyx":808
 *     cdef object v
 * 
 *     def __cinit__(self, v):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.v   = v
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":812
 *         self.v   = v
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8vec4iter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8vec4iter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8vec4iter_2__iter__(((struct __pyx_obj_7cgtypes_vec4iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8vec4iter_2__iter__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":813
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":812
 *         self.v   = v
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":815
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8vec4iter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8vec4iter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8vec4iter_4__next__(((struct __pyx_obj_7cgtypes_vec4iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8vec4iter_4__next__(struct __pyx_obj_7cgtypes_vec4iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "cgtypes.pyx":825
 *             self.idx=3
 *             return self.v.z
 *         elif self.idx==3:             # <<<<<<<<<<<<<<
 *             self.idx=4
 *             return self.v.w
 */
  switch (__pyx_v_self->idx) {

    /* "cgtypes.pyx":816
 * 
 *     def __next__(self):
 *         if self.idx==0:             # <<<<<<<<<<<<<<
 *             self.idx=1
 *             return self.v.x
 */
    case 0:

    /* "cgtypes.pyx":817
 *     def __next__(self):
 *         if self.idx==0:
 *             self.idx=1             # <<<<<<<<<<<<<<
 *             return self.v.x
 *         elif self.idx==1:
 */
    __pyx_v_self->idx = 1;

    /* "cgtypes.pyx":818
 *         if self.idx==0:
 *             self.idx=1
 *             return self.v.x             # <<<<<<<<<<<<<<
 *         elif self.idx==1:
 *             self.idx=2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":819
 *             self.idx=1
 *             return self.v.x
 *         elif self.idx==1:             # <<<<<<<<<<<<<<
 *             self.idx=2
 *             return self.v.y
 */
    case 1:

    /* "cgtypes.pyx":820
 *             return self.v.x
 *         elif self.idx==1:
 *             self.idx=2             # <<<<<<<<<<<<<<
 *             return self.v.y
 *         elif self.idx==2:
 */
    __pyx_v_self->idx = 2;

    /* "cgtypes.pyx":821
 *         elif self.idx==1:
 *             self.idx=2
 *             return self.v.y             # <<<<<<<<<<<<<<
 *         elif self.idx==2:
 *             self.idx=3
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":822
 *             self.idx=2
 *             return self.v.y
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.v.z
 */
    case 2:

    /* "cgtypes.pyx":823
 *             return self.v.y
 *         elif self.idx==2:
 *             self.idx=3             # <<<<<<<<<<<<<<
 *             return self.v.z
 *         elif self.idx==3:
 */
    __pyx_v_self->idx = 3;

    /* "cgtypes.pyx":824
 *         elif self.idx==2:
 *             self.idx=3
 *             return self.v.z             # <<<<<<<<<<<<<<
 *         elif self.idx==3:
 *             self.idx=4
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":825
 *             self.idx=3
 *             return self.v.z
 *         elif self.idx==3:             # <<<<<<<<<<<<<<
 *             self.idx=4
 *             return self.v.w
 */
    case 3:

    /* "cgtypes.pyx":826
 *             return self.v.z
 *         elif self.idx==3:
 *             self.idx=4             # <<<<<<<<<<<<<<
 *             return self.v.w
 *         else:
 */
    __pyx_v_self->idx = 4;

    /* "cgtypes.pyx":827
 *         elif self.idx==3:
 *             self.idx=4
 *             return self.v.w             # <<<<<<<<<<<<<<
 *         else:
 *             raise StopIteration
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->v, __pyx_n_s_w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":829
 *             return self.v.w
 *         else:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * # vec4
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":815
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4iter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":840
 *     cdef double x,y,z,w
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec4_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_4vec4_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7cgtypes_4vec4___cinit__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec4___cinit__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_arglen;
  int __pyx_v_seqlen;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_v = 0;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_v_s = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_seq = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":863
 *         cdef int arglen, seqlen
 *         cdef vec4 v
 *         arglen = len(args)             # <<<<<<<<<<<<<<
 * 
 *         if arglen==0:
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arglen = __pyx_t_1;

  /* "cgtypes.pyx":948
 *             self.w = 0.0
 * 
 *         elif arglen==4:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
  switch (__pyx_v_arglen) {

    /* "cgtypes.pyx":865
 *         arglen = len(args)
 * 
 *         if arglen==0:             # <<<<<<<<<<<<<<
 *             self.x = 0.0
 *             self.y = 0.0
 */
    case 0:

    /* "cgtypes.pyx":866
 * 
 *         if arglen==0:
 *             self.x = 0.0             # <<<<<<<<<<<<<<
 *             self.y = 0.0
 *             self.z = 0.0
 */
    __pyx_v_self->x = 0.0;

    /* "cgtypes.pyx":867
 *         if arglen==0:
 *             self.x = 0.0
 *             self.y = 0.0             # <<<<<<<<<<<<<<
 *             self.z = 0.0
 *             self.w = 0.0
 */
    __pyx_v_self->y = 0.0;

    /* "cgtypes.pyx":868
 *             self.x = 0.0
 *             self.y = 0.0
 *             self.z = 0.0             # <<<<<<<<<<<<<<
 *             self.w = 0.0
 *         elif arglen==1:
 */
    __pyx_v_self->z = 0.0;

    /* "cgtypes.pyx":869
 *             self.y = 0.0
 *             self.z = 0.0
 *             self.w = 0.0             # <<<<<<<<<<<<<<
 *         elif arglen==1:
 *             T = type(args[0])
 */
    __pyx_v_self->w = 0.0;
    break;

    /* "cgtypes.pyx":870
 *             self.z = 0.0
 *             self.w = 0.0
 *         elif arglen==1:             # <<<<<<<<<<<<<<
 *             T = type(args[0])
 *             # scalar
 */
    case 1:

    /* "cgtypes.pyx":871
 *             self.w = 0.0
 *         elif arglen==1:
 *             T = type(args[0])             # <<<<<<<<<<<<<<
 *             # scalar
 *             if T==float or T==int or T==long:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2)));
    __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_t_2)));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":873
 *             T = type(args[0])
 *             # scalar
 *             if T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *                 self.x = args[0]
 *                 self.y = self.x
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":874
 *             # scalar
 *             if T==float or T==int or T==long:
 *                 self.x = args[0]             # <<<<<<<<<<<<<<
 *                 self.y = self.x
 *                 self.z = self.x
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":875
 *             if T==float or T==int or T==long:
 *                 self.x = args[0]
 *                 self.y = self.x             # <<<<<<<<<<<<<<
 *                 self.z = self.x
 *                 self.w = self.x
 */
      __pyx_t_5 = __pyx_v_self->x;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":876
 *                 self.x = args[0]
 *                 self.y = self.x
 *                 self.z = self.x             # <<<<<<<<<<<<<<
 *                 self.w = self.x
 *             # vec4
 */
      __pyx_t_5 = __pyx_v_self->x;
      __pyx_v_self->z = __pyx_t_5;

      /* "cgtypes.pyx":877
 *                 self.y = self.x
 *                 self.z = self.x
 *                 self.w = self.x             # <<<<<<<<<<<<<<
 *             # vec4
 *             elif T==vec4:
 */
      __pyx_t_5 = __pyx_v_self->x;
      __pyx_v_self->w = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":879
 *                 self.w = self.x
 *             # vec4
 *             elif T==vec4:             # <<<<<<<<<<<<<<
 *                 v = args[0]
 *                 self.x = v.x
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":880
 *             # vec4
 *             elif T==vec4:
 *                 v = args[0]             # <<<<<<<<<<<<<<
 *                 self.x = v.x
 *                 self.y = v.y
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_v = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":881
 *             elif T==vec4:
 *                 v = args[0]
 *                 self.x = v.x             # <<<<<<<<<<<<<<
 *                 self.y = v.y
 *                 self.z = v.z
 */
      __pyx_t_5 = __pyx_v_v->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":882
 *                 v = args[0]
 *                 self.x = v.x
 *                 self.y = v.y             # <<<<<<<<<<<<<<
 *                 self.z = v.z
 *                 self.w = v.w
 */
      __pyx_t_5 = __pyx_v_v->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":883
 *                 self.x = v.x
 *                 self.y = v.y
 *                 self.z = v.z             # <<<<<<<<<<<<<<
 *                 self.w = v.w
 *             # String
 */
      __pyx_t_5 = __pyx_v_v->z;
      __pyx_v_self->z = __pyx_t_5;

      /* "cgtypes.pyx":884
 *                 self.y = v.y
 *                 self.z = v.z
 *                 self.w = v.w             # <<<<<<<<<<<<<<
 *             # String
 *             elif T==str or T==unicode:
 */
      __pyx_t_5 = __pyx_v_v->w;
      __pyx_v_self->w = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":886
 *                 self.w = v.w
 *             # String
 *             elif T==str or T==unicode:             # <<<<<<<<<<<<<<
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":887
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":888
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:             # <<<<<<<<<<<<<<
 *                     s=[]
 *                 for i in range(len(s)):
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s__7);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__7);
      __Pyx_GIVEREF(__pyx_kp_s__7);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_s, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {

        /* "cgtypes.pyx":889
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 *                     s=[]             # <<<<<<<<<<<<<<
 *                 for i in range(len(s)):
 *                     try:
 */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":890
 *                 if s==[""]:
 *                     s=[]
 *                 for i in range(len(s)):             # <<<<<<<<<<<<<<
 *                     try:
 *                         s[i] = float(s[i])
 */
      __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "cgtypes.pyx":891
 *                     s=[]
 *                 for i in range(len(s)):
 *                     try:             # <<<<<<<<<<<<<<
 *                         s[i] = float(s[i])
 *                     except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cgtypes.pyx":892
 *                 for i in range(len(s)):
 *                     try:
 *                         s[i] = float(s[i])             # <<<<<<<<<<<<<<
 *                     except:
 *                         raise ValueError,"vec4() arg is a malformed string"
 */
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (unlikely(__Pyx_SetItemInt(__pyx_v_s, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cgtypes.pyx":893
 *                     try:
 *                         s[i] = float(s[i])
 *                     except:             # <<<<<<<<<<<<<<
 *                         raise ValueError,"vec4() arg is a malformed string"
 *                 v = vec4(s)
 */
          /*except:*/ {
            __Pyx_AddTraceback("cgtypes.vec4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_6);

            /* "cgtypes.pyx":894
 *                         s[i] = float(s[i])
 *                     except:
 *                         raise ValueError,"vec4() arg is a malformed string"             # <<<<<<<<<<<<<<
 *                 v = vec4(s)
 *                 self.x = v.x
 */
            __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_vec4_arg_is_a_malformed_string, 0, 0);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          }
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L19_try_end:;
        }
      }

      /* "cgtypes.pyx":895
 *                     except:
 *                         raise ValueError,"vec4() arg is a malformed string"
 *                 v = vec4(s)             # <<<<<<<<<<<<<<
 *                 self.x = v.x
 *                 self.y = v.y
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_v = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":896
 *                         raise ValueError,"vec4() arg is a malformed string"
 *                 v = vec4(s)
 *                 self.x = v.x             # <<<<<<<<<<<<<<
 *                 self.y = v.y
 *                 self.z = v.z
 */
      __pyx_t_5 = __pyx_v_v->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":897
 *                 v = vec4(s)
 *                 self.x = v.x
 *                 self.y = v.y             # <<<<<<<<<<<<<<
 *                 self.z = v.z
 *                 self.w = v.w
 */
      __pyx_t_5 = __pyx_v_v->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":898
 *                 self.x = v.x
 *                 self.y = v.y
 *                 self.z = v.z             # <<<<<<<<<<<<<<
 *                 self.w = v.w
 *             # Sequence of floats
 */
      __pyx_t_5 = __pyx_v_v->z;
      __pyx_v_self->z = __pyx_t_5;

      /* "cgtypes.pyx":899
 *                 self.y = v.y
 *                 self.z = v.z
 *                 self.w = v.w             # <<<<<<<<<<<<<<
 *             # Sequence of floats
 *             else:
 */
      __pyx_t_5 = __pyx_v_v->w;
      __pyx_v_self->w = __pyx_t_5;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cgtypes.pyx":902
 *             # Sequence of floats
 *             else:
 *                 seq = args[0]             # <<<<<<<<<<<<<<
 *                 try:
 *                     seqlen = len(seq)
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seq = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":903
 *             else:
 *                 seq = args[0]
 *                 try:             # <<<<<<<<<<<<<<
 *                     seqlen = len(seq)
 *                 except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cgtypes.pyx":904
 *                 seq = args[0]
 *                 try:
 *                     seqlen = len(seq)             # <<<<<<<<<<<<<<
 *                 except:
 *                     raise TypeError,"vec4() arg can't be converted to vec4"
 */
          __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __pyx_v_seqlen = __pyx_t_1;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cgtypes.pyx":905
 *                 try:
 *                     seqlen = len(seq)
 *                 except:             # <<<<<<<<<<<<<<
 *                     raise TypeError,"vec4() arg can't be converted to vec4"
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cgtypes.vec4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cgtypes.pyx":906
 *                     seqlen = len(seq)
 *                 except:
 *                     raise TypeError,"vec4() arg can't be converted to vec4"             # <<<<<<<<<<<<<<
 * 
 *                 if seqlen==4:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec4_arg_can_t_be_converted_to_v, 0, 0);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_L24_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L29_try_end:;
      }

      /* "cgtypes.pyx":908
 *                     raise TypeError,"vec4() arg can't be converted to vec4"
 * 
 *                 if seqlen==4:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 4) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":909
 * 
 *                 if seqlen==4:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":910
 *                 if seqlen==4:
 *                     self.x = seq[0]
 *                     self.y = seq[1]             # <<<<<<<<<<<<<<
 *                     self.z = seq[2]
 *                     self.w = seq[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":911
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 *                     self.z = seq[2]             # <<<<<<<<<<<<<<
 *                     self.w = seq[3]
 *                 elif seqlen==3:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->z = __pyx_t_5;

        /* "cgtypes.pyx":912
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 *                     self.w = seq[3]             # <<<<<<<<<<<<<<
 *                 elif seqlen==3:
 *                     self.x = seq[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->w = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":913
 *                     self.z = seq[2]
 *                     self.w = seq[3]
 *                 elif seqlen==3:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 3) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":914
 *                     self.w = seq[3]
 *                 elif seqlen==3:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":915
 *                 elif seqlen==3:
 *                     self.x = seq[0]
 *                     self.y = seq[1]             # <<<<<<<<<<<<<<
 *                     self.z = seq[2]
 *                     self.w = 0.0
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":916
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 *                     self.z = seq[2]             # <<<<<<<<<<<<<<
 *                     self.w = 0.0
 *                 elif seqlen==2:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->z = __pyx_t_5;

        /* "cgtypes.pyx":917
 *                     self.y = seq[1]
 *                     self.z = seq[2]
 *                     self.w = 0.0             # <<<<<<<<<<<<<<
 *                 elif seqlen==2:
 *                     self.x = seq[0]
 */
        __pyx_v_self->w = 0.0;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":918
 *                     self.z = seq[2]
 *                     self.w = 0.0
 *                 elif seqlen==2:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 2) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":919
 *                     self.w = 0.0
 *                 elif seqlen==2:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = seq[1]
 *                     self.z = 0.0
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":920
 *                 elif seqlen==2:
 *                     self.x = seq[0]
 *                     self.y = seq[1]             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                     self.w = 0.0
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":921
 *                     self.x = seq[0]
 *                     self.y = seq[1]
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                     self.w = 0.0
 *                 elif seqlen==1:
 */
        __pyx_v_self->z = 0.0;

        /* "cgtypes.pyx":922
 *                     self.y = seq[1]
 *                     self.z = 0.0
 *                     self.w = 0.0             # <<<<<<<<<<<<<<
 *                 elif seqlen==1:
 *                     self.x = seq[0]
 */
        __pyx_v_self->w = 0.0;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":923
 *                     self.z = 0.0
 *                     self.w = 0.0
 *                 elif seqlen==1:             # <<<<<<<<<<<<<<
 *                     self.x = seq[0]
 *                     self.y = self.x
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 1) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":924
 *                     self.w = 0.0
 *                 elif seqlen==1:
 *                     self.x = seq[0]             # <<<<<<<<<<<<<<
 *                     self.y = self.x
 *                     self.z = self.x
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":925
 *                 elif seqlen==1:
 *                     self.x = seq[0]
 *                     self.y = self.x             # <<<<<<<<<<<<<<
 *                     self.z = self.x
 *                     self.w = self.x
 */
        __pyx_t_5 = __pyx_v_self->x;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":926
 *                     self.x = seq[0]
 *                     self.y = self.x
 *                     self.z = self.x             # <<<<<<<<<<<<<<
 *                     self.w = self.x
 *                 elif seqlen==0:
 */
        __pyx_t_5 = __pyx_v_self->x;
        __pyx_v_self->z = __pyx_t_5;

        /* "cgtypes.pyx":927
 *                     self.y = self.x
 *                     self.z = self.x
 *                     self.w = self.x             # <<<<<<<<<<<<<<
 *                 elif seqlen==0:
 *                     self.x = 0.0
 */
        __pyx_t_5 = __pyx_v_self->x;
        __pyx_v_self->w = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":928
 *                     self.z = self.x
 *                     self.w = self.x
 *                 elif seqlen==0:             # <<<<<<<<<<<<<<
 *                     self.x = 0.0
 *                     self.y = 0.0
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 0) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":929
 *                     self.w = self.x
 *                 elif seqlen==0:
 *                     self.x = 0.0             # <<<<<<<<<<<<<<
 *                     self.y = 0.0
 *                     self.z = 0.0
 */
        __pyx_v_self->x = 0.0;

        /* "cgtypes.pyx":930
 *                 elif seqlen==0:
 *                     self.x = 0.0
 *                     self.y = 0.0             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                     self.w = 0.0
 */
        __pyx_v_self->y = 0.0;

        /* "cgtypes.pyx":931
 *                     self.x = 0.0
 *                     self.y = 0.0
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                     self.w = 0.0
 *                 else:
 */
        __pyx_v_self->z = 0.0;

        /* "cgtypes.pyx":932
 *                     self.y = 0.0
 *                     self.z = 0.0
 *                     self.w = 0.0             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError, "vec4() takes at most 4 arguments"
 */
        __pyx_v_self->w = 0.0;
        goto __pyx_L32;
      }
      /*else*/ {

        /* "cgtypes.pyx":934
 *                     self.w = 0.0
 *                 else:
 *                     raise TypeError, "vec4() takes at most 4 arguments"             # <<<<<<<<<<<<<<
 * 
 *         elif arglen==2:
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec4_takes_at_most_4_arguments, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L32:;
    }
    __pyx_L3:;
    break;

    /* "cgtypes.pyx":936
 *                     raise TypeError, "vec4() takes at most 4 arguments"
 * 
 *         elif arglen==2:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
    case 2:

    /* "cgtypes.pyx":937
 * 
 *         elif arglen==2:
 *             self.x = args[0]             # <<<<<<<<<<<<<<
 *             self.y = args[1]
 *             self.z = 0.0
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":938
 *         elif arglen==2:
 *             self.x = args[0]
 *             self.y = args[1]             # <<<<<<<<<<<<<<
 *             self.z = 0.0
 *             self.w = 0.0
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":939
 *             self.x = args[0]
 *             self.y = args[1]
 *             self.z = 0.0             # <<<<<<<<<<<<<<
 *             self.w = 0.0
 * 
 */
    __pyx_v_self->z = 0.0;

    /* "cgtypes.pyx":940
 *             self.y = args[1]
 *             self.z = 0.0
 *             self.w = 0.0             # <<<<<<<<<<<<<<
 * 
 *         elif arglen==3:
 */
    __pyx_v_self->w = 0.0;
    break;

    /* "cgtypes.pyx":942
 *             self.w = 0.0
 * 
 *         elif arglen==3:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
    case 3:

    /* "cgtypes.pyx":943
 * 
 *         elif arglen==3:
 *             self.x = args[0]             # <<<<<<<<<<<<<<
 *             self.y = args[1]
 *             self.z = args[2]
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":944
 *         elif arglen==3:
 *             self.x = args[0]
 *             self.y = args[1]             # <<<<<<<<<<<<<<
 *             self.z = args[2]
 *             self.w = 0.0
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":945
 *             self.x = args[0]
 *             self.y = args[1]
 *             self.z = args[2]             # <<<<<<<<<<<<<<
 *             self.w = 0.0
 * 
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->z = __pyx_t_5;

    /* "cgtypes.pyx":946
 *             self.y = args[1]
 *             self.z = args[2]
 *             self.w = 0.0             # <<<<<<<<<<<<<<
 * 
 *         elif arglen==4:
 */
    __pyx_v_self->w = 0.0;
    break;

    /* "cgtypes.pyx":948
 *             self.w = 0.0
 * 
 *         elif arglen==4:             # <<<<<<<<<<<<<<
 *             self.x = args[0]
 *             self.y = args[1]
 */
    case 4:

    /* "cgtypes.pyx":949
 * 
 *         elif arglen==4:
 *             self.x = args[0]             # <<<<<<<<<<<<<<
 *             self.y = args[1]
 *             self.z = args[2]
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":950
 *         elif arglen==4:
 *             self.x = args[0]
 *             self.y = args[1]             # <<<<<<<<<<<<<<
 *             self.z = args[2]
 *             self.w = args[3]
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":951
 *             self.x = args[0]
 *             self.y = args[1]
 *             self.z = args[2]             # <<<<<<<<<<<<<<
 *             self.w = args[3]
 * 
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->z = __pyx_t_5;

    /* "cgtypes.pyx":952
 *             self.y = args[1]
 *             self.z = args[2]
 *             self.w = args[3]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_self->w = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":955
 * 
 *         else:
 *             raise TypeError, "vec4() takes at most 4 arguments"             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_vec4_takes_at_most_4_arguments, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":840
 *     cdef double x,y,z,w
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.vec4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":957
 *             raise TypeError, "vec4() takes at most 4 arguments"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_vec4construct, (self.x, self.y, self.z, self.w))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_2__reduce__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_2__reduce__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cgtypes.pyx":958
 * 
 *     def __reduce__(self):
 *         return (_vec4construct, (self.x, self.y, self.z, self.w))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vec4construct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":957
 *             raise TypeError, "vec4() takes at most 4 arguments"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_vec4construct, (self.x, self.y, self.z, self.w))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cgtypes.vec4.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":960
 *         return (_vec4construct, (self.x, self.y, self.z, self.w))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'vec4(%s, %s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z),repr(self.w))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_4__repr__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_4__repr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cgtypes.pyx":961
 * 
 *     def __repr__(self):
 *         return 'vec4(%s, %s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z),repr(self.w))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_vec4_s_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":960
 *         return (_vec4construct, (self.x, self.y, self.z, self.w))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'vec4(%s, %s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z),repr(self.w))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec4.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":963
 *         return 'vec4(%s, %s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z),repr(self.w))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z, self.w)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_6__str__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_6__str__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cgtypes.pyx":964
 * 
 *     def __str__(self):
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z, self.w)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_1_4f_1_4f_1_4f_1_4f, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":963
 *         return 'vec4(%s, %s, %s, %s)'%(repr(self.x),repr(self.y),repr(self.z),repr(self.w))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z, self.w)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec4.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":966
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z, self.w)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return vec4iter(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_8__iter__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_8__iter__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":967
 * 
 *     def __iter__(self):
 *         return vec4iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(a,b,op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4iter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":966
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.x, self.y, self.z, self.w)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return vec4iter(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":969
 *         return vec4iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef vec4 va, vb
 *         cdef int cop
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.vec4.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4vec4_10__richcmp__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b), ((PyObject *)__pyx_v_op));

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_vb = 0;
  int __pyx_v_cop;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cgtypes.pyx":973
 *         cdef int cop
 * 
 *         cop = op             # <<<<<<<<<<<<<<
 * 
 *         ta = type(a)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_op); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cop = __pyx_t_1;

  /* "cgtypes.pyx":975
 *         cop = op
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 *         if (ta!=vec4 or tb!=vec4):
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":976
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 *         if (ta!=vec4 or tb!=vec4):
 *             if cop==3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":977
 *         ta = type(a)
 *         tb = type(b)
 *         if (ta!=vec4 or tb!=vec4):             # <<<<<<<<<<<<<<
 *             if cop==3:
 *                 return 1
 */
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":978
 *         tb = type(b)
 *         if (ta!=vec4 or tb!=vec4):
 *             if cop==3:             # <<<<<<<<<<<<<<
 *                 return 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cop == 3) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":979
 *         if (ta!=vec4 or tb!=vec4):
 *             if cop==3:
 *                 return 1             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cgtypes.pyx":981
 *                 return 1
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *         va = a
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
    }
  }

  /* "cgtypes.pyx":983
 *                 return 0
 * 
 *         va = a             # <<<<<<<<<<<<<<
 *         vb = b
 * 
 */
  if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_a;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_va = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":984
 * 
 *         va = a
 *         vb = b             # <<<<<<<<<<<<<<
 * 
 *         # <
 */
  if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_b;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":1002
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z and va.w>vb.w)
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z and va.w+eps>=vb.w)
 *         # sonst (Fehler)
 */
  switch (__pyx_v_cop) {

    /* "cgtypes.pyx":987
 * 
 *         # <
 *         if cop==0:             # <<<<<<<<<<<<<<
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z and va.w<vb.w)
 *         # <=
 */
    case 0:

    /* "cgtypes.pyx":988
 *         # <
 *         if cop==0:
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z and va.w<vb.w)             # <<<<<<<<<<<<<<
 *         # <=
 *         elif cop==1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_va->x < __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->y < __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->z < __pyx_v_vb->z);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->w < __pyx_v_vb->w);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":990
 *             return (va.x<vb.x and va.y<vb.y and va.z<vb.z and va.w<vb.w)
 *         # <=
 *         elif cop==1:             # <<<<<<<<<<<<<<
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z and va.w-eps<=vb.w)
 *         # ==
 */
    case 1:

    /* "cgtypes.pyx":991
 *         # <=
 *         elif cop==1:
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z and va.w-eps<=vb.w)             # <<<<<<<<<<<<<<
 *         # ==
 *         elif cop==2:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((__pyx_v_va->x - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->y - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->z - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->z);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->w - __pyx_v_7cgtypes_eps) <= __pyx_v_vb->w);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L11_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":993
 *             return (va.x-eps<=vb.x and va.y-eps<=vb.y and va.z-eps<=vb.z and va.w-eps<=vb.w)
 *         # ==
 *         elif cop==2:             # <<<<<<<<<<<<<<
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps and fabs(va.w-vb.w)<=eps)
 *         # !=
 */
    case 2:

    /* "cgtypes.pyx":994
 *         # ==
 *         elif cop==2:
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps and fabs(va.w-vb.w)<=eps)             # <<<<<<<<<<<<<<
 *         # !=
 *         elif cop==3:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->w - __pyx_v_vb->w)) <= __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L15_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":996
 *             return (fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps and fabs(va.w-vb.w)<=eps)
 *         # !=
 *         elif cop==3:             # <<<<<<<<<<<<<<
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps and fabs(va.w-vb.w)>eps)
 *         # >
 */
    case 3:

    /* "cgtypes.pyx":997
 *         # !=
 *         elif cop==3:
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps and fabs(va.w-vb.w)>eps)             # <<<<<<<<<<<<<<
 *         # >
 *         elif cop==4:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) > __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) > __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->w - __pyx_v_vb->w)) > __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L19_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":999
 *             return (fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps and fabs(va.w-vb.w)>eps)
 *         # >
 *         elif cop==4:             # <<<<<<<<<<<<<<
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z and va.w>vb.w)
 *         # >=
 */
    case 4:

    /* "cgtypes.pyx":1000
 *         # >
 *         elif cop==4:
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z and va.w>vb.w)             # <<<<<<<<<<<<<<
 *         # >=
 *         elif cop==5:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (__pyx_v_va->x > __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->y > __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->z > __pyx_v_vb->z);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (__pyx_v_va->w > __pyx_v_vb->w);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L23_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1002
 *             return (va.x>vb.x and va.y>vb.y and va.z>vb.z and va.w>vb.w)
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z and va.w+eps>=vb.w)
 *         # sonst (Fehler)
 */
    case 5:

    /* "cgtypes.pyx":1003
 *         # >=
 *         elif cop==5:
 *             return (va.x+eps>=vb.x and va.y+eps>=vb.y and va.z+eps>=vb.z and va.w+eps>=vb.w)             # <<<<<<<<<<<<<<
 *         # sonst (Fehler)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((__pyx_v_va->x + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->x);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L27_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->y + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->y);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L27_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->z + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->z);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L27_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_va->w + __pyx_v_7cgtypes_eps) >= __pyx_v_vb->w);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L27_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":1006
 *         # sonst (Fehler)
 *         else:
 *             raise ValueError,"internal error: illegal rich comparison number"             # <<<<<<<<<<<<<<
 * 
 *     def __add__(vec4 a, vec4 b):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_internal_error_illegal_rich_comp, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":969
 *         return vec4iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef vec4 va, vb
 *         cdef int cop
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec4.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1008
 *             raise ValueError,"internal error: illegal rich comparison number"
 * 
 *     def __add__(vec4 a, vec4 b):             # <<<<<<<<<<<<<<
 *         """Vector addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_12__add__[] = "Vector addition.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a+b\n        (0.7000, 1.2500, -1.3000, 0.5000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_12__add__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_vec4, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_12__add__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_12__add__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cgtypes.pyx":1017
 *         """
 *         cdef vec4 res
 *         res = vec4()             # <<<<<<<<<<<<<<
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1018
 *         cdef vec4 res
 *         res = vec4()
 *         res.x = a.x+b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x + __pyx_v_b->x);

  /* "cgtypes.pyx":1019
 *         res = vec4()
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z+b.z
 *         res.w = a.w+b.w
 */
  __pyx_v_res->y = (__pyx_v_a->y + __pyx_v_b->y);

  /* "cgtypes.pyx":1020
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z             # <<<<<<<<<<<<<<
 *         res.w = a.w+b.w
 *         return res
 */
  __pyx_v_res->z = (__pyx_v_a->z + __pyx_v_b->z);

  /* "cgtypes.pyx":1021
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 *         res.w = a.w+b.w             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->w = (__pyx_v_a->w + __pyx_v_b->w);

  /* "cgtypes.pyx":1022
 *         res.z = a.z+b.z
 *         res.w = a.w+b.w
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(vec4 a, vec4 b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1008
 *             raise ValueError,"internal error: illegal rich comparison number"
 * 
 *     def __add__(vec4 a, vec4 b):             # <<<<<<<<<<<<<<
 *         """Vector addition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1024
 *         return res
 * 
 *     def __sub__(vec4 a, vec4 b):             # <<<<<<<<<<<<<<
 *         """Vector subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_14__sub__[] = "Vector subtraction.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a-b\n        (1.3000, -0.2500, -2.3000, -0.1000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_14__sub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_vec4, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_14__sub__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_14__sub__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cgtypes.pyx":1033
 *         """
 *         cdef vec4 res
 *         res = vec4()             # <<<<<<<<<<<<<<
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1034
 *         cdef vec4 res
 *         res = vec4()
 *         res.x = a.x-b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x - __pyx_v_b->x);

  /* "cgtypes.pyx":1035
 *         res = vec4()
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z-b.z
 *         res.w = a.w-b.w
 */
  __pyx_v_res->y = (__pyx_v_a->y - __pyx_v_b->y);

  /* "cgtypes.pyx":1036
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z             # <<<<<<<<<<<<<<
 *         res.w = a.w-b.w
 *         return res
 */
  __pyx_v_res->z = (__pyx_v_a->z - __pyx_v_b->z);

  /* "cgtypes.pyx":1037
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 *         res.w = a.w-b.w             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->w = (__pyx_v_a->w - __pyx_v_b->w);

  /* "cgtypes.pyx":1038
 *         res.z = a.z-b.z
 *         res.w = a.w-b.w
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1024
 *         return res
 * 
 *     def __sub__(vec4 a, vec4 b):             # <<<<<<<<<<<<<<
 *         """Vector subtraction.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1040
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication with a scalar or dot product.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_16__mul__[] = "Multiplication with a scalar or dot product.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> print a*2.0\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        >>> print 2.0*a\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        >>> print a*b\n        -0.765\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_16__mul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_16__mul__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cgtypes.pyx":1056
 *         cdef double r
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 * 
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":1057
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if ta==vec4:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1059
 *         tb = type(b)
 * 
 *         if ta==vec4:             # <<<<<<<<<<<<<<
 *             va = a
 *             if tb==vec4:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1060
 * 
 *         if ta==vec4:
 *             va = a             # <<<<<<<<<<<<<<
 *             if tb==vec4:
 *                 # vec4*vec4   (dot product a*b)
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_va = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":1061
 *         if ta==vec4:
 *             va = a
 *             if tb==vec4:             # <<<<<<<<<<<<<<
 *                 # vec4*vec4   (dot product a*b)
 *                 vb = b
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1063
 *             if tb==vec4:
 *                 # vec4*vec4   (dot product a*b)
 *                 vb = b             # <<<<<<<<<<<<<<
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z + va.w*vb.w
 *             elif tb==float or tb==int or tb==long:
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1064
 *                 # vec4*vec4   (dot product a*b)
 *                 vb = b
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z + va.w*vb.w             # <<<<<<<<<<<<<<
 *             elif tb==float or tb==int or tb==long:
 *                 # vec4*scalar
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyFloat_FromDouble(((((__pyx_v_va->x * __pyx_v_vb->x) + (__pyx_v_va->y * __pyx_v_vb->y)) + (__pyx_v_va->z * __pyx_v_vb->z)) + (__pyx_v_va->w * __pyx_v_vb->w))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":1065
 *                 vb = b
 *                 return va.x*vb.x + va.y*vb.y + va.z*vb.z + va.w*vb.w
 *             elif tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *                 # vec4*scalar
 *                 res = vec4()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1067
 *             elif tb==float or tb==int or tb==long:
 *                 # vec4*scalar
 *                 res = vec4()             # <<<<<<<<<<<<<<
 *                 r   = b
 *                 res.x = va.x*r
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1068
 *                 # vec4*scalar
 *                 res = vec4()
 *                 r   = b             # <<<<<<<<<<<<<<
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":1069
 *                 res = vec4()
 *                 r   = b
 *                 res.x = va.x*r             # <<<<<<<<<<<<<<
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 */
      __pyx_v_res->x = (__pyx_v_va->x * __pyx_v_r);

      /* "cgtypes.pyx":1070
 *                 r   = b
 *                 res.x = va.x*r
 *                 res.y = va.y*r             # <<<<<<<<<<<<<<
 *                 res.z = va.z*r
 *                 res.w = va.w*r
 */
      __pyx_v_res->y = (__pyx_v_va->y * __pyx_v_r);

      /* "cgtypes.pyx":1071
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 *                 res.z = va.z*r             # <<<<<<<<<<<<<<
 *                 res.w = va.w*r
 *                 return res
 */
      __pyx_v_res->z = (__pyx_v_va->z * __pyx_v_r);

      /* "cgtypes.pyx":1072
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 *                 res.w = va.w*r             # <<<<<<<<<<<<<<
 *                 return res
 *             elif tb==mat4:
 */
      __pyx_v_res->w = (__pyx_v_va->w * __pyx_v_r);

      /* "cgtypes.pyx":1073
 *                 res.z = va.z*r
 *                 res.w = va.w*r
 *                 return res             # <<<<<<<<<<<<<<
 *             elif tb==mat4:
 *                 # vec4*mat4
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":1074
 *                 res.w = va.w*r
 *                 return res
 *             elif tb==mat4:             # <<<<<<<<<<<<<<
 *                 # vec4*mat4
 *                 return b.__rmul__(a)
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1076
 *             elif tb==mat4:
 *                 # vec4*mat4
 *                 return b.__rmul__(a)             # <<<<<<<<<<<<<<
 *         elif ta==float or ta==int or ta==long:
 *             if tb==vec4:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_rmul); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_a);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_a);
        __Pyx_GIVEREF(__pyx_v_a);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":1077
 *                 # vec4*mat4
 *                 return b.__rmul__(a)
 *         elif ta==float or ta==int or ta==long:             # <<<<<<<<<<<<<<
 *             if tb==vec4:
 *                 # scalar*vec4
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1078
 *                 return b.__rmul__(a)
 *         elif ta==float or ta==int or ta==long:
 *             if tb==vec4:             # <<<<<<<<<<<<<<
 *                 # scalar*vec4
 *                 res = vec4()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1080
 *             if tb==vec4:
 *                 # scalar*vec4
 *                 res = vec4()             # <<<<<<<<<<<<<<
 *                 vb  = b
 *                 r   = a
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1081
 *                 # scalar*vec4
 *                 res = vec4()
 *                 vb  = b             # <<<<<<<<<<<<<<
 *                 r   = a
 *                 res.x = r*vb.x
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1082
 *                 res = vec4()
 *                 vb  = b
 *                 r   = a             # <<<<<<<<<<<<<<
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_a); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":1083
 *                 vb  = b
 *                 r   = a
 *                 res.x = r*vb.x             # <<<<<<<<<<<<<<
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 */
      __pyx_v_res->x = (__pyx_v_r * __pyx_v_vb->x);

      /* "cgtypes.pyx":1084
 *                 r   = a
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y             # <<<<<<<<<<<<<<
 *                 res.z = r*vb.z
 *                 res.w = r*vb.w
 */
      __pyx_v_res->y = (__pyx_v_r * __pyx_v_vb->y);

      /* "cgtypes.pyx":1085
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z             # <<<<<<<<<<<<<<
 *                 res.w = r*vb.w
 *                 return res
 */
      __pyx_v_res->z = (__pyx_v_r * __pyx_v_vb->z);

      /* "cgtypes.pyx":1086
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 *                 res.w = r*vb.w             # <<<<<<<<<<<<<<
 *                 return res
 * 
 */
      __pyx_v_res->w = (__pyx_v_r * __pyx_v_vb->w);

      /* "cgtypes.pyx":1087
 *                 res.z = r*vb.z
 *                 res.w = r*vb.w
 *                 return res             # <<<<<<<<<<<<<<
 * 
 *         raise TypeError, "unsupported operand type for *"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":1089
 *                 return res
 * 
 *         raise TypeError, "unsupported operand type for *"             # <<<<<<<<<<<<<<
 * 
 *     def __div__(vec4 a, b):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":1040
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication with a scalar or dot product.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.vec4.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1091
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(vec4 a, b):             # <<<<<<<<<<<<<<
 *         """Division by scalar.
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4vec4_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_18__div__[] = "Division by scalar.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a/2.0\n        (0.5000, 0.2500, -0.9000, 0.1000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_18__div__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_vec4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_18__div__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec4_18__div__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cgtypes.pyx":1102
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1104
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec4/scalar
 *             res = vec4()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1106
 *         if tb==float or tb==int or tb==long:
 *             # vec4/scalar
 *             res = vec4()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1107
 *             # vec4/scalar
 *             res = vec4()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1108
 *             res = vec4()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 division"
 *             res.x = a.x/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1109
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"             # <<<<<<<<<<<<<<
 *             res.x = a.x/r
 *             res.y = a.y/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1110
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"
 *             res.x = a.x/r             # <<<<<<<<<<<<<<
 *             res.y = a.y/r
 *             res.z = a.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->x = (__pyx_v_a->x / __pyx_v_r);

    /* "cgtypes.pyx":1111
 *                 raise ZeroDivisionError,"vec4 division"
 *             res.x = a.x/r
 *             res.y = a.y/r             # <<<<<<<<<<<<<<
 *             res.z = a.z/r
 *             res.w = a.w/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->y = (__pyx_v_a->y / __pyx_v_r);

    /* "cgtypes.pyx":1112
 *             res.x = a.x/r
 *             res.y = a.y/r
 *             res.z = a.z/r             # <<<<<<<<<<<<<<
 *             res.w = a.w/r
 *             return res
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->z = (__pyx_v_a->z / __pyx_v_r);

    /* "cgtypes.pyx":1113
 *             res.y = a.y/r
 *             res.z = a.z/r
 *             res.w = a.w/r             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->w = (__pyx_v_a->w / __pyx_v_r);

    /* "cgtypes.pyx":1114
 *             res.z = a.z/r
 *             res.w = a.w/r
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1116
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for /"             # <<<<<<<<<<<<<<
 * 
 *     def __mod__(vec4 self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_2, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1091
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(vec4 a, b):             # <<<<<<<<<<<<<<
 *         """Division by scalar.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":1118
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(vec4 self, b):             # <<<<<<<<<<<<<<
 *         """Modulo (component wise)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_20__mod__[] = "Modulo (component wise)\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print a%2.0\n        (1.0000, 0.5000, 0.2000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_20__mod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mod__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_7cgtypes_vec4, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_20__mod__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_20__mod__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mod__", 0);

  /* "cgtypes.pyx":1128
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1130
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec4%scalar
 *             res = vec4()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1132
 *         if tb==float or tb==int or tb==long:
 *             # vec4%scalar
 *             res = vec4()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1133
 *             # vec4%scalar
 *             res = vec4()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1134
 *             res = vec4()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x,r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1135
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"             # <<<<<<<<<<<<<<
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1136
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x,r)             # <<<<<<<<<<<<<<
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)
 */
    __pyx_v_res->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_r);

    /* "cgtypes.pyx":1137
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)             # <<<<<<<<<<<<<<
 *             res.z = _fmod(self.z,r)
 *             res.w = _fmod(self.w,r)
 */
    __pyx_v_res->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_r);

    /* "cgtypes.pyx":1138
 *             res.x = _fmod(self.x,r)
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)             # <<<<<<<<<<<<<<
 *             res.w = _fmod(self.w,r)
 *             return res
 */
    __pyx_v_res->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_r);

    /* "cgtypes.pyx":1139
 *             res.y = _fmod(self.y,r)
 *             res.z = _fmod(self.z,r)
 *             res.w = _fmod(self.w,r)             # <<<<<<<<<<<<<<
 *             return res
 *         elif tb==vec4:
 */
    __pyx_v_res->w = __pyx_f_7cgtypes__fmod(__pyx_v_self->w, __pyx_v_r);

    /* "cgtypes.pyx":1140
 *             res.z = _fmod(self.z,r)
 *             res.w = _fmod(self.w,r)
 *             return res             # <<<<<<<<<<<<<<
 *         elif tb==vec4:
 *             # vec4%vec4
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1141
 *             res.w = _fmod(self.w,r)
 *             return res
 *         elif tb==vec4:             # <<<<<<<<<<<<<<
 *             # vec4%vec4
 *             res = vec4()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1143
 *         elif tb==vec4:
 *             # vec4%vec4
 *             res = vec4()             # <<<<<<<<<<<<<<
 *             vb = b
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1144
 *             # vec4%vec4
 *             res = vec4()
 *             vb = b             # <<<<<<<<<<<<<<
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1145
 *             res = vec4()
 *             vb = b
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->x) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->y) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1146
 *             vb = b
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x, vb.x)
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->z) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->w) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1147
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"             # <<<<<<<<<<<<<<
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1148
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x, vb.x)             # <<<<<<<<<<<<<<
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)
 */
    __pyx_v_res->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_vb->x);

    /* "cgtypes.pyx":1149
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)             # <<<<<<<<<<<<<<
 *             res.z = _fmod(self.z, vb.z)
 *             res.w = _fmod(self.w, vb.w)
 */
    __pyx_v_res->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_vb->y);

    /* "cgtypes.pyx":1150
 *             res.x = _fmod(self.x, vb.x)
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)             # <<<<<<<<<<<<<<
 *             res.w = _fmod(self.w, vb.w)
 *             return res
 */
    __pyx_v_res->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_vb->z);

    /* "cgtypes.pyx":1151
 *             res.y = _fmod(self.y, vb.y)
 *             res.z = _fmod(self.z, vb.z)
 *             res.w = _fmod(self.w, vb.w)             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    __pyx_v_res->w = __pyx_f_7cgtypes__fmod(__pyx_v_self->w, __pyx_v_vb->w);

    /* "cgtypes.pyx":1152
 *             res.z = _fmod(self.z, vb.z)
 *             res.w = _fmod(self.w, vb.w)
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1154
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for %"             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_3, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1118
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(vec4 self, b):             # <<<<<<<<<<<<<<
 *         """Modulo (component wise)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1156
 *             raise TypeError, "unsupported operand type for %"
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_23__neg__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_22__neg__[] = "Negation.\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print -a\n        (-3.0000, -2.5000, 1.8000, -0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_22__neg__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_23__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_22__neg__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_22__neg__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cgtypes.pyx":1164
 *         """
 *         cdef vec4 res
 *         res = vec4()             # <<<<<<<<<<<<<<
 *         res.x = -self.x
 *         res.y = -self.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1165
 *         cdef vec4 res
 *         res = vec4()
 *         res.x = -self.x             # <<<<<<<<<<<<<<
 *         res.y = -self.y
 *         res.z = -self.z
 */
  __pyx_v_res->x = (-__pyx_v_self->x);

  /* "cgtypes.pyx":1166
 *         res = vec4()
 *         res.x = -self.x
 *         res.y = -self.y             # <<<<<<<<<<<<<<
 *         res.z = -self.z
 *         res.w = -self.w
 */
  __pyx_v_res->y = (-__pyx_v_self->y);

  /* "cgtypes.pyx":1167
 *         res.x = -self.x
 *         res.y = -self.y
 *         res.z = -self.z             # <<<<<<<<<<<<<<
 *         res.w = -self.w
 *         return res
 */
  __pyx_v_res->z = (-__pyx_v_self->z);

  /* "cgtypes.pyx":1168
 *         res.y = -self.y
 *         res.z = -self.z
 *         res.w = -self.w             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->w = (-__pyx_v_self->w);

  /* "cgtypes.pyx":1169
 *         res.z = -self.z
 *         res.w = -self.w
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1156
 *             raise TypeError, "unsupported operand type for %"
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1171
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> a=vec4(3.0, 2.5, -1.8, 0.2)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_25__pos__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_24__pos__[] = "\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> print +a\n        (3.0000, 2.5000, -1.8000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_24__pos__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_25__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_24__pos__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_24__pos__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "cgtypes.pyx":1178
 *         """
 *         cdef vec4 res
 *         res = vec4()             # <<<<<<<<<<<<<<
 *         res.x = self.x
 *         res.y = self.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1179
 *         cdef vec4 res
 *         res = vec4()
 *         res.x = self.x             # <<<<<<<<<<<<<<
 *         res.y = self.y
 *         res.z = self.z
 */
  __pyx_t_2 = __pyx_v_self->x;
  __pyx_v_res->x = __pyx_t_2;

  /* "cgtypes.pyx":1180
 *         res = vec4()
 *         res.x = self.x
 *         res.y = self.y             # <<<<<<<<<<<<<<
 *         res.z = self.z
 *         res.w = self.w
 */
  __pyx_t_2 = __pyx_v_self->y;
  __pyx_v_res->y = __pyx_t_2;

  /* "cgtypes.pyx":1181
 *         res.x = self.x
 *         res.y = self.y
 *         res.z = self.z             # <<<<<<<<<<<<<<
 *         res.w = self.w
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->z;
  __pyx_v_res->z = __pyx_t_2;

  /* "cgtypes.pyx":1182
 *         res.y = self.y
 *         res.z = self.z
 *         res.w = self.w             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->w;
  __pyx_v_res->w = __pyx_t_2;

  /* "cgtypes.pyx":1183
 *         res.z = self.z
 *         res.w = self.w
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __iadd__(self, vec4 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1171
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> a=vec4(3.0, 2.5, -1.8, 0.2)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1185
 *         return res
 * 
 *     def __iadd__(self, vec4 other):             # <<<<<<<<<<<<<<
 *         """Inline vector addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_26__iadd__[] = "Inline vector addition.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> a+=b\n        >>> print a\n        (0.7000, 1.2500, -1.3000, 0.5000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_26__iadd__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec4, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_26__iadd__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_26__iadd__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "cgtypes.pyx":1194
 *         (0.7000, 1.2500, -1.3000, 0.5000)
 *         """
 *         self.x=self.x+other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x + __pyx_v_other->x);

  /* "cgtypes.pyx":1195
 *         """
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z+other.z
 *         self.w=self.w+other.w
 */
  __pyx_v_self->y = (__pyx_v_self->y + __pyx_v_other->y);

  /* "cgtypes.pyx":1196
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z             # <<<<<<<<<<<<<<
 *         self.w=self.w+other.w
 *         return self
 */
  __pyx_v_self->z = (__pyx_v_self->z + __pyx_v_other->z);

  /* "cgtypes.pyx":1197
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 *         self.w=self.w+other.w             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->w = (__pyx_v_self->w + __pyx_v_other->w);

  /* "cgtypes.pyx":1198
 *         self.z=self.z+other.z
 *         self.w=self.w+other.w
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, vec4 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":1185
 *         return res
 * 
 *     def __iadd__(self, vec4 other):             # <<<<<<<<<<<<<<
 *         """Inline vector addition.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1200
 *         return self
 * 
 *     def __isub__(self, vec4 other):             # <<<<<<<<<<<<<<
 *         """Inline vector subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_28__isub__[] = "Inline vector subtraction.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> b=vec4(-0.3, 0.75, 0.5, 0.3)\n        >>> a-=b\n        >>> print a\n        (1.3000, -0.2500, -2.3000, -0.1000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_28__isub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_vec4, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4vec4_28__isub__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_28__isub__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, struct __pyx_obj_7cgtypes_vec4 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "cgtypes.pyx":1209
 *         (1.3000, -0.2500, -2.3000, -0.1000)
 *         """
 *         self.x=self.x-other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x - __pyx_v_other->x);

  /* "cgtypes.pyx":1210
 *         """
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z-other.z
 *         self.w=self.w-other.w
 */
  __pyx_v_self->y = (__pyx_v_self->y - __pyx_v_other->y);

  /* "cgtypes.pyx":1211
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z             # <<<<<<<<<<<<<<
 *         self.w=self.w-other.w
 *         return self
 */
  __pyx_v_self->z = (__pyx_v_self->z - __pyx_v_other->z);

  /* "cgtypes.pyx":1212
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 *         self.w=self.w-other.w             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->w = (__pyx_v_self->w - __pyx_v_other->w);

  /* "cgtypes.pyx":1213
 *         self.z=self.z-other.z
 *         self.w=self.w-other.w
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":1200
 *         return self
 * 
 *     def __isub__(self, vec4 other):             # <<<<<<<<<<<<<<
 *         """Inline vector subtraction.
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1215
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (only with scalar)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_30__imul__[] = "Inline multiplication (only with scalar)\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> a*=2.0\n        >>> print a\n        (2.0000, 1.0000, -3.6000, 0.4000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_30__imul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_30__imul__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_30__imul__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "cgtypes.pyx":1224
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":1225
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             self.x=self.x*r
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1226
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             self.x=self.x*r
 *             self.y=self.y*r
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1227
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             self.x=self.x*r             # <<<<<<<<<<<<<<
 *             self.y=self.y*r
 *             self.z=self.z*r
 */
    __pyx_v_self->x = (__pyx_v_self->x * __pyx_v_r);

    /* "cgtypes.pyx":1228
 *             r=other
 *             self.x=self.x*r
 *             self.y=self.y*r             # <<<<<<<<<<<<<<
 *             self.z=self.z*r
 *             self.w=self.w*r
 */
    __pyx_v_self->y = (__pyx_v_self->y * __pyx_v_r);

    /* "cgtypes.pyx":1229
 *             self.x=self.x*r
 *             self.y=self.y*r
 *             self.z=self.z*r             # <<<<<<<<<<<<<<
 *             self.w=self.w*r
 *             return self
 */
    __pyx_v_self->z = (__pyx_v_self->z * __pyx_v_r);

    /* "cgtypes.pyx":1230
 *             self.y=self.y*r
 *             self.z=self.z*r
 *             self.w=self.w*r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->w = (__pyx_v_self->w * __pyx_v_r);

    /* "cgtypes.pyx":1231
 *             self.z=self.z*r
 *             self.w=self.w*r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for *="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1233
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for *="             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_4, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1215
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (only with scalar)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1235
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4vec4_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_32__idiv__[] = "Inline division with scalar\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> a/=2.0\n        >>> print a\n        (0.5000, 0.2500, -0.9000, 0.1000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_32__idiv__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_32__idiv__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4vec4_32__idiv__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "cgtypes.pyx":1244
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":1245
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1246
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1247
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 division"
 *             self.x=self.x/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1248
 *             r=other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"             # <<<<<<<<<<<<<<
 *             self.x=self.x/r
 *             self.y=self.y/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1249
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 division"
 *             self.x=self.x/r             # <<<<<<<<<<<<<<
 *             self.y=self.y/r
 *             self.z=self.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->x = (__pyx_v_self->x / __pyx_v_r);

    /* "cgtypes.pyx":1250
 *                 raise ZeroDivisionError,"vec4 division"
 *             self.x=self.x/r
 *             self.y=self.y/r             # <<<<<<<<<<<<<<
 *             self.z=self.z/r
 *             self.w=self.w/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->y = (__pyx_v_self->y / __pyx_v_r);

    /* "cgtypes.pyx":1251
 *             self.x=self.x/r
 *             self.y=self.y/r
 *             self.z=self.z/r             # <<<<<<<<<<<<<<
 *             self.w=self.w/r
 *             return self
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->z = (__pyx_v_self->z / __pyx_v_r);

    /* "cgtypes.pyx":1252
 *             self.y=self.y/r
 *             self.z=self.z/r
 *             self.w=self.w/r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->w = (__pyx_v_self->w / __pyx_v_r);

    /* "cgtypes.pyx":1253
 *             self.z=self.z/r
 *             self.w=self.w/r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1255
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for /="             # <<<<<<<<<<<<<<
 * 
 *     def __imod__(self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_5, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1235
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":1257
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_34__imod__[] = "Inline modulo.\n\n        >>> a=vec4(3.0, 2.5, -1.8, 0.2)\n        >>> a%=2.0\n        >>> print a\n        (1.0000, 0.5000, 0.2000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_34__imod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imod__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_34__imod__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_34__imod__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imod__", 0);

  /* "cgtypes.pyx":1268
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1270
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # vec4%=scalar
 *             r = b
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1272
 *         if tb==float or tb==int or tb==long:
 *             # vec4%=scalar
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1273
 *             # vec4%=scalar
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x,r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1274
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"             # <<<<<<<<<<<<<<
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1275
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x,r)             # <<<<<<<<<<<<<<
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)
 */
    __pyx_v_self->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_r);

    /* "cgtypes.pyx":1276
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)             # <<<<<<<<<<<<<<
 *             self.z = _fmod(self.z,r)
 *             self.w = _fmod(self.w,r)
 */
    __pyx_v_self->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_r);

    /* "cgtypes.pyx":1277
 *             self.x = _fmod(self.x,r)
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)             # <<<<<<<<<<<<<<
 *             self.w = _fmod(self.w,r)
 *             return self
 */
    __pyx_v_self->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_r);

    /* "cgtypes.pyx":1278
 *             self.y = _fmod(self.y,r)
 *             self.z = _fmod(self.z,r)
 *             self.w = _fmod(self.w,r)             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==vec4:
 */
    __pyx_v_self->w = __pyx_f_7cgtypes__fmod(__pyx_v_self->w, __pyx_v_r);

    /* "cgtypes.pyx":1279
 *             self.z = _fmod(self.z,r)
 *             self.w = _fmod(self.w,r)
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==vec4:
 *             # vec4%=vec4
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1280
 *             self.w = _fmod(self.w,r)
 *             return self
 *         elif tb==vec4:             # <<<<<<<<<<<<<<
 *             # vec4%=vec4
 *             vb = b
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1282
 *         elif tb==vec4:
 *             # vec4%=vec4
 *             vb = b             # <<<<<<<<<<<<<<
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1283
 *             # vec4%=vec4
 *             vb = b
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->x) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->y) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1284
 *             vb = b
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x, vb.x)
 */
    __pyx_t_3 = ((fabs(__pyx_v_vb->z) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_vb->w) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1285
 *             if (fabs(vb.x)<=eps or fabs(vb.y)<=eps or
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"             # <<<<<<<<<<<<<<
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_vec4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1286
 *                 fabs(vb.z)<=eps or fabs(vb.w)<=eps):
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x, vb.x)             # <<<<<<<<<<<<<<
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)
 */
    __pyx_v_self->x = __pyx_f_7cgtypes__fmod(__pyx_v_self->x, __pyx_v_vb->x);

    /* "cgtypes.pyx":1287
 *                 raise ZeroDivisionError,"vec4 modulo"
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)             # <<<<<<<<<<<<<<
 *             self.z = _fmod(self.z, vb.z)
 *             self.w = _fmod(self.w, vb.w)
 */
    __pyx_v_self->y = __pyx_f_7cgtypes__fmod(__pyx_v_self->y, __pyx_v_vb->y);

    /* "cgtypes.pyx":1288
 *             self.x = _fmod(self.x, vb.x)
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)             # <<<<<<<<<<<<<<
 *             self.w = _fmod(self.w, vb.w)
 *             return self
 */
    __pyx_v_self->z = __pyx_f_7cgtypes__fmod(__pyx_v_self->z, __pyx_v_vb->z);

    /* "cgtypes.pyx":1289
 *             self.y = _fmod(self.y, vb.y)
 *             self.z = _fmod(self.z, vb.z)
 *             self.w = _fmod(self.w, vb.w)             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->w = __pyx_f_7cgtypes__fmod(__pyx_v_self->w, __pyx_v_vb->w);

    /* "cgtypes.pyx":1290
 *             self.z = _fmod(self.z, vb.z)
 *             self.w = _fmod(self.w, vb.w)
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1292
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for %="             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_6, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1257
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__imod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1295
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_37__abs__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_36__abs__[] = "Return the length of the vector.\n\n        abs(v) is equivalent to v.length().\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print abs(a)\n        2.12837966538\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_36__abs__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_37__abs__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_36__abs__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_36__abs__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__abs__", 0);

  /* "cgtypes.pyx":1305
 *         """
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w             # <<<<<<<<<<<<<<
 *         return sqrt(a)
 * 
 */
  __pyx_v_a = ((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)) + (__pyx_v_self->w * __pyx_v_self->w));

  /* "cgtypes.pyx":1306
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w
 *         return sqrt(a)             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1295
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1308
 *         return sqrt(a)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             return self.x
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_39__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4vec4_39__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_38__getattr__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_38__getattr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "cgtypes.pyx":1309
 * 
 *     def __getattr__(self, name):
 *         if name=="x":             # <<<<<<<<<<<<<<
 *             return self.x
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1310
 *     def __getattr__(self, name):
 *         if name=="x":
 *             return self.x             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             return self.y
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1311
 *         if name=="x":
 *             return self.x
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             return self.y
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1312
 *             return self.x
 *         elif name=="y":
 *             return self.y             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             return self.z
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1313
 *         elif name=="y":
 *             return self.y
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             return self.z
 *         elif name=="w" or name=="t":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1314
 *             return self.y
 *         elif name=="z":
 *             return self.z             # <<<<<<<<<<<<<<
 *         elif name=="w" or name=="t":
 *             return self.w
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1315
 *         elif name=="z":
 *             return self.z
 *         elif name=="w" or name=="t":             # <<<<<<<<<<<<<<
 *             return self.w
 *         else:
 */
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_w, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_t, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1316
 *             return self.z
 *         elif name=="w" or name=="t":
 *             return self.w             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"vec4 has no attribute '"+name+"'"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1318
 *             return self.w
 *         else:
 *             raise AttributeError,"vec4 has no attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 *     def __setattr__(self, name, val):
 */
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_vec4_has_no_attribute, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1308
 *         return sqrt(a)
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             return self.x
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.vec4.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1320
 *             raise AttributeError,"vec4 has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             self.x = val
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec4_41__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /*proto*/
static int __pyx_pw_7cgtypes_4vec4_41__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_40__setattr__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_val));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec4_40__setattr__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "cgtypes.pyx":1321
 * 
 *     def __setattr__(self, name, val):
 *         if name=="x":             # <<<<<<<<<<<<<<
 *             self.x = val
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1322
 *     def __setattr__(self, name, val):
 *         if name=="x":
 *             self.x = val             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             self.y = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->x = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":1323
 *         if name=="x":
 *             self.x = val
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             self.y = val
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1324
 *             self.x = val
 *         elif name=="y":
 *             self.y = val             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             self.z = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->y = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":1325
 *         elif name=="y":
 *             self.y = val
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             self.z = val
 *         elif name=="w" or name=="t":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1326
 *             self.y = val
 *         elif name=="z":
 *             self.z = val             # <<<<<<<<<<<<<<
 *         elif name=="w" or name=="t":
 *             self.w = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->z = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":1327
 *         elif name=="z":
 *             self.z = val
 *         elif name=="w" or name=="t":             # <<<<<<<<<<<<<<
 *             self.w = val
 *         else:
 */
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_w, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_t, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1328
 *             self.z = val
 *         elif name=="w" or name=="t":
 *             self.w = val             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"vec4 has no writable attribute '"+name+"'"
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->w = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":1330
 *             self.w = val
 *         else:
 *             raise AttributeError,"vec4 has no writable attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __pyx_t_4 = PyNumber_Add(__pyx_kp_s_vec4_has_no_writable_attribute, __pyx_v_name); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_5, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":1320
 *             raise AttributeError,"vec4 has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="x":
 *             self.x = val
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.vec4.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1332
 *             raise AttributeError,"vec4 has no writable attribute '"+name+"'"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 4)."""
 *         return 4
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7cgtypes_4vec4_43__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_42__len__[] = "Length of the sequence (always 4).";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_42__len__;
#endif
static Py_ssize_t __pyx_pw_7cgtypes_4vec4_43__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_42__len__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_7cgtypes_4vec4_42__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "cgtypes.pyx":1334
 *     def __len__(self):
 *         """Length of the sequence (always 4)."""
 *         return 4             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
 */
  __pyx_r = 4;
  goto __pyx_L0;

  /* "cgtypes.pyx":1332
 *             raise AttributeError,"vec4 has no writable attribute '"+name+"'"
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 4)."""
 *         return 4
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1336
 *         return 4
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """Return a component by index (0-based).
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_45__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_44__getitem__[] = "Return a component by index (0-based).\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a[0]\n        1.0\n        >>> print a[1]\n        0.5\n        >>> print a[2]\n        -1.8\n        >>> print a[3]\n        0.2\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_44__getitem__;
#endif
static PyObject *__pyx_pw_7cgtypes_4vec4_45__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_44__getitem__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_44__getitem__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_k;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "cgtypes.pyx":1351
 *         cdef int k
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":1352
 * 
 *         T=type(key)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError, "index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1353
 *         T=type(key)
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         k = key
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1355
 *             raise TypeError, "index must be integer"
 * 
 *         k = key             # <<<<<<<<<<<<<<
 *         if   k==0: return self.x
 *         elif k==1: return self.y
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_4;

  /* "cgtypes.pyx":1359
 *         elif k==1: return self.y
 *         elif k==2: return self.z
 *         elif k==3: return self.w             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
  switch (__pyx_v_k) {

    /* "cgtypes.pyx":1356
 * 
 *         k = key
 *         if   k==0: return self.x             # <<<<<<<<<<<<<<
 *         elif k==1: return self.y
 *         elif k==2: return self.z
 */
    case 0:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1357
 *         k = key
 *         if   k==0: return self.x
 *         elif k==1: return self.y             # <<<<<<<<<<<<<<
 *         elif k==2: return self.z
 *         elif k==3: return self.w
 */
    case 1:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1358
 *         if   k==0: return self.x
 *         elif k==1: return self.y
 *         elif k==2: return self.z             # <<<<<<<<<<<<<<
 *         elif k==3: return self.w
 *         else:
 */
    case 2:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1359
 *         elif k==1: return self.y
 *         elif k==2: return self.z
 *         elif k==3: return self.w             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
    case 3:
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":1361
 *         elif k==3: return self.w
 *         else:
 *             raise IndexError,"index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":1336
 *         return 4
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """Return a component by index (0-based).
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1363
 *             raise IndexError,"index out of range"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a component by index (0-based).
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4vec4_47__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_46__setitem__[] = "Set a component by index (0-based).\n\n        >>> a=vec4()\n        >>> a[0]=1.5; a[1]=0.7; a[2]=-0.3; a[3]=0.2\n        >>> print a\n        (1.5000, 0.7000, -0.3000, 0.2000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4vec4_46__setitem__;
#endif
static int __pyx_pw_7cgtypes_4vec4_47__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_46__setitem__(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4vec4_46__setitem__(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_v_k;
  PyObject *__pyx_v_T = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "cgtypes.pyx":1373
 *         cdef int k
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":1374
 * 
 *         T=type(key)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError, "index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1375
 *         T=type(key)
 *         if T!=int and T!=long:
 *             raise TypeError, "index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         k = key
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1377
 *             raise TypeError, "index must be integer"
 * 
 *         k = key             # <<<<<<<<<<<<<<
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_4;

  /* "cgtypes.pyx":1381
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value
 *         elif k==3: self.w = value             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
  switch (__pyx_v_k) {

    /* "cgtypes.pyx":1378
 * 
 *         k = key
 *         if   k==0: self.x = value             # <<<<<<<<<<<<<<
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value
 */
    case 0:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->x = __pyx_t_5;
    break;

    /* "cgtypes.pyx":1379
 *         k = key
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value             # <<<<<<<<<<<<<<
 *         elif k==2: self.z = value
 *         elif k==3: self.w = value
 */
    case 1:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->y = __pyx_t_5;
    break;

    /* "cgtypes.pyx":1380
 *         if   k==0: self.x = value
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value             # <<<<<<<<<<<<<<
 *         elif k==3: self.w = value
 *         else:
 */
    case 2:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->z = __pyx_t_5;
    break;

    /* "cgtypes.pyx":1381
 *         elif k==1: self.y = value
 *         elif k==2: self.z = value
 *         elif k==3: self.w = value             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError,"index out of range"
 */
    case 3:
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->w = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":1383
 *         elif k==3: self.w = value
 *         else:
 *             raise IndexError,"index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def length(self):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":1363
 *             raise IndexError,"index out of range"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a component by index (0-based).
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1385
 *             raise IndexError,"index out of range"
 * 
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_49length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_48length[] = "Return the length of the vector.\n\n        v.length() is equivalent to abs(v).\n\n        >>> a=vec4(1.0, 0.5, -1.8, 0.2)\n        >>> print a.length()\n        2.12837966538\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec4_49length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("length (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_48length(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_48length(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("length", 0);

  /* "cgtypes.pyx":1395
 *         """
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w             # <<<<<<<<<<<<<<
 *         return sqrt(a)
 * 
 */
  __pyx_v_a = ((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)) + (__pyx_v_self->w * __pyx_v_self->w));

  /* "cgtypes.pyx":1396
 *         cdef double a
 *         a = self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w
 *         return sqrt(a)             # <<<<<<<<<<<<<<
 * 
 *     def normalize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1385
 *             raise IndexError,"index out of range"
 * 
 *     def length(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.vec4.length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1398
 *         return sqrt(a)
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized vector.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4vec4_51normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4vec4_50normalize[] = "Return normalized vector.\n\n        >>> a=vec4(1.0, 0.5, -1.8, 1.2)\n        >>> print a.normalize()\n        (0.4107, 0.2053, -0.7392, 0.4928)\n        ";
static PyObject *__pyx_pw_7cgtypes_4vec4_51normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4vec4_50normalize(((struct __pyx_obj_7cgtypes_vec4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4vec4_50normalize(struct __pyx_obj_7cgtypes_vec4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_res = 0;
  double __pyx_v_nlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "cgtypes.pyx":1408
 *         cdef double nlen
 * 
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w)             # <<<<<<<<<<<<<<
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 */
  __pyx_v_nlen = sqrt(((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)) + (__pyx_v_self->w * __pyx_v_self->w)));

  /* "cgtypes.pyx":1409
 * 
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w)
 *         if nlen<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 */
  __pyx_t_1 = ((__pyx_v_nlen <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1410
 *         nlen = sqrt(self.x*self.x + self.y*self.y + self.z*self.z + self.w*self.w)
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"             # <<<<<<<<<<<<<<
 *         nlen = 1.0/nlen
 *         res = vec4()
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_null_vector_can_t_be_normalized, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1411
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen             # <<<<<<<<<<<<<<
 *         res = vec4()
 *         res.x = self.x*nlen
 */
  if (unlikely(__pyx_v_nlen == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nlen = (1.0 / __pyx_v_nlen);

  /* "cgtypes.pyx":1412
 *             raise ZeroDivisionError,"null vector can't be normalized"
 *         nlen = 1.0/nlen
 *         res = vec4()             # <<<<<<<<<<<<<<
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":1413
 *         nlen = 1.0/nlen
 *         res = vec4()
 *         res.x = self.x*nlen             # <<<<<<<<<<<<<<
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 */
  __pyx_v_res->x = (__pyx_v_self->x * __pyx_v_nlen);

  /* "cgtypes.pyx":1414
 *         res = vec4()
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen             # <<<<<<<<<<<<<<
 *         res.z = self.z*nlen
 *         res.w = self.w*nlen
 */
  __pyx_v_res->y = (__pyx_v_self->y * __pyx_v_nlen);

  /* "cgtypes.pyx":1415
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen             # <<<<<<<<<<<<<<
 *         res.w = self.w*nlen
 *         return res
 */
  __pyx_v_res->z = (__pyx_v_self->z * __pyx_v_nlen);

  /* "cgtypes.pyx":1416
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 *         res.w = self.w*nlen             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->w = (__pyx_v_self->w * __pyx_v_nlen);

  /* "cgtypes.pyx":1417
 *         res.z = self.z*nlen
 *         res.w = self.w*nlen
 *         return res             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1398
 *         return sqrt(a)
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized vector.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.vec4.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1427
 *     cdef object m
 * 
 *     def __cinit__(self, m):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.m   = m
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_8mat3iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_8mat3iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_m = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3iter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_8mat3iter___cinit__(((struct __pyx_obj_7cgtypes_mat3iter *)__pyx_v_self), __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_8mat3iter___cinit__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self, PyObject *__pyx_v_m) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":1428
 * 
 *     def __cinit__(self, m):
 *         self.idx = 0             # <<<<<<<<<<<<<<
 *         self.m   = m
 * 
 */
  __pyx_v_self->idx = 0;

  /* "cgtypes.pyx":1429
 *     def __cinit__(self, m):
 *         self.idx = 0
 *         self.m   = m             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_GIVEREF(__pyx_v_m);
  __Pyx_GOTREF(__pyx_v_self->m);
  __Pyx_DECREF(__pyx_v_self->m);
  __pyx_v_self->m = __pyx_v_m;

  /* "cgtypes.pyx":1427
 *     cdef object m
 * 
 *     def __cinit__(self, m):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.m   = m
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1431
 *         self.m   = m
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8mat3iter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8mat3iter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8mat3iter_2__iter__(((struct __pyx_obj_7cgtypes_mat3iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8mat3iter_2__iter__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":1432
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":1431
 *         self.m   = m
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1434
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8mat3iter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8mat3iter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8mat3iter_4__next__(((struct __pyx_obj_7cgtypes_mat3iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8mat3iter_4__next__(struct __pyx_obj_7cgtypes_mat3iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "cgtypes.pyx":1441
 *             self.idx=2
 *             return self.m[1]
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.m[2]
 */
  switch (__pyx_v_self->idx) {

    /* "cgtypes.pyx":1435
 * 
 *     def __next__(self):
 *         if self.idx==0:             # <<<<<<<<<<<<<<
 *             self.idx=1
 *             return self.m[0]
 */
    case 0:

    /* "cgtypes.pyx":1436
 *     def __next__(self):
 *         if self.idx==0:
 *             self.idx=1             # <<<<<<<<<<<<<<
 *             return self.m[0]
 *         elif self.idx==1:
 */
    __pyx_v_self->idx = 1;

    /* "cgtypes.pyx":1437
 *         if self.idx==0:
 *             self.idx=1
 *             return self.m[0]             # <<<<<<<<<<<<<<
 *         elif self.idx==1:
 *             self.idx=2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1438
 *             self.idx=1
 *             return self.m[0]
 *         elif self.idx==1:             # <<<<<<<<<<<<<<
 *             self.idx=2
 *             return self.m[1]
 */
    case 1:

    /* "cgtypes.pyx":1439
 *             return self.m[0]
 *         elif self.idx==1:
 *             self.idx=2             # <<<<<<<<<<<<<<
 *             return self.m[1]
 *         elif self.idx==2:
 */
    __pyx_v_self->idx = 2;

    /* "cgtypes.pyx":1440
 *         elif self.idx==1:
 *             self.idx=2
 *             return self.m[1]             # <<<<<<<<<<<<<<
 *         elif self.idx==2:
 *             self.idx=3
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1441
 *             self.idx=2
 *             return self.m[1]
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.m[2]
 */
    case 2:

    /* "cgtypes.pyx":1442
 *             return self.m[1]
 *         elif self.idx==2:
 *             self.idx=3             # <<<<<<<<<<<<<<
 *             return self.m[2]
 *         else:
 */
    __pyx_v_self->idx = 3;

    /* "cgtypes.pyx":1443
 *         elif self.idx==2:
 *             self.idx=3
 *             return self.m[2]             # <<<<<<<<<<<<<<
 *         else:
 *             raise StopIteration
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":1445
 *             return self.m[2]
 *         else:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * # mat3
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":1434
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3iter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1454
 *     cdef double m31, m32, m33
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4mat3_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_4mat3_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7cgtypes_4mat3___cinit__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4mat3___cinit__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_arglen;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_B = 0;
  CYTHON_UNUSED double __pyx_v_m11;
  CYTHON_UNUSED double __pyx_v_m12;
  CYTHON_UNUSED double __pyx_v_m13;
  CYTHON_UNUSED double __pyx_v_m21;
  CYTHON_UNUSED double __pyx_v_m22;
  CYTHON_UNUSED double __pyx_v_m23;
  CYTHON_UNUSED double __pyx_v_m31;
  CYTHON_UNUSED double __pyx_v_m32;
  CYTHON_UNUSED double __pyx_v_m33;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_v_s = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_seq = NULL;
  Py_ssize_t __pyx_v_seqlen;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_c = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":1473
 *         cdef int arglen
 *         cdef mat3 B
 *         arglen = len(args)             # <<<<<<<<<<<<<<
 * 
 *         # No arguments
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arglen = __pyx_t_1;

  /* "cgtypes.pyx":1576
 * 
 *         # 9 arguments
 *         elif arglen==9:             # <<<<<<<<<<<<<<
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 */
  switch (__pyx_v_arglen) {

    /* "cgtypes.pyx":1476
 * 
 *         # No arguments
 *         if arglen==0:             # <<<<<<<<<<<<<<
 *             m11=m12=m13=0.0
 *             m21=m22=m23=0.0
 */
    case 0:

    /* "cgtypes.pyx":1477
 *         # No arguments
 *         if arglen==0:
 *             m11=m12=m13=0.0             # <<<<<<<<<<<<<<
 *             m21=m22=m23=0.0
 *             m31=m32=m33=0.0
 */
    __pyx_v_m11 = 0.0;
    __pyx_v_m12 = 0.0;
    __pyx_v_m13 = 0.0;

    /* "cgtypes.pyx":1478
 *         if arglen==0:
 *             m11=m12=m13=0.0
 *             m21=m22=m23=0.0             # <<<<<<<<<<<<<<
 *             m31=m32=m33=0.0
 * 
 */
    __pyx_v_m21 = 0.0;
    __pyx_v_m22 = 0.0;
    __pyx_v_m23 = 0.0;

    /* "cgtypes.pyx":1479
 *             m11=m12=m13=0.0
 *             m21=m22=m23=0.0
 *             m31=m32=m33=0.0             # <<<<<<<<<<<<<<
 * 
 *         # 1 argument (list, scalar or mat3)
 */
    __pyx_v_m31 = 0.0;
    __pyx_v_m32 = 0.0;
    __pyx_v_m33 = 0.0;
    break;

    /* "cgtypes.pyx":1482
 * 
 *         # 1 argument (list, scalar or mat3)
 *         elif arglen==1:             # <<<<<<<<<<<<<<
 *             T = type(args[0])
 *             # scalar
 */
    case 1:

    /* "cgtypes.pyx":1483
 *         # 1 argument (list, scalar or mat3)
 *         elif arglen==1:
 *             T = type(args[0])             # <<<<<<<<<<<<<<
 *             # scalar
 *             if T==float or T==int or T==long:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2)));
    __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_t_2)));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":1485
 *             T = type(args[0])
 *             # scalar
 *             if T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":1486
 *             # scalar
 *             if T==float or T==int or T==long:
 *                 self.m11 = args[0]             # <<<<<<<<<<<<<<
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":1487
 *             if T==float or T==int or T==long:
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m13 = 0.0
 *                 self.m21 = 0.0
 */
      __pyx_v_self->m12 = 0.0;

      /* "cgtypes.pyx":1488
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11
 */
      __pyx_v_self->m13 = 0.0;

      /* "cgtypes.pyx":1489
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0
 *                 self.m21 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0
 */
      __pyx_v_self->m21 = 0.0;

      /* "cgtypes.pyx":1490
 *                 self.m13 = 0.0
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11             # <<<<<<<<<<<<<<
 *                 self.m23 = 0.0
 *                 self.m31 = 0.0
 */
      __pyx_t_5 = __pyx_v_self->m11;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":1491
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0
 */
      __pyx_v_self->m23 = 0.0;

      /* "cgtypes.pyx":1492
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0
 *                 self.m31 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m32 = 0.0
 *                 self.m33 = self.m11
 */
      __pyx_v_self->m31 = 0.0;

      /* "cgtypes.pyx":1493
 *                 self.m23 = 0.0
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m33 = self.m11
 * 
 */
      __pyx_v_self->m32 = 0.0;

      /* "cgtypes.pyx":1494
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0
 *                 self.m33 = self.m11             # <<<<<<<<<<<<<<
 * 
 *             # mat3
 */
      __pyx_t_5 = __pyx_v_self->m11;
      __pyx_v_self->m33 = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":1497
 * 
 *             # mat3
 *             elif T==mat3:             # <<<<<<<<<<<<<<
 *                 B = args[0]
 *                 self.m11 = B.m11
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":1498
 *             # mat3
 *             elif T==mat3:
 *                 B = args[0]             # <<<<<<<<<<<<<<
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_B = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":1499
 *             elif T==mat3:
 *                 B = args[0]
 *                 self.m11 = B.m11             # <<<<<<<<<<<<<<
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 */
      __pyx_t_5 = __pyx_v_B->m11;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":1500
 *                 B = args[0]
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12             # <<<<<<<<<<<<<<
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21
 */
      __pyx_t_5 = __pyx_v_B->m12;
      __pyx_v_self->m12 = __pyx_t_5;

      /* "cgtypes.pyx":1501
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13             # <<<<<<<<<<<<<<
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 */
      __pyx_t_5 = __pyx_v_B->m13;
      __pyx_v_self->m13 = __pyx_t_5;

      /* "cgtypes.pyx":1502
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21             # <<<<<<<<<<<<<<
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 */
      __pyx_t_5 = __pyx_v_B->m21;
      __pyx_v_self->m21 = __pyx_t_5;

      /* "cgtypes.pyx":1503
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22             # <<<<<<<<<<<<<<
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31
 */
      __pyx_t_5 = __pyx_v_B->m22;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":1504
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23             # <<<<<<<<<<<<<<
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 */
      __pyx_t_5 = __pyx_v_B->m23;
      __pyx_v_self->m23 = __pyx_t_5;

      /* "cgtypes.pyx":1505
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31             # <<<<<<<<<<<<<<
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 */
      __pyx_t_5 = __pyx_v_B->m31;
      __pyx_v_self->m31 = __pyx_t_5;

      /* "cgtypes.pyx":1506
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32             # <<<<<<<<<<<<<<
 *                 self.m33 = B.m33
 *             # String
 */
      __pyx_t_5 = __pyx_v_B->m32;
      __pyx_v_self->m32 = __pyx_t_5;

      /* "cgtypes.pyx":1507
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33             # <<<<<<<<<<<<<<
 *             # String
 *             elif T==str or T==unicode:
 */
      __pyx_t_5 = __pyx_v_B->m33;
      __pyx_v_self->m33 = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":1509
 *                 self.m33 = B.m33
 *             # String
 *             elif T==str or T==unicode:             # <<<<<<<<<<<<<<
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":1510
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":1511
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:             # <<<<<<<<<<<<<<
 *                     s=[]
 *                 for i in range(len(s)):
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s__7);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__7);
      __Pyx_GIVEREF(__pyx_kp_s__7);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_s, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {

        /* "cgtypes.pyx":1512
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 *                     s=[]             # <<<<<<<<<<<<<<
 *                 for i in range(len(s)):
 *                     try:
 */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":1513
 *                 if s==[""]:
 *                     s=[]
 *                 for i in range(len(s)):             # <<<<<<<<<<<<<<
 *                     try:
 *                         s[i] = float(s[i])
 */
      __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "cgtypes.pyx":1514
 *                     s=[]
 *                 for i in range(len(s)):
 *                     try:             # <<<<<<<<<<<<<<
 *                         s[i] = float(s[i])
 *                     except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cgtypes.pyx":1515
 *                 for i in range(len(s)):
 *                     try:
 *                         s[i] = float(s[i])             # <<<<<<<<<<<<<<
 *                     except:
 *                         raise ValueError,"mat3() arg is a malformed string"
 */
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (unlikely(__Pyx_SetItemInt(__pyx_v_s, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cgtypes.pyx":1516
 *                     try:
 *                         s[i] = float(s[i])
 *                     except:             # <<<<<<<<<<<<<<
 *                         raise ValueError,"mat3() arg is a malformed string"
 *                 B = mat3(s)
 */
          /*except:*/ {
            __Pyx_AddTraceback("cgtypes.mat3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_6);

            /* "cgtypes.pyx":1517
 *                         s[i] = float(s[i])
 *                     except:
 *                         raise ValueError,"mat3() arg is a malformed string"             # <<<<<<<<<<<<<<
 *                 B = mat3(s)
 *                 self.m11 = B.m11
 */
            __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_mat3_arg_is_a_malformed_string, 0, 0);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          }
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L19_try_end:;
        }
      }

      /* "cgtypes.pyx":1518
 *                     except:
 *                         raise ValueError,"mat3() arg is a malformed string"
 *                 B = mat3(s)             # <<<<<<<<<<<<<<
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_B = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":1519
 *                         raise ValueError,"mat3() arg is a malformed string"
 *                 B = mat3(s)
 *                 self.m11 = B.m11             # <<<<<<<<<<<<<<
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 */
      __pyx_t_5 = __pyx_v_B->m11;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":1520
 *                 B = mat3(s)
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12             # <<<<<<<<<<<<<<
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21
 */
      __pyx_t_5 = __pyx_v_B->m12;
      __pyx_v_self->m12 = __pyx_t_5;

      /* "cgtypes.pyx":1521
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13             # <<<<<<<<<<<<<<
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 */
      __pyx_t_5 = __pyx_v_B->m13;
      __pyx_v_self->m13 = __pyx_t_5;

      /* "cgtypes.pyx":1522
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21             # <<<<<<<<<<<<<<
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 */
      __pyx_t_5 = __pyx_v_B->m21;
      __pyx_v_self->m21 = __pyx_t_5;

      /* "cgtypes.pyx":1523
 *                 self.m13 = B.m13
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22             # <<<<<<<<<<<<<<
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31
 */
      __pyx_t_5 = __pyx_v_B->m22;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":1524
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23             # <<<<<<<<<<<<<<
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 */
      __pyx_t_5 = __pyx_v_B->m23;
      __pyx_v_self->m23 = __pyx_t_5;

      /* "cgtypes.pyx":1525
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31             # <<<<<<<<<<<<<<
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 */
      __pyx_t_5 = __pyx_v_B->m31;
      __pyx_v_self->m31 = __pyx_t_5;

      /* "cgtypes.pyx":1526
 *                 self.m23 = B.m23
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32             # <<<<<<<<<<<<<<
 *                 self.m33 = B.m33
 *             # Sequence of 9 floats
 */
      __pyx_t_5 = __pyx_v_B->m32;
      __pyx_v_self->m32 = __pyx_t_5;

      /* "cgtypes.pyx":1527
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33             # <<<<<<<<<<<<<<
 *             # Sequence of 9 floats
 *             else:
 */
      __pyx_t_5 = __pyx_v_B->m33;
      __pyx_v_self->m33 = __pyx_t_5;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cgtypes.pyx":1530
 *             # Sequence of 9 floats
 *             else:
 *                 seq = args[0]             # <<<<<<<<<<<<<<
 *                 try:
 *                     seqlen = len(seq)
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seq = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":1531
 *             else:
 *                 seq = args[0]
 *                 try:             # <<<<<<<<<<<<<<
 *                     seqlen = len(seq)
 *                 except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cgtypes.pyx":1532
 *                 seq = args[0]
 *                 try:
 *                     seqlen = len(seq)             # <<<<<<<<<<<<<<
 *                 except:
 *                     raise TypeError,"mat3() arg can't be converted to mat3"
 */
          __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1532; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __pyx_v_seqlen = __pyx_t_1;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cgtypes.pyx":1533
 *                 try:
 *                     seqlen = len(seq)
 *                 except:             # <<<<<<<<<<<<<<
 *                     raise TypeError,"mat3() arg can't be converted to mat3"
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cgtypes.mat3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cgtypes.pyx":1534
 *                     seqlen = len(seq)
 *                 except:
 *                     raise TypeError,"mat3() arg can't be converted to mat3"             # <<<<<<<<<<<<<<
 * 
 *                 if seqlen==9:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat3_arg_can_t_be_converted_to_m, 0, 0);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1534; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_L24_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L29_try_end:;
      }

      /* "cgtypes.pyx":1536
 *                     raise TypeError,"mat3() arg can't be converted to mat3"
 * 
 *                 if seqlen==9:             # <<<<<<<<<<<<<<
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 9) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":1537
 * 
 *                 if seqlen==9:
 *                     self.m11 = seq[0]             # <<<<<<<<<<<<<<
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m11 = __pyx_t_5;

        /* "cgtypes.pyx":1538
 *                 if seqlen==9:
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]             # <<<<<<<<<<<<<<
 *                     self.m13 = seq[2]
 *                     self.m21 = seq[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m12 = __pyx_t_5;

        /* "cgtypes.pyx":1539
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]             # <<<<<<<<<<<<<<
 *                     self.m21 = seq[3]
 *                     self.m22 = seq[4]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m13 = __pyx_t_5;

        /* "cgtypes.pyx":1540
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]
 *                     self.m21 = seq[3]             # <<<<<<<<<<<<<<
 *                     self.m22 = seq[4]
 *                     self.m23 = seq[5]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m21 = __pyx_t_5;

        /* "cgtypes.pyx":1541
 *                     self.m13 = seq[2]
 *                     self.m21 = seq[3]
 *                     self.m22 = seq[4]             # <<<<<<<<<<<<<<
 *                     self.m23 = seq[5]
 *                     self.m31 = seq[6]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m22 = __pyx_t_5;

        /* "cgtypes.pyx":1542
 *                     self.m21 = seq[3]
 *                     self.m22 = seq[4]
 *                     self.m23 = seq[5]             # <<<<<<<<<<<<<<
 *                     self.m31 = seq[6]
 *                     self.m32 = seq[7]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m23 = __pyx_t_5;

        /* "cgtypes.pyx":1543
 *                     self.m22 = seq[4]
 *                     self.m23 = seq[5]
 *                     self.m31 = seq[6]             # <<<<<<<<<<<<<<
 *                     self.m32 = seq[7]
 *                     self.m33 = seq[8]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m31 = __pyx_t_5;

        /* "cgtypes.pyx":1544
 *                     self.m23 = seq[5]
 *                     self.m31 = seq[6]
 *                     self.m32 = seq[7]             # <<<<<<<<<<<<<<
 *                     self.m33 = seq[8]
 *                 elif seqlen==3:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m32 = __pyx_t_5;

        /* "cgtypes.pyx":1545
 *                     self.m31 = seq[6]
 *                     self.m32 = seq[7]
 *                     self.m33 = seq[8]             # <<<<<<<<<<<<<<
 *                 elif seqlen==3:
 *                     b = seq[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m33 = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":1546
 *                     self.m32 = seq[7]
 *                     self.m33 = seq[8]
 *                 elif seqlen==3:             # <<<<<<<<<<<<<<
 *                     b = seq[0]
 *                     self.m11 = b[0]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 3) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":1547
 *                     self.m33 = seq[8]
 *                 elif seqlen==3:
 *                     b = seq[0]             # <<<<<<<<<<<<<<
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_b = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":1548
 *                 elif seqlen==3:
 *                     b = seq[0]
 *                     self.m11 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m11 = __pyx_t_5;

        /* "cgtypes.pyx":1549
 *                     b = seq[0]
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m31 = b[2]
 *                     b = seq[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m21 = __pyx_t_5;

        /* "cgtypes.pyx":1550
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]             # <<<<<<<<<<<<<<
 *                     b = seq[1]
 *                     self.m12 = b[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m31 = __pyx_t_5;

        /* "cgtypes.pyx":1551
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]
 *                     b = seq[1]             # <<<<<<<<<<<<<<
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":1552
 *                     self.m31 = b[2]
 *                     b = seq[1]
 *                     self.m12 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m12 = __pyx_t_5;

        /* "cgtypes.pyx":1553
 *                     b = seq[1]
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m32 = b[2]
 *                     b = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m22 = __pyx_t_5;

        /* "cgtypes.pyx":1554
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]             # <<<<<<<<<<<<<<
 *                     b = seq[2]
 *                     self.m13 = b[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m32 = __pyx_t_5;

        /* "cgtypes.pyx":1555
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]
 *                     b = seq[2]             # <<<<<<<<<<<<<<
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":1556
 *                     self.m32 = b[2]
 *                     b = seq[2]
 *                     self.m13 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m23 = b[1]
 *                     self.m33 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m13 = __pyx_t_5;

        /* "cgtypes.pyx":1557
 *                     b = seq[2]
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m33 = b[2]
 *                 else:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m23 = __pyx_t_5;

        /* "cgtypes.pyx":1558
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]
 *                     self.m33 = b[2]             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError, "mat3() takes at most 9 arguments"
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m33 = __pyx_t_5;
        goto __pyx_L32;
      }
      /*else*/ {

        /* "cgtypes.pyx":1560
 *                     self.m33 = b[2]
 *                 else:
 *                     raise TypeError, "mat3() takes at most 9 arguments"             # <<<<<<<<<<<<<<
 * 
 *         # 3 arguments (columns as sequences)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat3_takes_at_most_9_arguments, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L32:;
    }
    __pyx_L3:;
    break;

    /* "cgtypes.pyx":1563
 * 
 *         # 3 arguments (columns as sequences)
 *         elif arglen==3:             # <<<<<<<<<<<<<<
 *             a,b,c=args
 *             self.m11 = a[0]
 */
    case 3:

    /* "cgtypes.pyx":1564
 *         # 3 arguments (columns as sequences)
 *         elif arglen==3:
 *             a,b,c=args             # <<<<<<<<<<<<<<
 *             self.m11 = a[0]
 *             self.m12 = b[0]
 */
    if (1) {
      PyObject* sequence = __pyx_v_args;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      #endif
    }
    __pyx_v_a = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_b = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_c = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1565
 *         elif arglen==3:
 *             a,b,c=args
 *             self.m11 = a[0]             # <<<<<<<<<<<<<<
 *             self.m12 = b[0]
 *             self.m13 = c[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_5;

    /* "cgtypes.pyx":1566
 *             a,b,c=args
 *             self.m11 = a[0]
 *             self.m12 = b[0]             # <<<<<<<<<<<<<<
 *             self.m13 = c[0]
 *             self.m21 = a[1]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_5;

    /* "cgtypes.pyx":1567
 *             self.m11 = a[0]
 *             self.m12 = b[0]
 *             self.m13 = c[0]             # <<<<<<<<<<<<<<
 *             self.m21 = a[1]
 *             self.m22 = b[1]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_5;

    /* "cgtypes.pyx":1568
 *             self.m12 = b[0]
 *             self.m13 = c[0]
 *             self.m21 = a[1]             # <<<<<<<<<<<<<<
 *             self.m22 = b[1]
 *             self.m23 = c[1]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_5;

    /* "cgtypes.pyx":1569
 *             self.m13 = c[0]
 *             self.m21 = a[1]
 *             self.m22 = b[1]             # <<<<<<<<<<<<<<
 *             self.m23 = c[1]
 *             self.m31 = a[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_5;

    /* "cgtypes.pyx":1570
 *             self.m21 = a[1]
 *             self.m22 = b[1]
 *             self.m23 = c[1]             # <<<<<<<<<<<<<<
 *             self.m31 = a[2]
 *             self.m32 = b[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_5;

    /* "cgtypes.pyx":1571
 *             self.m22 = b[1]
 *             self.m23 = c[1]
 *             self.m31 = a[2]             # <<<<<<<<<<<<<<
 *             self.m32 = b[2]
 *             self.m33 = c[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_a, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1571; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_5;

    /* "cgtypes.pyx":1572
 *             self.m23 = c[1]
 *             self.m31 = a[2]
 *             self.m32 = b[2]             # <<<<<<<<<<<<<<
 *             self.m33 = c[2]
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_5;

    /* "cgtypes.pyx":1573
 *             self.m31 = a[2]
 *             self.m32 = b[2]
 *             self.m33 = c[2]             # <<<<<<<<<<<<<<
 * 
 *         # 9 arguments
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_c, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_5;
    break;

    /* "cgtypes.pyx":1576
 * 
 *         # 9 arguments
 *         elif arglen==9:             # <<<<<<<<<<<<<<
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 */
    case 9:

    /* "cgtypes.pyx":1577
 *         # 9 arguments
 *         elif arglen==9:
 *             self.m11 = args[0]             # <<<<<<<<<<<<<<
 *             self.m12 = args[1]
 *             self.m13 = args[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_5;

    /* "cgtypes.pyx":1578
 *         elif arglen==9:
 *             self.m11 = args[0]
 *             self.m12 = args[1]             # <<<<<<<<<<<<<<
 *             self.m13 = args[2]
 *             self.m21 = args[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_5;

    /* "cgtypes.pyx":1579
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 *             self.m13 = args[2]             # <<<<<<<<<<<<<<
 *             self.m21 = args[3]
 *             self.m22 = args[4]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_5;

    /* "cgtypes.pyx":1580
 *             self.m12 = args[1]
 *             self.m13 = args[2]
 *             self.m21 = args[3]             # <<<<<<<<<<<<<<
 *             self.m22 = args[4]
 *             self.m23 = args[5]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_5;

    /* "cgtypes.pyx":1581
 *             self.m13 = args[2]
 *             self.m21 = args[3]
 *             self.m22 = args[4]             # <<<<<<<<<<<<<<
 *             self.m23 = args[5]
 *             self.m31 = args[6]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_5;

    /* "cgtypes.pyx":1582
 *             self.m21 = args[3]
 *             self.m22 = args[4]
 *             self.m23 = args[5]             # <<<<<<<<<<<<<<
 *             self.m31 = args[6]
 *             self.m32 = args[7]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_5;

    /* "cgtypes.pyx":1583
 *             self.m22 = args[4]
 *             self.m23 = args[5]
 *             self.m31 = args[6]             # <<<<<<<<<<<<<<
 *             self.m32 = args[7]
 *             self.m33 = args[8]
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_5;

    /* "cgtypes.pyx":1584
 *             self.m23 = args[5]
 *             self.m31 = args[6]
 *             self.m32 = args[7]             # <<<<<<<<<<<<<<
 *             self.m33 = args[8]
 * 
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_5;

    /* "cgtypes.pyx":1585
 *             self.m31 = args[6]
 *             self.m32 = args[7]
 *             self.m33 = args[8]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":1588
 * 
 *         else:
 *             raise TypeError,"mat3() arg can't be converted to mat3"             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat3_arg_can_t_be_converted_to_m, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":1454
 *     cdef double m31, m32, m33
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat3.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1590
 *             raise TypeError,"mat3() arg can't be converted to mat3"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_mat3construct, (self[0], self[1], self[2]))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_2__reduce__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_2__reduce__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cgtypes.pyx":1591
 * 
 *     def __reduce__(self):
 *         return (_mat3construct, (self[0], self[1], self[2]))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_mat3construct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1590
 *             raise TypeError,"mat3() arg can't be converted to mat3"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_mat3construct, (self[0], self[1], self[2]))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat3.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1593
 *         return (_mat3construct, (self[0], self[1], self[2]))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_4__repr__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_4__repr__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cgtypes.pyx":1594
 * 
 *     def __repr__(self):
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(             # <<<<<<<<<<<<<<
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 *             repr(self.m21),repr(self.m22),repr(self.m23),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":1595
 *     def __repr__(self):
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),             # <<<<<<<<<<<<<<
 *             repr(self.m21),repr(self.m22),repr(self.m23),
 *             repr(self.m31),repr(self.m32),repr(self.m33))
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":1596
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 *             repr(self.m21),repr(self.m22),repr(self.m23),             # <<<<<<<<<<<<<<
 *             repr(self.m31),repr(self.m32),repr(self.m33))
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":1597
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 *             repr(self.m21),repr(self.m22),repr(self.m23),
 *             repr(self.m31),repr(self.m32),repr(self.m33))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":1595
 *     def __repr__(self):
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),             # <<<<<<<<<<<<<<
 *             repr(self.m21),repr(self.m22),repr(self.m23),
 *             repr(self.m31),repr(self.m32),repr(self.m33))
 */
  __pyx_t_1 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;

  /* "cgtypes.pyx":1594
 * 
 *     def __repr__(self):
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(             # <<<<<<<<<<<<<<
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 *             repr(self.m21),repr(self.m22),repr(self.m23),
 */
  __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_mat3_s_s_s_s_s_s_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1593
 *         return (_mat3construct, (self[0], self[1], self[2]))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'mat3(%s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cgtypes.mat3.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1599
 *             repr(self.m31),repr(self.m32),repr(self.m33))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_6__str__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_6__str__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cgtypes.pyx":1600
 * 
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(             # <<<<<<<<<<<<<<
 *             self.m11, self.m12, self.m13,
 *             self.m21, self.m22, self.m23,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":1601
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13,             # <<<<<<<<<<<<<<
 *             self.m21, self.m22, self.m23,
 *             self.m31, self.m32, self.m33)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "cgtypes.pyx":1602
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13,
 *             self.m21, self.m22, self.m23,             # <<<<<<<<<<<<<<
 *             self.m31, self.m32, self.m33)
 * 
 */
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "cgtypes.pyx":1603
 *             self.m11, self.m12, self.m13,
 *             self.m21, self.m22, self.m23,
 *             self.m31, self.m32, self.m33)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);

  /* "cgtypes.pyx":1601
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13,             # <<<<<<<<<<<<<<
 *             self.m21, self.m22, self.m23,
 *             self.m31, self.m32, self.m33)
 */
  __pyx_t_10 = PyTuple_New(9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_10, 7, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;

  /* "cgtypes.pyx":1600
 * 
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(             # <<<<<<<<<<<<<<
 *             self.m11, self.m12, self.m13,
 *             self.m21, self.m22, self.m23,
 */
  __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9, __pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1599
 *             repr(self.m31),repr(self.m32),repr(self.m33))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cgtypes.mat3.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1605
 *             self.m31, self.m32, self.m33)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return mat3iter(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_8__iter__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_8__iter__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":1606
 * 
 *     def __iter__(self):
 *         return mat3iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(a,b,op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3iter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":1605
 *             self.m31, self.m32, self.m33)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return mat3iter(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1608
 *         return mat3iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef mat3 ma, mb
 *         cdef int cop
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_10__richcmp__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b), ((PyObject *)__pyx_v_op));

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_ma = 0;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_mb = 0;
  int __pyx_v_cop;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cgtypes.pyx":1612
 *         cdef int cop
 * 
 *         cop = op             # <<<<<<<<<<<<<<
 * 
 *         ta = type(a)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_op); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cop = __pyx_t_1;

  /* "cgtypes.pyx":1614
 *         cop = op
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 *         if (ta!=mat3 or tb!=mat3):
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":1615
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 *         if (ta!=mat3 or tb!=mat3):
 *             if cop==3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1616
 *         ta = type(a)
 *         tb = type(b)
 *         if (ta!=mat3 or tb!=mat3):             # <<<<<<<<<<<<<<
 *             if cop==3:
 *                 return 1
 */
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1617
 *         tb = type(b)
 *         if (ta!=mat3 or tb!=mat3):
 *             if cop==3:             # <<<<<<<<<<<<<<
 *                 return 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cop == 3) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1618
 *         if (ta!=mat3 or tb!=mat3):
 *             if cop==3:
 *                 return 1             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cgtypes.pyx":1620
 *                 return 1
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *         ma = a
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
    }
  }

  /* "cgtypes.pyx":1622
 *                 return 0
 * 
 *         ma = a             # <<<<<<<<<<<<<<
 *         mb = b
 * 
 */
  if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_a;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_ma = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":1623
 * 
 *         ma = a
 *         mb = b             # <<<<<<<<<<<<<<
 * 
 *         # <
 */
  if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_b;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":1651
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
  switch (__pyx_v_cop) {

    /* "cgtypes.pyx":1626
 * 
 *         # <
 *         if cop==0:             # <<<<<<<<<<<<<<
 *             return 0
 *         # <=
 */
    case 0:

    /* "cgtypes.pyx":1627
 *         # <
 *         if cop==0:
 *             return 0             # <<<<<<<<<<<<<<
 *         # <=
 *         elif cop==1:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1629
 *             return 0
 *         # <=
 *         elif cop==1:             # <<<<<<<<<<<<<<
 *             return 0
 *         # ==
 */
    case 1:

    /* "cgtypes.pyx":1630
 *         # <=
 *         elif cop==1:
 *             return 0             # <<<<<<<<<<<<<<
 *         # ==
 *         elif cop==2:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1632
 *             return 0
 *         # ==
 *         elif cop==2:             # <<<<<<<<<<<<<<
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and
 */
    case 2:

    /* "cgtypes.pyx":1633
 *         # ==
 *         elif cop==2:
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m13-mb.m13)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_ma->m11 - __pyx_v_mb->m11)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m12 - __pyx_v_mb->m12)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":1634
 *         elif cop==2:
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m13 - __pyx_v_mb->m13)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":1635
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m23-mb.m23)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m21 - __pyx_v_mb->m21)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m22 - __pyx_v_mb->m22)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":1636
 *                     fabs(ma.m13-mb.m13)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 *                     fabs(ma.m33-mb.m33)<=eps)
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m23 - __pyx_v_mb->m23)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":1637
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m33-mb.m33)<=eps)
 *         # !=
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m31 - __pyx_v_mb->m31)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m32 - __pyx_v_mb->m32)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":1638
 *                     fabs(ma.m23-mb.m23)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 *                     fabs(ma.m33-mb.m33)<=eps)             # <<<<<<<<<<<<<<
 *         # !=
 *         elif cop==3:
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m33 - __pyx_v_mb->m33)) <= __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1640
 *                     fabs(ma.m33-mb.m33)<=eps)
 *         # !=
 *         elif cop==3:             # <<<<<<<<<<<<<<
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or
 */
    case 3:

    /* "cgtypes.pyx":1641
 *         # !=
 *         elif cop==3:
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m13-mb.m13)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_ma->m11 - __pyx_v_mb->m11)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m12 - __pyx_v_mb->m12)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }

    /* "cgtypes.pyx":1642
 *         elif cop==3:
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m13 - __pyx_v_mb->m13)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }

    /* "cgtypes.pyx":1643
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m23-mb.m23)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m21 - __pyx_v_mb->m21)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m22 - __pyx_v_mb->m22)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }

    /* "cgtypes.pyx":1644
 *                     fabs(ma.m13-mb.m13)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 *                     fabs(ma.m33-mb.m33)>eps)
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m23 - __pyx_v_mb->m23)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }

    /* "cgtypes.pyx":1645
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m33-mb.m33)>eps)
 *         # >
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m31 - __pyx_v_mb->m31)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m32 - __pyx_v_mb->m32)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L16_bool_binop_done;
    }

    /* "cgtypes.pyx":1646
 *                     fabs(ma.m23-mb.m23)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 *                     fabs(ma.m33-mb.m33)>eps)             # <<<<<<<<<<<<<<
 *         # >
 *         elif cop==4:
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m33 - __pyx_v_mb->m33)) > __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L16_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1648
 *                     fabs(ma.m33-mb.m33)>eps)
 *         # >
 *         elif cop==4:             # <<<<<<<<<<<<<<
 *             return 0
 *         # >=
 */
    case 4:

    /* "cgtypes.pyx":1649
 *         # >
 *         elif cop==4:
 *             return 0             # <<<<<<<<<<<<<<
 *         # >=
 *         elif cop==5:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":1651
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
    case 5:

    /* "cgtypes.pyx":1652
 *         # >=
 *         elif cop==5:
 *             return 0             # <<<<<<<<<<<<<<
 *         # sonst (Fehler)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":1655
 *         # sonst (Fehler)
 *         else:
 *             raise ValueError,"internal error: illegal rich comparison number"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_internal_error_illegal_rich_comp, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":1608
 *         return mat3iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef mat3 ma, mb
 *         cdef int cop
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat3.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ma);
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1658
 * 
 * 
 *     def __add__(mat3 a, mat3 b):             # <<<<<<<<<<<<<<
 *         """Matrix addition.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_12__add__[] = "Matrix addition.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_12__add__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_mat3, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_12__add__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_12__add__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cgtypes.pyx":1662
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1663
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = a.m11 + b.m11             # <<<<<<<<<<<<<<
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13
 */
  __pyx_v_res->m11 = (__pyx_v_a->m11 + __pyx_v_b->m11);

  /* "cgtypes.pyx":1664
 *         res = mat3()
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12             # <<<<<<<<<<<<<<
 *         res.m13 = a.m13 + b.m13
 *         res.m21 = a.m21 + b.m21
 */
  __pyx_v_res->m12 = (__pyx_v_a->m12 + __pyx_v_b->m12);

  /* "cgtypes.pyx":1665
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13             # <<<<<<<<<<<<<<
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22
 */
  __pyx_v_res->m13 = (__pyx_v_a->m13 + __pyx_v_b->m13);

  /* "cgtypes.pyx":1666
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13
 *         res.m21 = a.m21 + b.m21             # <<<<<<<<<<<<<<
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23
 */
  __pyx_v_res->m21 = (__pyx_v_a->m21 + __pyx_v_b->m21);

  /* "cgtypes.pyx":1667
 *         res.m13 = a.m13 + b.m13
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22             # <<<<<<<<<<<<<<
 *         res.m23 = a.m23 + b.m23
 *         res.m31 = a.m31 + b.m31
 */
  __pyx_v_res->m22 = (__pyx_v_a->m22 + __pyx_v_b->m22);

  /* "cgtypes.pyx":1668
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23             # <<<<<<<<<<<<<<
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32
 */
  __pyx_v_res->m23 = (__pyx_v_a->m23 + __pyx_v_b->m23);

  /* "cgtypes.pyx":1669
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23
 *         res.m31 = a.m31 + b.m31             # <<<<<<<<<<<<<<
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33
 */
  __pyx_v_res->m31 = (__pyx_v_a->m31 + __pyx_v_b->m31);

  /* "cgtypes.pyx":1670
 *         res.m23 = a.m23 + b.m23
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32             # <<<<<<<<<<<<<<
 *         res.m33 = a.m33 + b.m33
 *         return res
 */
  __pyx_v_res->m32 = (__pyx_v_a->m32 + __pyx_v_b->m32);

  /* "cgtypes.pyx":1671
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = (__pyx_v_a->m33 + __pyx_v_b->m33);

  /* "cgtypes.pyx":1672
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(mat3 a, mat3 b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1658
 * 
 * 
 *     def __add__(mat3 a, mat3 b):             # <<<<<<<<<<<<<<
 *         """Matrix addition.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1674
 *         return res
 * 
 *     def __sub__(mat3 a, mat3 b):             # <<<<<<<<<<<<<<
 *         """Matrix subtraction.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_14__sub__[] = "Matrix subtraction.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_14__sub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_mat3, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_14__sub__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_14__sub__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cgtypes.pyx":1678
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1679
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = a.m11 - b.m11             # <<<<<<<<<<<<<<
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13
 */
  __pyx_v_res->m11 = (__pyx_v_a->m11 - __pyx_v_b->m11);

  /* "cgtypes.pyx":1680
 *         res = mat3()
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12             # <<<<<<<<<<<<<<
 *         res.m13 = a.m13 - b.m13
 *         res.m21 = a.m21 - b.m21
 */
  __pyx_v_res->m12 = (__pyx_v_a->m12 - __pyx_v_b->m12);

  /* "cgtypes.pyx":1681
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13             # <<<<<<<<<<<<<<
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22
 */
  __pyx_v_res->m13 = (__pyx_v_a->m13 - __pyx_v_b->m13);

  /* "cgtypes.pyx":1682
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13
 *         res.m21 = a.m21 - b.m21             # <<<<<<<<<<<<<<
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23
 */
  __pyx_v_res->m21 = (__pyx_v_a->m21 - __pyx_v_b->m21);

  /* "cgtypes.pyx":1683
 *         res.m13 = a.m13 - b.m13
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22             # <<<<<<<<<<<<<<
 *         res.m23 = a.m23 - b.m23
 *         res.m31 = a.m31 - b.m31
 */
  __pyx_v_res->m22 = (__pyx_v_a->m22 - __pyx_v_b->m22);

  /* "cgtypes.pyx":1684
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23             # <<<<<<<<<<<<<<
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32
 */
  __pyx_v_res->m23 = (__pyx_v_a->m23 - __pyx_v_b->m23);

  /* "cgtypes.pyx":1685
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23
 *         res.m31 = a.m31 - b.m31             # <<<<<<<<<<<<<<
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33
 */
  __pyx_v_res->m31 = (__pyx_v_a->m31 - __pyx_v_b->m31);

  /* "cgtypes.pyx":1686
 *         res.m23 = a.m23 - b.m23
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32             # <<<<<<<<<<<<<<
 *         res.m33 = a.m33 - b.m33
 *         return res
 */
  __pyx_v_res->m32 = (__pyx_v_a->m32 - __pyx_v_b->m32);

  /* "cgtypes.pyx":1687
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = (__pyx_v_a->m33 - __pyx_v_b->m33);

  /* "cgtypes.pyx":1688
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1674
 *         return res
 * 
 *     def __sub__(mat3 a, mat3 b):             # <<<<<<<<<<<<<<
 *         """Matrix subtraction.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1690
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_16__mul__[] = "Multiplication.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_16__mul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_16__mul__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_ma = 0;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_mb = 0;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_wres = NULL;
  PyObject *__pyx_v_wb = NULL;
  PyObject *__pyx_v_wa = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cgtypes.pyx":1697
 *         cdef double r
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 * 
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":1698
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         # mat3 on the left?
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1701
 * 
 *         # mat3 on the left?
 *         if ta==mat3:             # <<<<<<<<<<<<<<
 *             ma = a
 *             # mat3 on the right?
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1702
 *         # mat3 on the left?
 *         if ta==mat3:
 *             ma = a             # <<<<<<<<<<<<<<
 *             # mat3 on the right?
 *             if tb==mat3:
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_ma = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":1704
 *             ma = a
 *             # mat3 on the right?
 *             if tb==mat3:             # <<<<<<<<<<<<<<
 *                 # mat3*mat3
 *                 res = mat3()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1706
 *             if tb==mat3:
 *                 # mat3*mat3
 *                 res = mat3()             # <<<<<<<<<<<<<<
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1707
 *                 # mat3*mat3
 *                 res = mat3()
 *                 mb = b             # <<<<<<<<<<<<<<
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1708
 *                 res = mat3()
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31             # <<<<<<<<<<<<<<
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33
 */
      __pyx_v_res->m11 = (((__pyx_v_ma->m11 * __pyx_v_mb->m11) + (__pyx_v_ma->m12 * __pyx_v_mb->m21)) + (__pyx_v_ma->m13 * __pyx_v_mb->m31));

      /* "cgtypes.pyx":1709
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32             # <<<<<<<<<<<<<<
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31
 */
      __pyx_v_res->m12 = (((__pyx_v_ma->m11 * __pyx_v_mb->m12) + (__pyx_v_ma->m12 * __pyx_v_mb->m22)) + (__pyx_v_ma->m13 * __pyx_v_mb->m32));

      /* "cgtypes.pyx":1710
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33             # <<<<<<<<<<<<<<
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32
 */
      __pyx_v_res->m13 = (((__pyx_v_ma->m11 * __pyx_v_mb->m13) + (__pyx_v_ma->m12 * __pyx_v_mb->m23)) + (__pyx_v_ma->m13 * __pyx_v_mb->m33));

      /* "cgtypes.pyx":1711
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31             # <<<<<<<<<<<<<<
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33
 */
      __pyx_v_res->m21 = (((__pyx_v_ma->m21 * __pyx_v_mb->m11) + (__pyx_v_ma->m22 * __pyx_v_mb->m21)) + (__pyx_v_ma->m23 * __pyx_v_mb->m31));

      /* "cgtypes.pyx":1712
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32             # <<<<<<<<<<<<<<
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31
 */
      __pyx_v_res->m22 = (((__pyx_v_ma->m21 * __pyx_v_mb->m12) + (__pyx_v_ma->m22 * __pyx_v_mb->m22)) + (__pyx_v_ma->m23 * __pyx_v_mb->m32));

      /* "cgtypes.pyx":1713
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33             # <<<<<<<<<<<<<<
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32
 */
      __pyx_v_res->m23 = (((__pyx_v_ma->m21 * __pyx_v_mb->m13) + (__pyx_v_ma->m22 * __pyx_v_mb->m23)) + (__pyx_v_ma->m23 * __pyx_v_mb->m33));

      /* "cgtypes.pyx":1714
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31             # <<<<<<<<<<<<<<
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33
 */
      __pyx_v_res->m31 = (((__pyx_v_ma->m31 * __pyx_v_mb->m11) + (__pyx_v_ma->m32 * __pyx_v_mb->m21)) + (__pyx_v_ma->m33 * __pyx_v_mb->m31));

      /* "cgtypes.pyx":1715
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32             # <<<<<<<<<<<<<<
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33
 *                 return res
 */
      __pyx_v_res->m32 = (((__pyx_v_ma->m31 * __pyx_v_mb->m12) + (__pyx_v_ma->m32 * __pyx_v_mb->m22)) + (__pyx_v_ma->m33 * __pyx_v_mb->m32));

      /* "cgtypes.pyx":1716
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33             # <<<<<<<<<<<<<<
 *                 return res
 *             # vec3 on the right?
 */
      __pyx_v_res->m33 = (((__pyx_v_ma->m31 * __pyx_v_mb->m13) + (__pyx_v_ma->m32 * __pyx_v_mb->m23)) + (__pyx_v_ma->m33 * __pyx_v_mb->m33));

      /* "cgtypes.pyx":1717
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33
 *                 return res             # <<<<<<<<<<<<<<
 *             # vec3 on the right?
 *             elif tb==vec3:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":1719
 *                 return res
 *             # vec3 on the right?
 *             elif tb==vec3:             # <<<<<<<<<<<<<<
 *                 # mat3*vec3
 *                 wres = vec3()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1721
 *             elif tb==vec3:
 *                 # mat3*vec3
 *                 wres = vec3()             # <<<<<<<<<<<<<<
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_wres = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":1722
 *                 # mat3*vec3
 *                 wres = vec3()
 *                 wb   = b             # <<<<<<<<<<<<<<
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z
 */
      __Pyx_INCREF(__pyx_v_b);
      __pyx_v_wb = __pyx_v_b;

      /* "cgtypes.pyx":1723
 *                 wres = vec3()
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z             # <<<<<<<<<<<<<<
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_ma->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ma->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ma->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_wres->x = __pyx_t_6;

      /* "cgtypes.pyx":1724
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z             # <<<<<<<<<<<<<<
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z
 *                 return wres
 */
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_ma->m21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ma->m22); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_y); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ma->m23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_wres->y = __pyx_t_6;

      /* "cgtypes.pyx":1725
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z             # <<<<<<<<<<<<<<
 *                 return wres
 *             # Scalar on the right?
 */
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_ma->m31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ma->m32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ma->m33); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_wb, __pyx_n_s_z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_wres->z = __pyx_t_6;

      /* "cgtypes.pyx":1726
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z
 *                 return wres             # <<<<<<<<<<<<<<
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_wres));
      __pyx_r = ((PyObject *)__pyx_v_wres);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":1728
 *                 return wres
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *                 res = mat3()
 *                 r = b
 */
    __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_7) {
    } else {
      __pyx_t_2 = __pyx_t_7;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_7;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":1729
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:
 *                 res = mat3()             # <<<<<<<<<<<<<<
 *                 r = b
 *                 res.m11 = ma.m11*r
 */
      __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cgtypes.pyx":1730
 *             elif tb==float or tb==int or tb==long:
 *                 res = mat3()
 *                 r = b             # <<<<<<<<<<<<<<
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r
 */
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_6;

      /* "cgtypes.pyx":1731
 *                 res = mat3()
 *                 r = b
 *                 res.m11 = ma.m11*r             # <<<<<<<<<<<<<<
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r
 */
      __pyx_v_res->m11 = (__pyx_v_ma->m11 * __pyx_v_r);

      /* "cgtypes.pyx":1732
 *                 r = b
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r             # <<<<<<<<<<<<<<
 *                 res.m13 = ma.m13*r
 *                 res.m21 = ma.m21*r
 */
      __pyx_v_res->m12 = (__pyx_v_ma->m12 * __pyx_v_r);

      /* "cgtypes.pyx":1733
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r             # <<<<<<<<<<<<<<
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r
 */
      __pyx_v_res->m13 = (__pyx_v_ma->m13 * __pyx_v_r);

      /* "cgtypes.pyx":1734
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r
 *                 res.m21 = ma.m21*r             # <<<<<<<<<<<<<<
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r
 */
      __pyx_v_res->m21 = (__pyx_v_ma->m21 * __pyx_v_r);

      /* "cgtypes.pyx":1735
 *                 res.m13 = ma.m13*r
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r             # <<<<<<<<<<<<<<
 *                 res.m23 = ma.m23*r
 *                 res.m31 = ma.m31*r
 */
      __pyx_v_res->m22 = (__pyx_v_ma->m22 * __pyx_v_r);

      /* "cgtypes.pyx":1736
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r             # <<<<<<<<<<<<<<
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r
 */
      __pyx_v_res->m23 = (__pyx_v_ma->m23 * __pyx_v_r);

      /* "cgtypes.pyx":1737
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r
 *                 res.m31 = ma.m31*r             # <<<<<<<<<<<<<<
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r
 */
      __pyx_v_res->m31 = (__pyx_v_ma->m31 * __pyx_v_r);

      /* "cgtypes.pyx":1738
 *                 res.m23 = ma.m23*r
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r             # <<<<<<<<<<<<<<
 *                 res.m33 = ma.m33*r
 *                 return res
 */
      __pyx_v_res->m32 = (__pyx_v_ma->m32 * __pyx_v_r);

      /* "cgtypes.pyx":1739
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r             # <<<<<<<<<<<<<<
 *                 return res
 * 
 */
      __pyx_v_res->m33 = (__pyx_v_ma->m33 * __pyx_v_r);

      /* "cgtypes.pyx":1740
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r
 *                 return res             # <<<<<<<<<<<<<<
 * 
 *         # vec3 on the left? (then there must be a mat3 on the right)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":1743
 * 
 *         # vec3 on the left? (then there must be a mat3 on the right)
 *         elif ta==vec3:             # <<<<<<<<<<<<<<
 *             # vec3*mat3
 *             wres = vec3()
 */
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1745
 *         elif ta==vec3:
 *             # vec3*mat3
 *             wres = vec3()             # <<<<<<<<<<<<<<
 *             wa   = a
 *             mb   = b
 */
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_wres = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "cgtypes.pyx":1746
 *             # vec3*mat3
 *             wres = vec3()
 *             wa   = a             # <<<<<<<<<<<<<<
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31
 */
    __Pyx_INCREF(__pyx_v_a);
    __pyx_v_wa = __pyx_v_a;

    /* "cgtypes.pyx":1747
 *             wres = vec3()
 *             wa   = a
 *             mb   = b             # <<<<<<<<<<<<<<
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "cgtypes.pyx":1748
 *             wa   = a
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31             # <<<<<<<<<<<<<<
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mb->m11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mb->m21); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_z); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mb->m31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_wres->x = __pyx_t_6;

    /* "cgtypes.pyx":1749
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32             # <<<<<<<<<<<<<<
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33
 *             return wres
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mb->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mb->m22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_z); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mb->m32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_wres->y = __pyx_t_6;

    /* "cgtypes.pyx":1750
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33             # <<<<<<<<<<<<<<
 *             return wres
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_mb->m13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mb->m23); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_wa, __pyx_n_s_z); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mb->m33); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_wres->z = __pyx_t_6;

    /* "cgtypes.pyx":1751
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33
 *             return wres             # <<<<<<<<<<<<<<
 * 
 *         # Scalar on the left? (then there must be a mat3 on the right)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_wres));
    __pyx_r = ((PyObject *)__pyx_v_wres);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1754
 * 
 *         # Scalar on the left? (then there must be a mat3 on the right)
 *         elif ta==float or ta==int or ta==long:             # <<<<<<<<<<<<<<
 *             res = mat3()
 *             r  = a
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_7) {
  } else {
    __pyx_t_2 = __pyx_t_7;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_7) {
  } else {
    __pyx_t_2 = __pyx_t_7;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_7;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":1755
 *         # Scalar on the left? (then there must be a mat3 on the right)
 *         elif ta==float or ta==int or ta==long:
 *             res = mat3()             # <<<<<<<<<<<<<<
 *             r  = a
 *             mb = b
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":1756
 *         elif ta==float or ta==int or ta==long:
 *             res = mat3()
 *             r  = a             # <<<<<<<<<<<<<<
 *             mb = b
 *             res.m11 = r*mb.m11
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_a); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_6;

    /* "cgtypes.pyx":1757
 *             res = mat3()
 *             r  = a
 *             mb = b             # <<<<<<<<<<<<<<
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":1758
 *             r  = a
 *             mb = b
 *             res.m11 = r*mb.m11             # <<<<<<<<<<<<<<
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13
 */
    __pyx_v_res->m11 = (__pyx_v_r * __pyx_v_mb->m11);

    /* "cgtypes.pyx":1759
 *             mb = b
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12             # <<<<<<<<<<<<<<
 *             res.m13 = r*mb.m13
 *             res.m21 = r*mb.m21
 */
    __pyx_v_res->m12 = (__pyx_v_r * __pyx_v_mb->m12);

    /* "cgtypes.pyx":1760
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13             # <<<<<<<<<<<<<<
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22
 */
    __pyx_v_res->m13 = (__pyx_v_r * __pyx_v_mb->m13);

    /* "cgtypes.pyx":1761
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13
 *             res.m21 = r*mb.m21             # <<<<<<<<<<<<<<
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23
 */
    __pyx_v_res->m21 = (__pyx_v_r * __pyx_v_mb->m21);

    /* "cgtypes.pyx":1762
 *             res.m13 = r*mb.m13
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22             # <<<<<<<<<<<<<<
 *             res.m23 = r*mb.m23
 *             res.m31 = r*mb.m31
 */
    __pyx_v_res->m22 = (__pyx_v_r * __pyx_v_mb->m22);

    /* "cgtypes.pyx":1763
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23             # <<<<<<<<<<<<<<
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32
 */
    __pyx_v_res->m23 = (__pyx_v_r * __pyx_v_mb->m23);

    /* "cgtypes.pyx":1764
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23
 *             res.m31 = r*mb.m31             # <<<<<<<<<<<<<<
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33
 */
    __pyx_v_res->m31 = (__pyx_v_r * __pyx_v_mb->m31);

    /* "cgtypes.pyx":1765
 *             res.m23 = r*mb.m23
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32             # <<<<<<<<<<<<<<
 *             res.m33 = r*mb.m33
 *             return res
 */
    __pyx_v_res->m32 = (__pyx_v_r * __pyx_v_mb->m32);

    /* "cgtypes.pyx":1766
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_v_res->m33 = (__pyx_v_r * __pyx_v_mb->m33);

    /* "cgtypes.pyx":1767
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         # No valid combination found
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":1770
 * 
 *         # No valid combination found
 *         raise TypeError, "unsupported operand type for *"             # <<<<<<<<<<<<<<
 * 
 *     def __div__(mat3 a, b):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":1690
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat3.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ma);
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XDECREF((PyObject *)__pyx_v_wres);
  __Pyx_XDECREF(__pyx_v_wb);
  __Pyx_XDECREF(__pyx_v_wa);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1772
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(mat3 a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 *         """
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4mat3_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_18__div__[] = "Division.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_18__div__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat3, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_18__div__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat3_18__div__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cgtypes.pyx":1778
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1780
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # mat3/scalar
 *             res = mat3()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1782
 *         if tb==float or tb==int or tb==long:
 *             # mat3/scalar
 *             res = mat3()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1783
 *             # mat3/scalar
 *             res = mat3()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1784
 *             res = mat3()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 division"
 *             res.m11 = a.m11/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1785
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"             # <<<<<<<<<<<<<<
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1786
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"
 *             res.m11 = a.m11/r             # <<<<<<<<<<<<<<
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m11 = (__pyx_v_a->m11 / __pyx_v_r);

    /* "cgtypes.pyx":1787
 *                 raise ZeroDivisionError,"mat3 division"
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r             # <<<<<<<<<<<<<<
 *             res.m13 = a.m13/r
 *             res.m21 = a.m21/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m12 = (__pyx_v_a->m12 / __pyx_v_r);

    /* "cgtypes.pyx":1788
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r             # <<<<<<<<<<<<<<
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m13 = (__pyx_v_a->m13 / __pyx_v_r);

    /* "cgtypes.pyx":1789
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r
 *             res.m21 = a.m21/r             # <<<<<<<<<<<<<<
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m21 = (__pyx_v_a->m21 / __pyx_v_r);

    /* "cgtypes.pyx":1790
 *             res.m13 = a.m13/r
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r             # <<<<<<<<<<<<<<
 *             res.m23 = a.m23/r
 *             res.m31 = a.m31/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m22 = (__pyx_v_a->m22 / __pyx_v_r);

    /* "cgtypes.pyx":1791
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r             # <<<<<<<<<<<<<<
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m23 = (__pyx_v_a->m23 / __pyx_v_r);

    /* "cgtypes.pyx":1792
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r
 *             res.m31 = a.m31/r             # <<<<<<<<<<<<<<
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m31 = (__pyx_v_a->m31 / __pyx_v_r);

    /* "cgtypes.pyx":1793
 *             res.m23 = a.m23/r
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r             # <<<<<<<<<<<<<<
 *             res.m33 = a.m33/r
 *             return res
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m32 = (__pyx_v_a->m32 / __pyx_v_r);

    /* "cgtypes.pyx":1794
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m33 = (__pyx_v_a->m33 / __pyx_v_r);

    /* "cgtypes.pyx":1795
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1797
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for /"             # <<<<<<<<<<<<<<
 * 
 *     def __mod__(mat3 self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_2, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1772
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(mat3 a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":1799
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(mat3 self, other):             # <<<<<<<<<<<<<<
 *         """Modulo.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_20__mod__[] = "Modulo.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_20__mod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mod__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_7cgtypes_mat3, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_20__mod__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_20__mod__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_mb = 0;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mod__", 0);

  /* "cgtypes.pyx":1804
 *         cdef mat3 mb, res
 * 
 *         tb = type(other)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":1806
 *         tb = type(other)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r = other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1807
 * 
 *         if tb==float or tb==int or tb==long:
 *             r = other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"
 */
    __Pyx_INCREF(__pyx_v_other);
    __pyx_v_r = __pyx_v_other;

    /* "cgtypes.pyx":1808
 *         if tb==float or tb==int or tb==long:
 *             r = other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             res = mat3()
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((fabs(__pyx_t_4) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1809
 *             r = other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"             # <<<<<<<<<<<<<<
 *             res = mat3()
 *             res.m11 = _fmod(self.m11, r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1810
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             res = mat3()             # <<<<<<<<<<<<<<
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1811
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             res = mat3()
 *             res.m11 = _fmod(self.m11, r)             # <<<<<<<<<<<<<<
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_t_4);

    /* "cgtypes.pyx":1812
 *             res = mat3()
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)             # <<<<<<<<<<<<<<
 *             res.m13 = _fmod(self.m13, r)
 *             res.m21 = _fmod(self.m21, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_t_4);

    /* "cgtypes.pyx":1813
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)             # <<<<<<<<<<<<<<
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_t_4);

    /* "cgtypes.pyx":1814
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)
 *             res.m21 = _fmod(self.m21, r)             # <<<<<<<<<<<<<<
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_t_4);

    /* "cgtypes.pyx":1815
 *             res.m13 = _fmod(self.m13, r)
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)             # <<<<<<<<<<<<<<
 *             res.m23 = _fmod(self.m23, r)
 *             res.m31 = _fmod(self.m31, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_t_4);

    /* "cgtypes.pyx":1816
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)             # <<<<<<<<<<<<<<
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_t_4);

    /* "cgtypes.pyx":1817
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)
 *             res.m31 = _fmod(self.m31, r)             # <<<<<<<<<<<<<<
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_t_4);

    /* "cgtypes.pyx":1818
 *             res.m23 = _fmod(self.m23, r)
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)             # <<<<<<<<<<<<<<
 *             res.m33 = _fmod(self.m33, r)
 *             return res
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_t_4);

    /* "cgtypes.pyx":1819
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_t_4);

    /* "cgtypes.pyx":1820
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         elif tb==mat3:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1822
 *             return res
 * 
 *         elif tb==mat3:             # <<<<<<<<<<<<<<
 *             mb = other
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1823
 * 
 *         elif tb==mat3:
 *             mb = other             # <<<<<<<<<<<<<<
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1825
 *             mb = other
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m11) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m12) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m13) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1826
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 *                 raise ZeroDivisionError,"mat3 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m21) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m22) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m23) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1827
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 modulo"
 * 
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m31) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m32) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m33) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1828
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 *                 raise ZeroDivisionError,"mat3 modulo"             # <<<<<<<<<<<<<<
 * 
 *             res=mat3()
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1830
 *                 raise ZeroDivisionError,"mat3 modulo"
 * 
 *             res=mat3()             # <<<<<<<<<<<<<<
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1831
 * 
 *             res=mat3()
 *             res.m11 = _fmod(self.m11, mb.m11)             # <<<<<<<<<<<<<<
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)
 */
    __pyx_v_res->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_mb->m11);

    /* "cgtypes.pyx":1832
 *             res=mat3()
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)             # <<<<<<<<<<<<<<
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m21 = _fmod(self.m21, mb.m21)
 */
    __pyx_v_res->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_mb->m12);

    /* "cgtypes.pyx":1833
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)             # <<<<<<<<<<<<<<
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)
 */
    __pyx_v_res->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_mb->m13);

    /* "cgtypes.pyx":1834
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m21 = _fmod(self.m21, mb.m21)             # <<<<<<<<<<<<<<
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)
 */
    __pyx_v_res->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_mb->m21);

    /* "cgtypes.pyx":1835
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)             # <<<<<<<<<<<<<<
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m31 = _fmod(self.m31, mb.m31)
 */
    __pyx_v_res->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_mb->m22);

    /* "cgtypes.pyx":1836
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)             # <<<<<<<<<<<<<<
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)
 */
    __pyx_v_res->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_mb->m23);

    /* "cgtypes.pyx":1837
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m31 = _fmod(self.m31, mb.m31)             # <<<<<<<<<<<<<<
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)
 */
    __pyx_v_res->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_mb->m31);

    /* "cgtypes.pyx":1838
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)             # <<<<<<<<<<<<<<
 *             res.m33 = _fmod(self.m33, mb.m33)
 *             return res
 */
    __pyx_v_res->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_mb->m32);

    /* "cgtypes.pyx":1839
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_v_res->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_mb->m33);

    /* "cgtypes.pyx":1840
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1843
 * 
 *         else:
 *             raise TypeError, "unsupported operand type for %"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_3, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1799
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(mat3 self, other):             # <<<<<<<<<<<<<<
 *         """Modulo.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1846
 * 
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_23__neg__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_22__neg__[] = "Negation.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_22__neg__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_23__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_22__neg__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_22__neg__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cgtypes.pyx":1850
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1851
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = -self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13
 */
  __pyx_v_res->m11 = (-__pyx_v_self->m11);

  /* "cgtypes.pyx":1852
 *         res = mat3()
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12             # <<<<<<<<<<<<<<
 *         res.m13 = -self.m13
 *         res.m21 = -self.m21
 */
  __pyx_v_res->m12 = (-__pyx_v_self->m12);

  /* "cgtypes.pyx":1853
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13             # <<<<<<<<<<<<<<
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22
 */
  __pyx_v_res->m13 = (-__pyx_v_self->m13);

  /* "cgtypes.pyx":1854
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13
 *         res.m21 = -self.m21             # <<<<<<<<<<<<<<
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23
 */
  __pyx_v_res->m21 = (-__pyx_v_self->m21);

  /* "cgtypes.pyx":1855
 *         res.m13 = -self.m13
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = -self.m23
 *         res.m31 = -self.m31
 */
  __pyx_v_res->m22 = (-__pyx_v_self->m22);

  /* "cgtypes.pyx":1856
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23             # <<<<<<<<<<<<<<
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32
 */
  __pyx_v_res->m23 = (-__pyx_v_self->m23);

  /* "cgtypes.pyx":1857
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23
 *         res.m31 = -self.m31             # <<<<<<<<<<<<<<
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33
 */
  __pyx_v_res->m31 = (-__pyx_v_self->m31);

  /* "cgtypes.pyx":1858
 *         res.m23 = -self.m23
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32             # <<<<<<<<<<<<<<
 *         res.m33 = -self.m33
 *         return res
 */
  __pyx_v_res->m32 = (-__pyx_v_self->m32);

  /* "cgtypes.pyx":1859
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = (-__pyx_v_self->m33);

  /* "cgtypes.pyx":1860
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1846
 * 
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1862
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         cdef mat3 res
 *         res = mat3()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_25__pos__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat3_25__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_24__pos__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_24__pos__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "cgtypes.pyx":1864
 *     def __pos__(self):
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":1865
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 */
  __pyx_t_2 = __pyx_v_self->m11;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":1866
 *         res = mat3()
 *         res.m11 = self.m11
 *         res.m12 = self.m12             # <<<<<<<<<<<<<<
 *         res.m13 = self.m13
 *         res.m21 = self.m21
 */
  __pyx_t_2 = __pyx_v_self->m12;
  __pyx_v_res->m12 = __pyx_t_2;

  /* "cgtypes.pyx":1867
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 *         res.m13 = self.m13             # <<<<<<<<<<<<<<
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 */
  __pyx_t_2 = __pyx_v_self->m13;
  __pyx_v_res->m13 = __pyx_t_2;

  /* "cgtypes.pyx":1868
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 *         res.m21 = self.m21             # <<<<<<<<<<<<<<
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 */
  __pyx_t_2 = __pyx_v_self->m21;
  __pyx_v_res->m21 = __pyx_t_2;

  /* "cgtypes.pyx":1869
 *         res.m13 = self.m13
 *         res.m21 = self.m21
 *         res.m22 = self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = self.m23
 *         res.m31 = self.m31
 */
  __pyx_t_2 = __pyx_v_self->m22;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":1870
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 *         res.m23 = self.m23             # <<<<<<<<<<<<<<
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 */
  __pyx_t_2 = __pyx_v_self->m23;
  __pyx_v_res->m23 = __pyx_t_2;

  /* "cgtypes.pyx":1871
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 *         res.m31 = self.m31             # <<<<<<<<<<<<<<
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 */
  __pyx_t_2 = __pyx_v_self->m31;
  __pyx_v_res->m31 = __pyx_t_2;

  /* "cgtypes.pyx":1872
 *         res.m23 = self.m23
 *         res.m31 = self.m31
 *         res.m32 = self.m32             # <<<<<<<<<<<<<<
 *         res.m33 = self.m33
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->m32;
  __pyx_v_res->m32 = __pyx_t_2;

  /* "cgtypes.pyx":1873
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 *         res.m33 = self.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->m33;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":1874
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __iadd__(self, mat3 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":1862
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         cdef mat3 res
 *         res = mat3()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1876
 *         return res
 * 
 *     def __iadd__(self, mat3 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix addition.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_26__iadd__[] = "Inline matrix addition.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_26__iadd__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_mat3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_26__iadd__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_26__iadd__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "cgtypes.pyx":1879
 *         """Inline matrix addition.
 *         """
 *         self.m11 = self.m11 + other.m11             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 + __pyx_v_other->m11);

  /* "cgtypes.pyx":1880
 *         """
 *         self.m11 = self.m11 + other.m11
 *         self.m12 = self.m12 + other.m12             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13 + other.m13
 *         self.m21 = self.m21 + other.m21
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 + __pyx_v_other->m12);

  /* "cgtypes.pyx":1881
 *         self.m11 = self.m11 + other.m11
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 + __pyx_v_other->m13);

  /* "cgtypes.pyx":1882
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13
 *         self.m21 = self.m21 + other.m21             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 + __pyx_v_other->m21);

  /* "cgtypes.pyx":1883
 *         self.m13 = self.m13 + other.m13
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23 + other.m23
 *         self.m31 = self.m31 + other.m31
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 + __pyx_v_other->m22);

  /* "cgtypes.pyx":1884
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 + __pyx_v_other->m23);

  /* "cgtypes.pyx":1885
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23
 *         self.m31 = self.m31 + other.m31             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 + __pyx_v_other->m31);

  /* "cgtypes.pyx":1886
 *         self.m23 = self.m23 + other.m23
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33 + other.m33
 *         return self
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 + __pyx_v_other->m32);

  /* "cgtypes.pyx":1887
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 + __pyx_v_other->m33);

  /* "cgtypes.pyx":1888
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, mat3 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":1876
 *         return res
 * 
 *     def __iadd__(self, mat3 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix addition.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1890
 *         return self
 * 
 *     def __isub__(self, mat3 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix subtraction.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_28__isub__[] = "Inline matrix subtraction.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_28__isub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_mat3, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat3_28__isub__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_28__isub__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "cgtypes.pyx":1893
 *         """Inline matrix subtraction.
 *         """
 *         self.m11 = self.m11 - other.m11             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 - __pyx_v_other->m11);

  /* "cgtypes.pyx":1894
 *         """
 *         self.m11 = self.m11 - other.m11
 *         self.m12 = self.m12 - other.m12             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13 - other.m13
 *         self.m21 = self.m21 - other.m21
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 - __pyx_v_other->m12);

  /* "cgtypes.pyx":1895
 *         self.m11 = self.m11 - other.m11
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 - __pyx_v_other->m13);

  /* "cgtypes.pyx":1896
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13
 *         self.m21 = self.m21 - other.m21             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 - __pyx_v_other->m21);

  /* "cgtypes.pyx":1897
 *         self.m13 = self.m13 - other.m13
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23 - other.m23
 *         self.m31 = self.m31 - other.m31
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 - __pyx_v_other->m22);

  /* "cgtypes.pyx":1898
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 - __pyx_v_other->m23);

  /* "cgtypes.pyx":1899
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23
 *         self.m31 = self.m31 - other.m31             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 - __pyx_v_other->m31);

  /* "cgtypes.pyx":1900
 *         self.m23 = self.m23 - other.m23
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33 - other.m33
 *         return self
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 - __pyx_v_other->m32);

  /* "cgtypes.pyx":1901
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 - __pyx_v_other->m33);

  /* "cgtypes.pyx":1902
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":1890
 *         return self
 * 
 *     def __isub__(self, mat3 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix subtraction.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1904
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (scalar or matrix).
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_30__imul__[] = "Inline multiplication (scalar or matrix).\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_30__imul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_30__imul__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_30__imul__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  double __pyx_v_a;
  double __pyx_v_b;
  double __pyx_v_c;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_mb = 0;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "cgtypes.pyx":1910
 *         cdef mat3 mb
 * 
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":1911
 * 
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             self.m11 = self.m11*r
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1912
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1913
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             self.m11 = self.m11*r             # <<<<<<<<<<<<<<
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r
 */
    __pyx_v_self->m11 = (__pyx_v_self->m11 * __pyx_v_r);

    /* "cgtypes.pyx":1914
 *             r=other
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r             # <<<<<<<<<<<<<<
 *             self.m13 = self.m13*r
 *             self.m21 = self.m21*r
 */
    __pyx_v_self->m12 = (__pyx_v_self->m12 * __pyx_v_r);

    /* "cgtypes.pyx":1915
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r             # <<<<<<<<<<<<<<
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r
 */
    __pyx_v_self->m13 = (__pyx_v_self->m13 * __pyx_v_r);

    /* "cgtypes.pyx":1916
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r
 *             self.m21 = self.m21*r             # <<<<<<<<<<<<<<
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r
 */
    __pyx_v_self->m21 = (__pyx_v_self->m21 * __pyx_v_r);

    /* "cgtypes.pyx":1917
 *             self.m13 = self.m13*r
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r             # <<<<<<<<<<<<<<
 *             self.m23 = self.m23*r
 *             self.m31 = self.m31*r
 */
    __pyx_v_self->m22 = (__pyx_v_self->m22 * __pyx_v_r);

    /* "cgtypes.pyx":1918
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r             # <<<<<<<<<<<<<<
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r
 */
    __pyx_v_self->m23 = (__pyx_v_self->m23 * __pyx_v_r);

    /* "cgtypes.pyx":1919
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r
 *             self.m31 = self.m31*r             # <<<<<<<<<<<<<<
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r
 */
    __pyx_v_self->m31 = (__pyx_v_self->m31 * __pyx_v_r);

    /* "cgtypes.pyx":1920
 *             self.m23 = self.m23*r
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r             # <<<<<<<<<<<<<<
 *             self.m33 = self.m33*r
 *             return self
 */
    __pyx_v_self->m32 = (__pyx_v_self->m32 * __pyx_v_r);

    /* "cgtypes.pyx":1921
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==mat3:
 */
    __pyx_v_self->m33 = (__pyx_v_self->m33 * __pyx_v_r);

    /* "cgtypes.pyx":1922
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==mat3:
 *             mb = other
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1923
 *             self.m33 = self.m33*r
 *             return self
 *         elif tb==mat3:             # <<<<<<<<<<<<<<
 *             mb = other
 *             a = self.m11
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1924
 *             return self
 *         elif tb==mat3:
 *             mb = other             # <<<<<<<<<<<<<<
 *             a = self.m11
 *             b = self.m12
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1925
 *         elif tb==mat3:
 *             mb = other
 *             a = self.m11             # <<<<<<<<<<<<<<
 *             b = self.m12
 *             c = self.m13
 */
    __pyx_t_4 = __pyx_v_self->m11;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":1926
 *             mb = other
 *             a = self.m11
 *             b = self.m12             # <<<<<<<<<<<<<<
 *             c = self.m13
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31
 */
    __pyx_t_4 = __pyx_v_self->m12;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":1927
 *             a = self.m11
 *             b = self.m12
 *             c = self.m13             # <<<<<<<<<<<<<<
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32
 */
    __pyx_t_4 = __pyx_v_self->m13;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":1928
 *             b = self.m12
 *             c = self.m13
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31             # <<<<<<<<<<<<<<
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33
 */
    __pyx_v_self->m11 = (((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31));

    /* "cgtypes.pyx":1929
 *             c = self.m13
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32             # <<<<<<<<<<<<<<
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m21
 */
    __pyx_v_self->m12 = (((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32));

    /* "cgtypes.pyx":1930
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33             # <<<<<<<<<<<<<<
 *             a = self.m21
 *             b = self.m22
 */
    __pyx_v_self->m13 = (((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33));

    /* "cgtypes.pyx":1931
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m21             # <<<<<<<<<<<<<<
 *             b = self.m22
 *             c = self.m23
 */
    __pyx_t_4 = __pyx_v_self->m21;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":1932
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m21
 *             b = self.m22             # <<<<<<<<<<<<<<
 *             c = self.m23
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31
 */
    __pyx_t_4 = __pyx_v_self->m22;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":1933
 *             a = self.m21
 *             b = self.m22
 *             c = self.m23             # <<<<<<<<<<<<<<
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32
 */
    __pyx_t_4 = __pyx_v_self->m23;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":1934
 *             b = self.m22
 *             c = self.m23
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31             # <<<<<<<<<<<<<<
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33
 */
    __pyx_v_self->m21 = (((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31));

    /* "cgtypes.pyx":1935
 *             c = self.m23
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32             # <<<<<<<<<<<<<<
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m31
 */
    __pyx_v_self->m22 = (((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32));

    /* "cgtypes.pyx":1936
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33             # <<<<<<<<<<<<<<
 *             a = self.m31
 *             b = self.m32
 */
    __pyx_v_self->m23 = (((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33));

    /* "cgtypes.pyx":1937
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m31             # <<<<<<<<<<<<<<
 *             b = self.m32
 *             c = self.m33
 */
    __pyx_t_4 = __pyx_v_self->m31;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":1938
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33
 *             a = self.m31
 *             b = self.m32             # <<<<<<<<<<<<<<
 *             c = self.m33
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31
 */
    __pyx_t_4 = __pyx_v_self->m32;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":1939
 *             a = self.m31
 *             b = self.m32
 *             c = self.m33             # <<<<<<<<<<<<<<
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32
 */
    __pyx_t_4 = __pyx_v_self->m33;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":1940
 *             b = self.m32
 *             c = self.m33
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31             # <<<<<<<<<<<<<<
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33
 */
    __pyx_v_self->m31 = (((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31));

    /* "cgtypes.pyx":1941
 *             c = self.m33
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32             # <<<<<<<<<<<<<<
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33
 *             return self
 */
    __pyx_v_self->m32 = (((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32));

    /* "cgtypes.pyx":1942
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->m33 = (((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33));

    /* "cgtypes.pyx":1943
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for *="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1945
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for *="             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_4, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1904
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (scalar or matrix).
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":1947
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4mat3_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_32__idiv__[] = "Inline division with scalar.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_32__idiv__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_32__idiv__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat3_32__idiv__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "cgtypes.pyx":1951
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":1952
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1953
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1954
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 division"
 *             self.m11 = self.m11/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1955
 *             r=other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"             # <<<<<<<<<<<<<<
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1956
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 division"
 *             self.m11 = self.m11/r             # <<<<<<<<<<<<<<
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m11 = (__pyx_v_self->m11 / __pyx_v_r);

    /* "cgtypes.pyx":1957
 *                 raise ZeroDivisionError,"mat3 division"
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r             # <<<<<<<<<<<<<<
 *             self.m13 = self.m13/r
 *             self.m21 = self.m21/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m12 = (__pyx_v_self->m12 / __pyx_v_r);

    /* "cgtypes.pyx":1958
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r             # <<<<<<<<<<<<<<
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m13 = (__pyx_v_self->m13 / __pyx_v_r);

    /* "cgtypes.pyx":1959
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r
 *             self.m21 = self.m21/r             # <<<<<<<<<<<<<<
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m21 = (__pyx_v_self->m21 / __pyx_v_r);

    /* "cgtypes.pyx":1960
 *             self.m13 = self.m13/r
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r             # <<<<<<<<<<<<<<
 *             self.m23 = self.m23/r
 *             self.m31 = self.m31/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m22 = (__pyx_v_self->m22 / __pyx_v_r);

    /* "cgtypes.pyx":1961
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r             # <<<<<<<<<<<<<<
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m23 = (__pyx_v_self->m23 / __pyx_v_r);

    /* "cgtypes.pyx":1962
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r
 *             self.m31 = self.m31/r             # <<<<<<<<<<<<<<
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m31 = (__pyx_v_self->m31 / __pyx_v_r);

    /* "cgtypes.pyx":1963
 *             self.m23 = self.m23/r
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r             # <<<<<<<<<<<<<<
 *             self.m33 = self.m33/r
 *             return self
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m32 = (__pyx_v_self->m32 / __pyx_v_r);

    /* "cgtypes.pyx":1964
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m33 = (__pyx_v_self->m33 / __pyx_v_r);

    /* "cgtypes.pyx":1965
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":1967
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for /="             # <<<<<<<<<<<<<<
 * 
 *     def __imod__(self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_5, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1947
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":1969
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_34__imod__[] = "Inline modulo.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_34__imod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imod__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_34__imod__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_34__imod__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_mb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imod__", 0);

  /* "cgtypes.pyx":1975
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":1977
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1978
 * 
 *         if tb==float or tb==int or tb==long:
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":1979
 *         if tb==float or tb==int or tb==long:
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1980
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"             # <<<<<<<<<<<<<<
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1981
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, r)             # <<<<<<<<<<<<<<
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)
 */
    __pyx_v_self->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_r);

    /* "cgtypes.pyx":1982
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)             # <<<<<<<<<<<<<<
 *             self.m13 = _fmod(self.m13, r)
 *             self.m21 = _fmod(self.m21, r)
 */
    __pyx_v_self->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_r);

    /* "cgtypes.pyx":1983
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)             # <<<<<<<<<<<<<<
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)
 */
    __pyx_v_self->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_r);

    /* "cgtypes.pyx":1984
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)
 *             self.m21 = _fmod(self.m21, r)             # <<<<<<<<<<<<<<
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)
 */
    __pyx_v_self->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_r);

    /* "cgtypes.pyx":1985
 *             self.m13 = _fmod(self.m13, r)
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)             # <<<<<<<<<<<<<<
 *             self.m23 = _fmod(self.m23, r)
 *             self.m31 = _fmod(self.m31, r)
 */
    __pyx_v_self->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_r);

    /* "cgtypes.pyx":1986
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)             # <<<<<<<<<<<<<<
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)
 */
    __pyx_v_self->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_r);

    /* "cgtypes.pyx":1987
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)
 *             self.m31 = _fmod(self.m31, r)             # <<<<<<<<<<<<<<
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)
 */
    __pyx_v_self->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_r);

    /* "cgtypes.pyx":1988
 *             self.m23 = _fmod(self.m23, r)
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)             # <<<<<<<<<<<<<<
 *             self.m33 = _fmod(self.m33, r)
 *             return self
 */
    __pyx_v_self->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_r);

    /* "cgtypes.pyx":1989
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==mat3:
 */
    __pyx_v_self->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_r);

    /* "cgtypes.pyx":1990
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==mat3:
 *             mb = b
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":1991
 *             self.m33 = _fmod(self.m33, r)
 *             return self
 *         elif tb==mat3:             # <<<<<<<<<<<<<<
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":1992
 *             return self
 *         elif tb==mat3:
 *             mb = b             # <<<<<<<<<<<<<<
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":1993
 *         elif tb==mat3:
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m11) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m12) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m13) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1994
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 *                 raise ZeroDivisionError,"mat3 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m21) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m22) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m23) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":1995
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m31) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m32) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m33) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":1996
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 *                 raise ZeroDivisionError,"mat3 modulo"             # <<<<<<<<<<<<<<
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat3_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":1997
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps):
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)             # <<<<<<<<<<<<<<
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)
 */
    __pyx_v_self->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_mb->m11);

    /* "cgtypes.pyx":1998
 *                 raise ZeroDivisionError,"mat3 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)             # <<<<<<<<<<<<<<
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)
 */
    __pyx_v_self->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_mb->m12);

    /* "cgtypes.pyx":1999
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)             # <<<<<<<<<<<<<<
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)
 */
    __pyx_v_self->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_mb->m13);

    /* "cgtypes.pyx":2000
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)             # <<<<<<<<<<<<<<
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)
 */
    __pyx_v_self->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_mb->m21);

    /* "cgtypes.pyx":2001
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)             # <<<<<<<<<<<<<<
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)
 */
    __pyx_v_self->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_mb->m22);

    /* "cgtypes.pyx":2002
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)             # <<<<<<<<<<<<<<
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)
 */
    __pyx_v_self->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_mb->m23);

    /* "cgtypes.pyx":2003
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)             # <<<<<<<<<<<<<<
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)
 */
    __pyx_v_self->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_mb->m31);

    /* "cgtypes.pyx":2004
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)             # <<<<<<<<<<<<<<
 *             self.m33 = _fmod(self.m33, mb.m33)
 *             return self
 */
    __pyx_v_self->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_mb->m32);

    /* "cgtypes.pyx":2005
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_mb->m33);

    /* "cgtypes.pyx":2006
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":2008
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for %="             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_6, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":1969
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__imod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2011
 * 
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 3)."""
 *         return 3
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7cgtypes_4mat3_37__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_36__len__[] = "Length of the sequence (always 3).";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_36__len__;
#endif
static Py_ssize_t __pyx_pw_7cgtypes_4mat3_37__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_36__len__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_7cgtypes_4mat3_36__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "cgtypes.pyx":2013
 *     def __len__(self):
 *         """Length of the sequence (always 3)."""
 *         return 3             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(mat3 self, key):
 */
  __pyx_r = 3;
  goto __pyx_L0;

  /* "cgtypes.pyx":2011
 * 
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 3)."""
 *         return 3
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2015
 *         return 3
 * 
 *     def __getitem__(mat3 self, key):             # <<<<<<<<<<<<<<
 *         """Return a column or a single matrix element.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_39__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_38__getitem__[] = "Return a column or a single matrix element.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_38__getitem__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat3_39__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_38__getitem__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_38__getitem__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_i;
  int __pyx_v_j;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "cgtypes.pyx":2020
 *         cdef int i,j
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T==int or T==long:
 *             i = key
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":2021
 * 
 *         T=type(key)
 *         if T==int or T==long:             # <<<<<<<<<<<<<<
 *             i = key
 *             if i==0:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2022
 *         T=type(key)
 *         if T==int or T==long:
 *             i = key             # <<<<<<<<<<<<<<
 *             if i==0:
 *                 return vec3(self.m11, self.m21, self.m31)
 */
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_i = __pyx_t_4;

    /* "cgtypes.pyx":2027
 *             elif i==1:
 *                 return vec3(self.m12, self.m22, self.m32)
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 return vec3(self.m13, self.m23, self.m33)
 *             else:
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":2023
 *         if T==int or T==long:
 *             i = key
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 return vec3(self.m11, self.m21, self.m31)
 *             elif i==1:
 */
      case 0:

      /* "cgtypes.pyx":2024
 *             i = key
 *             if i==0:
 *                 return vec3(self.m11, self.m21, self.m31)             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 return vec3(self.m12, self.m22, self.m32)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_2 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;
      break;

      /* "cgtypes.pyx":2025
 *             if i==0:
 *                 return vec3(self.m11, self.m21, self.m31)
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 return vec3(self.m12, self.m22, self.m32)
 *             elif i==2:
 */
      case 1:

      /* "cgtypes.pyx":2026
 *                 return vec3(self.m11, self.m21, self.m31)
 *             elif i==1:
 *                 return vec3(self.m12, self.m22, self.m32)             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 return vec3(self.m13, self.m23, self.m33)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;

      /* "cgtypes.pyx":2027
 *             elif i==1:
 *                 return vec3(self.m12, self.m22, self.m32)
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 return vec3(self.m13, self.m23, self.m33)
 *             else:
 */
      case 2:

      /* "cgtypes.pyx":2028
 *                 return vec3(self.m12, self.m22, self.m32)
 *             elif i==2:
 *                 return vec3(self.m13, self.m23, self.m33)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IndexError, "index out of range"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_5 = 0;
      __pyx_t_2 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L0;
      break;
      default:

      /* "cgtypes.pyx":2030
 *                 return vec3(self.m13, self.m23, self.m33)
 *             else:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 *         elif T==tuple:
 *             if len(key)!=2:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
  }

  /* "cgtypes.pyx":2031
 *             else:
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:             # <<<<<<<<<<<<<<
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 */
  __pyx_t_7 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyTuple_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2032
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:
 *             if len(key)!=2:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 */
    __pyx_t_8 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_8 != 2) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2033
 *         elif T==tuple:
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"             # <<<<<<<<<<<<<<
 *             i = key[0]
 *             j = key[1]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_index_tuple_must_be_a_2_tuple, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":2034
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]             # <<<<<<<<<<<<<<
 *             j = key[1]
 *             if i<0 or i>2 or j<0 or j>2:
 */
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_key, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_i = __pyx_t_4;

    /* "cgtypes.pyx":2035
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 *             j = key[1]             # <<<<<<<<<<<<<<
 *             if i<0 or i>2 or j<0 or j>2:
 *                 raise IndexError, "index out of range"
 */
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_key, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_j = __pyx_t_4;

    /* "cgtypes.pyx":2036
 *             i = key[0]
 *             j = key[1]
 *             if i<0 or i>2 or j<0 or j>2:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "index out of range"
 * 
 */
    __pyx_t_3 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_i > 2) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j > 2) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2037
 *             j = key[1]
 *             if i<0 or i>2 or j<0 or j>2:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":2053
 *                 elif j==2:
 *                     return self.m23
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m31
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":2039
 *                 raise IndexError, "index out of range"
 * 
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m11
 */
      case 0:

      /* "cgtypes.pyx":2040
 * 
 *             if i==0:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m11
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2041
 *             if i==0:
 *                 if j==0:
 *                     return self.m11             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m12
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2042
 *                 if j==0:
 *                     return self.m11
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m12
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2043
 *                     return self.m11
 *                 elif j==1:
 *                     return self.m12             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m13
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2044
 *                 elif j==1:
 *                     return self.m12
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m13
 *             elif i==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2045
 *                     return self.m12
 *                 elif j==2:
 *                     return self.m13             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 if j==0:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      break;

      /* "cgtypes.pyx":2046
 *                 elif j==2:
 *                     return self.m13
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m21
 */
      case 1:

      /* "cgtypes.pyx":2047
 *                     return self.m13
 *             elif i==1:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m21
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2048
 *             elif i==1:
 *                 if j==0:
 *                     return self.m21             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m22
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2049
 *                 if j==0:
 *                     return self.m21
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m22
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2050
 *                     return self.m21
 *                 elif j==1:
 *                     return self.m22             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m23
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2051
 *                 elif j==1:
 *                     return self.m22
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m23
 *             elif i==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2052
 *                     return self.m22
 *                 elif j==2:
 *                     return self.m23             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 if j==0:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      break;

      /* "cgtypes.pyx":2053
 *                 elif j==2:
 *                     return self.m23
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m31
 */
      case 2:

      /* "cgtypes.pyx":2054
 *                     return self.m23
 *             elif i==2:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m31
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2055
 *             elif i==2:
 *                 if j==0:
 *                     return self.m31             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m32
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2056
 *                 if j==0:
 *                     return self.m31
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m32
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2057
 *                     return self.m31
 *                 elif j==1:
 *                     return self.m32             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m33
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":2058
 *                 elif j==1:
 *                     return self.m32
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m33
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2059
 *                     return self.m32
 *                 elif j==2:
 *                     return self.m33             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_r = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L0;
      }
      break;
      default: break;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":2061
 *                     return self.m33
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer_or_2_tuple, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":2015
 *         return 3
 * 
 *     def __getitem__(mat3 self, key):             # <<<<<<<<<<<<<<
 *         """Return a column or a single matrix element.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat3.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2063
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a column or a single matrix element.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4mat3_41__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_40__setitem__[] = "Set a column or a single matrix element.\n\n        The column must be given as a 3-sequence (this includes vec3 as well).\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat3_40__setitem__;
#endif
static int __pyx_pw_7cgtypes_4mat3_41__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_40__setitem__(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4mat3_40__setitem__(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  int __pyx_v_j;
  double __pyx_v_v;
  PyObject *__pyx_v_T = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "cgtypes.pyx":2071
 *         cdef double v
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T==int or T==long:
 *             if len(value)!=3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":2072
 * 
 *         T=type(key)
 *         if T==int or T==long:             # <<<<<<<<<<<<<<
 *             if len(value)!=3:
 *                 raise ValueError, "3-sequence expected"
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2073
 *         T=type(key)
 *         if T==int or T==long:
 *             if len(value)!=3:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "3-sequence expected"
 *             i = key
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_4 != 3) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2074
 *         if T==int or T==long:
 *             if len(value)!=3:
 *                 raise ValueError, "3-sequence expected"             # <<<<<<<<<<<<<<
 *             i = key
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_3_sequence_expected, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":2075
 *             if len(value)!=3:
 *                 raise ValueError, "3-sequence expected"
 *             i = key             # <<<<<<<<<<<<<<
 *             if i==0:
 *                 self.m11 = value[0]
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_i = __pyx_t_5;

    /* "cgtypes.pyx":2084
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":2076
 *                 raise ValueError, "3-sequence expected"
 *             i = key
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]
 */
      case 0:

      /* "cgtypes.pyx":2077
 *             i = key
 *             if i==0:
 *                 self.m11 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m11 = __pyx_t_6;

      /* "cgtypes.pyx":2078
 *             if i==0:
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m31 = value[2]
 *             elif i==1:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m21 = __pyx_t_6;

      /* "cgtypes.pyx":2079
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 self.m12 = value[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m31 = __pyx_t_6;
      break;

      /* "cgtypes.pyx":2080
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]
 */
      case 1:

      /* "cgtypes.pyx":2081
 *                 self.m31 = value[2]
 *             elif i==1:
 *                 self.m12 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m12 = __pyx_t_6;

      /* "cgtypes.pyx":2082
 *             elif i==1:
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m32 = value[2]
 *             elif i==2:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m22 = __pyx_t_6;

      /* "cgtypes.pyx":2083
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 self.m13 = value[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m32 = __pyx_t_6;
      break;

      /* "cgtypes.pyx":2084
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]
 */
      case 2:

      /* "cgtypes.pyx":2085
 *                 self.m32 = value[2]
 *             elif i==2:
 *                 self.m13 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m23 = value[1]
 *                 self.m33 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m13 = __pyx_t_6;

      /* "cgtypes.pyx":2086
 *             elif i==2:
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m33 = value[2]
 *             else:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m23 = __pyx_t_6;

      /* "cgtypes.pyx":2087
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]
 *                 self.m33 = value[2]             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IndexError, "index out of range"
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m33 = __pyx_t_6;
      break;
      default:

      /* "cgtypes.pyx":2089
 *                 self.m33 = value[2]
 *             else:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 *         elif T==tuple:
 *             if len(key)!=2:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":2090
 *             else:
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:             # <<<<<<<<<<<<<<
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyTuple_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2091
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:
 *             if len(key)!=2:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_4 != 2) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2092
 *         elif T==tuple:
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"             # <<<<<<<<<<<<<<
 *             i = key[0]
 *             j = key[1]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_index_tuple_must_be_a_2_tuple, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":2093
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]             # <<<<<<<<<<<<<<
 *             j = key[1]
 *             v = value
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_i = __pyx_t_5;

    /* "cgtypes.pyx":2094
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 *             j = key[1]             # <<<<<<<<<<<<<<
 *             v = value
 *             if i<0 or i>2 or j<0 or j>2:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_j = __pyx_t_5;

    /* "cgtypes.pyx":2095
 *             i = key[0]
 *             j = key[1]
 *             v = value             # <<<<<<<<<<<<<<
 *             if i<0 or i>2 or j<0 or j>2:
 *                 raise IndexError, "index out of range"
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_v = __pyx_t_6;

    /* "cgtypes.pyx":2096
 *             j = key[1]
 *             v = value
 *             if i<0 or i>2 or j<0 or j>2:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "index out of range"
 * 
 */
    __pyx_t_3 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_i > 2) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j > 2) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2097
 *             v = value
 *             if i<0 or i>2 or j<0 or j>2:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":2113
 *                 elif j==2:
 *                     self.m23 = v
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m31 = v
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":2099
 *                 raise IndexError, "index out of range"
 * 
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m11 = v
 */
      case 0:

      /* "cgtypes.pyx":2100
 * 
 *             if i==0:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m11 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2101
 *             if i==0:
 *                 if j==0:
 *                     self.m11 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m12 = v
 */
        __pyx_v_self->m11 = __pyx_v_v;
        goto __pyx_L13;
      }

      /* "cgtypes.pyx":2102
 *                 if j==0:
 *                     self.m11 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m12 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2103
 *                     self.m11 = v
 *                 elif j==1:
 *                     self.m12 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m13 = v
 */
        __pyx_v_self->m12 = __pyx_v_v;
        goto __pyx_L13;
      }

      /* "cgtypes.pyx":2104
 *                 elif j==1:
 *                     self.m12 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m13 = v
 *             elif i==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2105
 *                     self.m12 = v
 *                 elif j==2:
 *                     self.m13 = v             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 if j==0:
 */
        __pyx_v_self->m13 = __pyx_v_v;
        goto __pyx_L13;
      }
      __pyx_L13:;
      break;

      /* "cgtypes.pyx":2106
 *                 elif j==2:
 *                     self.m13 = v
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m21 = v
 */
      case 1:

      /* "cgtypes.pyx":2107
 *                     self.m13 = v
 *             elif i==1:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m21 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2108
 *             elif i==1:
 *                 if j==0:
 *                     self.m21 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m22 = v
 */
        __pyx_v_self->m21 = __pyx_v_v;
        goto __pyx_L14;
      }

      /* "cgtypes.pyx":2109
 *                 if j==0:
 *                     self.m21 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m22 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2110
 *                     self.m21 = v
 *                 elif j==1:
 *                     self.m22 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m23 = v
 */
        __pyx_v_self->m22 = __pyx_v_v;
        goto __pyx_L14;
      }

      /* "cgtypes.pyx":2111
 *                 elif j==1:
 *                     self.m22 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m23 = v
 *             elif i==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2112
 *                     self.m22 = v
 *                 elif j==2:
 *                     self.m23 = v             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 if j==0:
 */
        __pyx_v_self->m23 = __pyx_v_v;
        goto __pyx_L14;
      }
      __pyx_L14:;
      break;

      /* "cgtypes.pyx":2113
 *                 elif j==2:
 *                     self.m23 = v
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m31 = v
 */
      case 2:

      /* "cgtypes.pyx":2114
 *                     self.m23 = v
 *             elif i==2:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m31 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2115
 *             elif i==2:
 *                 if j==0:
 *                     self.m31 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m32 = v
 */
        __pyx_v_self->m31 = __pyx_v_v;
        goto __pyx_L15;
      }

      /* "cgtypes.pyx":2116
 *                 if j==0:
 *                     self.m31 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m32 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2117
 *                     self.m31 = v
 *                 elif j==1:
 *                     self.m32 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m33 = v
 */
        __pyx_v_self->m32 = __pyx_v_v;
        goto __pyx_L15;
      }

      /* "cgtypes.pyx":2118
 *                 elif j==1:
 *                     self.m32 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m33 = v
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2119
 *                     self.m32 = v
 *                 elif j==2:
 *                     self.m33 = v             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"
 */
        __pyx_v_self->m33 = __pyx_v_v;
        goto __pyx_L15;
      }
      __pyx_L15:;
      break;
      default: break;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":2121
 *                     self.m33 = v
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"             # <<<<<<<<<<<<<<
 * 
 *     def getRow(self, idx):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer_or_2_tuple, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":2063
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a column or a single matrix element.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2123
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def getRow(self, idx):             # <<<<<<<<<<<<<<
 *         """Return row (as vec3)."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_43getRow(PyObject *__pyx_v_self, PyObject *__pyx_v_idx); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_42getRow[] = "Return row (as vec3).";
static PyObject *__pyx_pw_7cgtypes_4mat3_43getRow(PyObject *__pyx_v_self, PyObject *__pyx_v_idx) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRow (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_42getRow(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_idx));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_42getRow(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getRow", 0);

  /* "cgtypes.pyx":2127
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":2128
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2129
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2131
 *             raise TypeError,"index must be integer"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             return vec3(self.m11, self.m12, self.m13)
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_4;

  /* "cgtypes.pyx":2136
 *         elif i==1:
 *             return vec3(self.m21, self.m22, self.m23)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec3(self.m31, self.m32, self.m33)
 *         else:
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":2132
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             return vec3(self.m11, self.m12, self.m13)
 *         elif i==1:
 */
    case 0:

    /* "cgtypes.pyx":2133
 *         i = idx
 *         if i==0:
 *             return vec3(self.m11, self.m12, self.m13)             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             return vec3(self.m21, self.m22, self.m23)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2134
 *         if i==0:
 *             return vec3(self.m11, self.m12, self.m13)
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             return vec3(self.m21, self.m22, self.m23)
 *         elif i==2:
 */
    case 1:

    /* "cgtypes.pyx":2135
 *             return vec3(self.m11, self.m12, self.m13)
 *         elif i==1:
 *             return vec3(self.m21, self.m22, self.m23)             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             return vec3(self.m31, self.m32, self.m33)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2136
 *         elif i==1:
 *             return vec3(self.m21, self.m22, self.m23)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec3(self.m31, self.m32, self.m33)
 *         else:
 */
    case 2:

    /* "cgtypes.pyx":2137
 *             return vec3(self.m21, self.m22, self.m23)
 *         elif i==2:
 *             return vec3(self.m31, self.m32, self.m33)             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":2139
 *             return vec3(self.m31, self.m32, self.m33)
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def setRow(self, idx, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2123
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def getRow(self, idx):             # <<<<<<<<<<<<<<
 *         """Return row (as vec3)."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat3.getRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2141
 *             raise IndexError, "index out of range"
 * 
 *     def setRow(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set row."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_45setRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_44setRow[] = "Set row.";
static PyObject *__pyx_pw_7cgtypes_4mat3_45setRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRow", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_idx = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.setRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_44setRow(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_44setRow(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setRow", 0);

  /* "cgtypes.pyx":2145
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":2146
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2147
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         if len(value)!=3:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2149
 *             raise TypeError,"index must be integer"
 * 
 *         if len(value)!=3:             # <<<<<<<<<<<<<<
 *             raise ValueError, "3-sequence expected"
 * 
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((__pyx_t_4 != 3) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2150
 * 
 *         if len(value)!=3:
 *             raise ValueError, "3-sequence expected"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_3_sequence_expected, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2152
 *             raise ValueError, "3-sequence expected"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             self.m11 = value[0]
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_5;

  /* "cgtypes.pyx":2161
 *             self.m22 = value[1]
 *             self.m23 = value[2]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m31 = value[0]
 *             self.m32 = value[1]
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":2153
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             self.m11 = value[0]
 *             self.m12 = value[1]
 */
    case 0:

    /* "cgtypes.pyx":2154
 *         i = idx
 *         if i==0:
 *             self.m11 = value[0]             # <<<<<<<<<<<<<<
 *             self.m12 = value[1]
 *             self.m13 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_6;

    /* "cgtypes.pyx":2155
 *         if i==0:
 *             self.m11 = value[0]
 *             self.m12 = value[1]             # <<<<<<<<<<<<<<
 *             self.m13 = value[2]
 *         elif i==1:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_6;

    /* "cgtypes.pyx":2156
 *             self.m11 = value[0]
 *             self.m12 = value[1]
 *             self.m13 = value[2]             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             self.m21 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":2157
 *             self.m12 = value[1]
 *             self.m13 = value[2]
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             self.m21 = value[0]
 *             self.m22 = value[1]
 */
    case 1:

    /* "cgtypes.pyx":2158
 *             self.m13 = value[2]
 *         elif i==1:
 *             self.m21 = value[0]             # <<<<<<<<<<<<<<
 *             self.m22 = value[1]
 *             self.m23 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_6;

    /* "cgtypes.pyx":2159
 *         elif i==1:
 *             self.m21 = value[0]
 *             self.m22 = value[1]             # <<<<<<<<<<<<<<
 *             self.m23 = value[2]
 *         elif i==2:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_6;

    /* "cgtypes.pyx":2160
 *             self.m21 = value[0]
 *             self.m22 = value[1]
 *             self.m23 = value[2]             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             self.m31 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":2161
 *             self.m22 = value[1]
 *             self.m23 = value[2]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m31 = value[0]
 *             self.m32 = value[1]
 */
    case 2:

    /* "cgtypes.pyx":2162
 *             self.m23 = value[2]
 *         elif i==2:
 *             self.m31 = value[0]             # <<<<<<<<<<<<<<
 *             self.m32 = value[1]
 *             self.m33 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_6;

    /* "cgtypes.pyx":2163
 *         elif i==2:
 *             self.m31 = value[0]
 *             self.m32 = value[1]             # <<<<<<<<<<<<<<
 *             self.m33 = value[2]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_6;

    /* "cgtypes.pyx":2164
 *             self.m31 = value[0]
 *             self.m32 = value[1]
 *             self.m33 = value[2]             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_6;
    break;
    default:

    /* "cgtypes.pyx":2166
 *             self.m33 = value[2]
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2141
 *             raise IndexError, "index out of range"
 * 
 *     def setRow(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set row."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.setRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2169
 * 
 * 
 *     def getColumn(self, idx):             # <<<<<<<<<<<<<<
 *         """Return column (as vec3)."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_47getColumn(PyObject *__pyx_v_self, PyObject *__pyx_v_idx); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_46getColumn[] = "Return column (as vec3).";
static PyObject *__pyx_pw_7cgtypes_4mat3_47getColumn(PyObject *__pyx_v_self, PyObject *__pyx_v_idx) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getColumn (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_46getColumn(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_idx));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_46getColumn(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getColumn", 0);

  /* "cgtypes.pyx":2173
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":2174
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2175
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2177
 *             raise TypeError,"index must be integer"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             return vec3(self.m11, self.m21, self.m31)
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_4;

  /* "cgtypes.pyx":2182
 *         elif i==1:
 *             return vec3(self.m12, self.m22, self.m32)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec3(self.m13, self.m23, self.m33)
 *         else:
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":2178
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             return vec3(self.m11, self.m21, self.m31)
 *         elif i==1:
 */
    case 0:

    /* "cgtypes.pyx":2179
 *         i = idx
 *         if i==0:
 *             return vec3(self.m11, self.m21, self.m31)             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             return vec3(self.m12, self.m22, self.m32)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2180
 *         if i==0:
 *             return vec3(self.m11, self.m21, self.m31)
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             return vec3(self.m12, self.m22, self.m32)
 *         elif i==2:
 */
    case 1:

    /* "cgtypes.pyx":2181
 *             return vec3(self.m11, self.m21, self.m31)
 *         elif i==1:
 *             return vec3(self.m12, self.m22, self.m32)             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             return vec3(self.m13, self.m23, self.m33)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2182
 *         elif i==1:
 *             return vec3(self.m12, self.m22, self.m32)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec3(self.m13, self.m23, self.m33)
 *         else:
 */
    case 2:

    /* "cgtypes.pyx":2183
 *             return vec3(self.m12, self.m22, self.m32)
 *         elif i==2:
 *             return vec3(self.m13, self.m23, self.m33)             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":2185
 *             return vec3(self.m13, self.m23, self.m33)
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def setColumn(self, idx, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2169
 * 
 * 
 *     def getColumn(self, idx):             # <<<<<<<<<<<<<<
 *         """Return column (as vec3)."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat3.getColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2187
 *             raise IndexError, "index out of range"
 * 
 *     def setColumn(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set column."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_49setColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_48setColumn[] = "Set column.";
static PyObject *__pyx_pw_7cgtypes_4mat3_49setColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setColumn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setColumn", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setColumn") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_idx = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setColumn", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.setColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_48setColumn(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_48setColumn(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setColumn", 0);

  /* "cgtypes.pyx":2191
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":2192
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2193
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         if len(value)!=3:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2195
 *             raise TypeError,"index must be integer"
 * 
 *         if len(value)!=3:             # <<<<<<<<<<<<<<
 *             raise ValueError, "3-sequence expected"
 * 
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((__pyx_t_4 != 3) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2196
 * 
 *         if len(value)!=3:
 *             raise ValueError, "3-sequence expected"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_3_sequence_expected, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2198
 *             raise ValueError, "3-sequence expected"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             self.m11 = value[0]
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_5;

  /* "cgtypes.pyx":2207
 *             self.m22 = value[1]
 *             self.m32 = value[2]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m13 = value[0]
 *             self.m23 = value[1]
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":2199
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             self.m11 = value[0]
 *             self.m21 = value[1]
 */
    case 0:

    /* "cgtypes.pyx":2200
 *         i = idx
 *         if i==0:
 *             self.m11 = value[0]             # <<<<<<<<<<<<<<
 *             self.m21 = value[1]
 *             self.m31 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_6;

    /* "cgtypes.pyx":2201
 *         if i==0:
 *             self.m11 = value[0]
 *             self.m21 = value[1]             # <<<<<<<<<<<<<<
 *             self.m31 = value[2]
 *         elif i==1:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_6;

    /* "cgtypes.pyx":2202
 *             self.m11 = value[0]
 *             self.m21 = value[1]
 *             self.m31 = value[2]             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             self.m12 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":2203
 *             self.m21 = value[1]
 *             self.m31 = value[2]
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             self.m12 = value[0]
 *             self.m22 = value[1]
 */
    case 1:

    /* "cgtypes.pyx":2204
 *             self.m31 = value[2]
 *         elif i==1:
 *             self.m12 = value[0]             # <<<<<<<<<<<<<<
 *             self.m22 = value[1]
 *             self.m32 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_6;

    /* "cgtypes.pyx":2205
 *         elif i==1:
 *             self.m12 = value[0]
 *             self.m22 = value[1]             # <<<<<<<<<<<<<<
 *             self.m32 = value[2]
 *         elif i==2:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_6;

    /* "cgtypes.pyx":2206
 *             self.m12 = value[0]
 *             self.m22 = value[1]
 *             self.m32 = value[2]             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             self.m13 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":2207
 *             self.m22 = value[1]
 *             self.m32 = value[2]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m13 = value[0]
 *             self.m23 = value[1]
 */
    case 2:

    /* "cgtypes.pyx":2208
 *             self.m32 = value[2]
 *         elif i==2:
 *             self.m13 = value[0]             # <<<<<<<<<<<<<<
 *             self.m23 = value[1]
 *             self.m33 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_6;

    /* "cgtypes.pyx":2209
 *         elif i==2:
 *             self.m13 = value[0]
 *             self.m23 = value[1]             # <<<<<<<<<<<<<<
 *             self.m33 = value[2]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_6;

    /* "cgtypes.pyx":2210
 *             self.m13 = value[0]
 *             self.m23 = value[1]
 *             self.m33 = value[2]             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_6;
    break;
    default:

    /* "cgtypes.pyx":2212
 *             self.m33 = value[2]
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2187
 *             raise IndexError, "index out of range"
 * 
 *     def setColumn(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set column."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.setColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2215
 * 
 * 
 *     def toList(self, rowmajor=0):             # <<<<<<<<<<<<<<
 *         """Return a list containing the matrix elements.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_51toList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_50toList[] = "Return a list containing the matrix elements.\n\n        By default the list is in column-major order. If you set the\n        optional argument rowmajor to 1, you'll get the list in row-major\n        order.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_51toList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rowmajor = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toList (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rowmajor,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmajor);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "toList") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rowmajor = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("toList", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.toList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_50toList(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_rowmajor);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_50toList(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_rowmajor) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toList", 0);

  /* "cgtypes.pyx":2222
 *         order.
 *         """
 *         if rowmajor:             # <<<<<<<<<<<<<<
 *             return [self.m11, self.m12, self.m13,
 *                     self.m21, self.m22, self.m23,
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_rowmajor); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":2223
 *         """
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13,             # <<<<<<<<<<<<<<
 *                     self.m21, self.m22, self.m23,
 *                     self.m31, self.m32, self.m33]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "cgtypes.pyx":2224
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13,
 *                     self.m21, self.m22, self.m23,             # <<<<<<<<<<<<<<
 *                     self.m31, self.m32, self.m33]
 *         else:
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "cgtypes.pyx":2225
 *             return [self.m11, self.m12, self.m13,
 *                     self.m21, self.m22, self.m23,
 *                     self.m31, self.m32, self.m33]             # <<<<<<<<<<<<<<
 *         else:
 *             return [self.m11, self.m21, self.m31,
 */
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);

    /* "cgtypes.pyx":2223
 *         """
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13,             # <<<<<<<<<<<<<<
 *                     self.m21, self.m22, self.m23,
 *                     self.m31, self.m32, self.m33]
 */
    __pyx_t_11 = PyList_New(9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_11, 4, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_11, 5, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_11, 6, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_11, 7, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_11, 8, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_r = __pyx_t_11;
    __pyx_t_11 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":2227
 *                     self.m31, self.m32, self.m33]
 *         else:
 *             return [self.m11, self.m21, self.m31,             # <<<<<<<<<<<<<<
 *                     self.m12, self.m22, self.m32,
 *                     self.m13, self.m23, self.m33]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);

    /* "cgtypes.pyx":2228
 *         else:
 *             return [self.m11, self.m21, self.m31,
 *                     self.m12, self.m22, self.m32,             # <<<<<<<<<<<<<<
 *                     self.m13, self.m23, self.m33]
 * 
 */
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);

    /* "cgtypes.pyx":2229
 *             return [self.m11, self.m21, self.m31,
 *                     self.m12, self.m22, self.m32,
 *                     self.m13, self.m23, self.m33]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "cgtypes.pyx":2227
 *                     self.m31, self.m32, self.m33]
 *         else:
 *             return [self.m11, self.m21, self.m31,             # <<<<<<<<<<<<<<
 *                     self.m12, self.m22, self.m32,
 *                     self.m13, self.m23, self.m33]
 */
    __pyx_t_2 = PyList_New(9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_2, 4, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_2, 7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_2, 8, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_11 = 0;
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":2215
 * 
 * 
 *     def toList(self, rowmajor=0):             # <<<<<<<<<<<<<<
 *         """Return a list containing the matrix elements.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("cgtypes.mat3.toList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2232
 * 
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         """Return identity matrix.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_53identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_52identity[] = "Return identity matrix.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_53identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("identity (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_52identity(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_52identity(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("identity", 0);

  /* "cgtypes.pyx":2236
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2237
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = 1.0             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  __pyx_v_res->m11 = 1.0;

  /* "cgtypes.pyx":2238
 *         res = mat3()
 *         res.m11 = 1.0
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m21 = 0.0
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":2239
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":2240
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":2241
 *         res.m13 = 0.0
 *         res.m21 = 0.0
 *         res.m22 = 1.0             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m31 = 0.0
 */
  __pyx_v_res->m22 = 1.0;

  /* "cgtypes.pyx":2242
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":2243
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":2244
 *         res.m23 = 0.0
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = 1.0
 *         return res
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":2245
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = 1.0;

  /* "cgtypes.pyx":2246
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def transpose(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2232
 * 
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         """Return identity matrix.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2248
 *         return res
 * 
 *     def transpose(self):             # <<<<<<<<<<<<<<
 *         """Return transpose matrix.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_55transpose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_54transpose[] = "Return transpose matrix.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_55transpose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transpose (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_54transpose(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_54transpose(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("transpose", 0);

  /* "cgtypes.pyx":2252
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = self.m11
 *         res.m12 = self.m21
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2253
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = self.m21
 *         res.m13 = self.m31
 */
  __pyx_t_2 = __pyx_v_self->m11;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":2254
 *         res = mat3()
 *         res.m11 = self.m11
 *         res.m12 = self.m21             # <<<<<<<<<<<<<<
 *         res.m13 = self.m31
 *         res.m21 = self.m12
 */
  __pyx_t_2 = __pyx_v_self->m21;
  __pyx_v_res->m12 = __pyx_t_2;

  /* "cgtypes.pyx":2255
 *         res.m11 = self.m11
 *         res.m12 = self.m21
 *         res.m13 = self.m31             # <<<<<<<<<<<<<<
 *         res.m21 = self.m12
 *         res.m22 = self.m22
 */
  __pyx_t_2 = __pyx_v_self->m31;
  __pyx_v_res->m13 = __pyx_t_2;

  /* "cgtypes.pyx":2256
 *         res.m12 = self.m21
 *         res.m13 = self.m31
 *         res.m21 = self.m12             # <<<<<<<<<<<<<<
 *         res.m22 = self.m22
 *         res.m23 = self.m32
 */
  __pyx_t_2 = __pyx_v_self->m12;
  __pyx_v_res->m21 = __pyx_t_2;

  /* "cgtypes.pyx":2257
 *         res.m13 = self.m31
 *         res.m21 = self.m12
 *         res.m22 = self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = self.m32
 *         res.m31 = self.m13
 */
  __pyx_t_2 = __pyx_v_self->m22;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":2258
 *         res.m21 = self.m12
 *         res.m22 = self.m22
 *         res.m23 = self.m32             # <<<<<<<<<<<<<<
 *         res.m31 = self.m13
 *         res.m32 = self.m23
 */
  __pyx_t_2 = __pyx_v_self->m32;
  __pyx_v_res->m23 = __pyx_t_2;

  /* "cgtypes.pyx":2259
 *         res.m22 = self.m22
 *         res.m23 = self.m32
 *         res.m31 = self.m13             # <<<<<<<<<<<<<<
 *         res.m32 = self.m23
 *         res.m33 = self.m33
 */
  __pyx_t_2 = __pyx_v_self->m13;
  __pyx_v_res->m31 = __pyx_t_2;

  /* "cgtypes.pyx":2260
 *         res.m23 = self.m32
 *         res.m31 = self.m13
 *         res.m32 = self.m23             # <<<<<<<<<<<<<<
 *         res.m33 = self.m33
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->m23;
  __pyx_v_res->m32 = __pyx_t_2;

  /* "cgtypes.pyx":2261
 *         res.m31 = self.m13
 *         res.m32 = self.m23
 *         res.m33 = self.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->m33;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":2262
 *         res.m32 = self.m23
 *         res.m33 = self.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def determinant(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2248
 *         return res
 * 
 *     def transpose(self):             # <<<<<<<<<<<<<<
 *         """Return transpose matrix.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.transpose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2264
 *         return res
 * 
 *     def determinant(self):             # <<<<<<<<<<<<<<
 *         """Return determinant.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_57determinant(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_56determinant[] = "Return determinant.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_57determinant(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("determinant (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_56determinant(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_56determinant(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("determinant", 0);

  /* "cgtypes.pyx":2267
 *         """Return determinant.
 *         """
 *         return self.m11*self.m22*self.m33+ \             # <<<<<<<<<<<<<<
 *                self.m12*self.m23*self.m31+ \
 *                self.m13*self.m21*self.m32- \
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":2271
 *                self.m13*self.m21*self.m32- \
 *                self.m31*self.m22*self.m13- \
 *                self.m32*self.m23*self.m11- \             # <<<<<<<<<<<<<<
 *                self.m33*self.m21*self.m12
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble((((((((__pyx_v_self->m11 * __pyx_v_self->m22) * __pyx_v_self->m33) + ((__pyx_v_self->m12 * __pyx_v_self->m23) * __pyx_v_self->m31)) + ((__pyx_v_self->m13 * __pyx_v_self->m21) * __pyx_v_self->m32)) - ((__pyx_v_self->m31 * __pyx_v_self->m22) * __pyx_v_self->m13)) - ((__pyx_v_self->m32 * __pyx_v_self->m23) * __pyx_v_self->m11)) - ((__pyx_v_self->m33 * __pyx_v_self->m21) * __pyx_v_self->m12))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2264
 *         return res
 * 
 *     def determinant(self):             # <<<<<<<<<<<<<<
 *         """Return determinant.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.determinant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2274
 *                self.m33*self.m21*self.m12
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse matrix."""
 *         cdef mat3 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_59inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_58inverse[] = "Return inverse matrix.";
static PyObject *__pyx_pw_7cgtypes_4mat3_59inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inverse (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_58inverse(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_58inverse(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  double __pyx_v_d;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inverse", 0);

  /* "cgtypes.pyx":2279
 *         cdef double d
 * 
 *         d = self.determinant()             # <<<<<<<<<<<<<<
 *         if fabs(d)<=eps:
 *             raise ZeroDivisionError, "matrix is not invertible"
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_determinant); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d = __pyx_t_4;

  /* "cgtypes.pyx":2280
 * 
 *         d = self.determinant()
 *         if fabs(d)<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError, "matrix is not invertible"
 * 
 */
  __pyx_t_5 = ((fabs(__pyx_v_d) <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_5) {

    /* "cgtypes.pyx":2281
 *         d = self.determinant()
 *         if fabs(d)<=eps:
 *             raise ZeroDivisionError, "matrix is not invertible"             # <<<<<<<<<<<<<<
 * 
 *         d = 1.0/d
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_matrix_is_not_invertible, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2283
 *             raise ZeroDivisionError, "matrix is not invertible"
 * 
 *         d = 1.0/d             # <<<<<<<<<<<<<<
 * 
 *         res=mat3()
 */
  if (unlikely(__pyx_v_d == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_d = (1.0 / __pyx_v_d);

  /* "cgtypes.pyx":2285
 *         d = 1.0/d
 * 
 *         res=mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = d*(self.m22*self.m33-self.m23*self.m32)
 *         res.m12 = d*(self.m32*self.m13-self.m12*self.m33)
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2286
 * 
 *         res=mat3()
 *         res.m11 = d*(self.m22*self.m33-self.m23*self.m32)             # <<<<<<<<<<<<<<
 *         res.m12 = d*(self.m32*self.m13-self.m12*self.m33)
 *         res.m13 = d*(self.m12*self.m23-self.m22*self.m13)
 */
  __pyx_v_res->m11 = (__pyx_v_d * ((__pyx_v_self->m22 * __pyx_v_self->m33) - (__pyx_v_self->m23 * __pyx_v_self->m32)));

  /* "cgtypes.pyx":2287
 *         res=mat3()
 *         res.m11 = d*(self.m22*self.m33-self.m23*self.m32)
 *         res.m12 = d*(self.m32*self.m13-self.m12*self.m33)             # <<<<<<<<<<<<<<
 *         res.m13 = d*(self.m12*self.m23-self.m22*self.m13)
 *         res.m21 = d*(self.m23*self.m31-self.m21*self.m33)
 */
  __pyx_v_res->m12 = (__pyx_v_d * ((__pyx_v_self->m32 * __pyx_v_self->m13) - (__pyx_v_self->m12 * __pyx_v_self->m33)));

  /* "cgtypes.pyx":2288
 *         res.m11 = d*(self.m22*self.m33-self.m23*self.m32)
 *         res.m12 = d*(self.m32*self.m13-self.m12*self.m33)
 *         res.m13 = d*(self.m12*self.m23-self.m22*self.m13)             # <<<<<<<<<<<<<<
 *         res.m21 = d*(self.m23*self.m31-self.m21*self.m33)
 *         res.m22 = d*(self.m11*self.m33-self.m31*self.m13)
 */
  __pyx_v_res->m13 = (__pyx_v_d * ((__pyx_v_self->m12 * __pyx_v_self->m23) - (__pyx_v_self->m22 * __pyx_v_self->m13)));

  /* "cgtypes.pyx":2289
 *         res.m12 = d*(self.m32*self.m13-self.m12*self.m33)
 *         res.m13 = d*(self.m12*self.m23-self.m22*self.m13)
 *         res.m21 = d*(self.m23*self.m31-self.m21*self.m33)             # <<<<<<<<<<<<<<
 *         res.m22 = d*(self.m11*self.m33-self.m31*self.m13)
 *         res.m23 = d*(self.m21*self.m13-self.m11*self.m23)
 */
  __pyx_v_res->m21 = (__pyx_v_d * ((__pyx_v_self->m23 * __pyx_v_self->m31) - (__pyx_v_self->m21 * __pyx_v_self->m33)));

  /* "cgtypes.pyx":2290
 *         res.m13 = d*(self.m12*self.m23-self.m22*self.m13)
 *         res.m21 = d*(self.m23*self.m31-self.m21*self.m33)
 *         res.m22 = d*(self.m11*self.m33-self.m31*self.m13)             # <<<<<<<<<<<<<<
 *         res.m23 = d*(self.m21*self.m13-self.m11*self.m23)
 *         res.m31 = d*(self.m21*self.m32-self.m31*self.m22)
 */
  __pyx_v_res->m22 = (__pyx_v_d * ((__pyx_v_self->m11 * __pyx_v_self->m33) - (__pyx_v_self->m31 * __pyx_v_self->m13)));

  /* "cgtypes.pyx":2291
 *         res.m21 = d*(self.m23*self.m31-self.m21*self.m33)
 *         res.m22 = d*(self.m11*self.m33-self.m31*self.m13)
 *         res.m23 = d*(self.m21*self.m13-self.m11*self.m23)             # <<<<<<<<<<<<<<
 *         res.m31 = d*(self.m21*self.m32-self.m31*self.m22)
 *         res.m32 = d*(self.m31*self.m12-self.m11*self.m32)
 */
  __pyx_v_res->m23 = (__pyx_v_d * ((__pyx_v_self->m21 * __pyx_v_self->m13) - (__pyx_v_self->m11 * __pyx_v_self->m23)));

  /* "cgtypes.pyx":2292
 *         res.m22 = d*(self.m11*self.m33-self.m31*self.m13)
 *         res.m23 = d*(self.m21*self.m13-self.m11*self.m23)
 *         res.m31 = d*(self.m21*self.m32-self.m31*self.m22)             # <<<<<<<<<<<<<<
 *         res.m32 = d*(self.m31*self.m12-self.m11*self.m32)
 *         res.m33 = d*(self.m11*self.m22-self.m12*self.m21)
 */
  __pyx_v_res->m31 = (__pyx_v_d * ((__pyx_v_self->m21 * __pyx_v_self->m32) - (__pyx_v_self->m31 * __pyx_v_self->m22)));

  /* "cgtypes.pyx":2293
 *         res.m23 = d*(self.m21*self.m13-self.m11*self.m23)
 *         res.m31 = d*(self.m21*self.m32-self.m31*self.m22)
 *         res.m32 = d*(self.m31*self.m12-self.m11*self.m32)             # <<<<<<<<<<<<<<
 *         res.m33 = d*(self.m11*self.m22-self.m12*self.m21)
 *         return res
 */
  __pyx_v_res->m32 = (__pyx_v_d * ((__pyx_v_self->m31 * __pyx_v_self->m12) - (__pyx_v_self->m11 * __pyx_v_self->m32)));

  /* "cgtypes.pyx":2294
 *         res.m31 = d*(self.m21*self.m32-self.m31*self.m22)
 *         res.m32 = d*(self.m31*self.m12-self.m11*self.m32)
 *         res.m33 = d*(self.m11*self.m22-self.m12*self.m21)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = (__pyx_v_d * ((__pyx_v_self->m11 * __pyx_v_self->m22) - (__pyx_v_self->m12 * __pyx_v_self->m21)));

  /* "cgtypes.pyx":2295
 *         res.m32 = d*(self.m31*self.m12-self.m11*self.m32)
 *         res.m33 = d*(self.m11*self.m22-self.m12*self.m21)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def scaling(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2274
 *                self.m33*self.m21*self.m12
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse matrix."""
 *         cdef mat3 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.mat3.inverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2297
 *         return res
 * 
 *     def scaling(self, s):             # <<<<<<<<<<<<<<
 *         """Return scaling matrix."""
 *         cdef mat3 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_61scaling(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_60scaling[] = "Return scaling matrix.";
static PyObject *__pyx_pw_7cgtypes_4mat3_61scaling(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scaling (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_60scaling(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_60scaling(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_s) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("scaling", 0);

  /* "cgtypes.pyx":2300
 *         """Return scaling matrix."""
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = s[0]
 *         res.m12 = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2301
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = s[0]             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":2302
 *         res = mat3()
 *         res.m11 = s[0]
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m21 = 0.0
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":2303
 *         res.m11 = s[0]
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = s[1]
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":2304
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = s[1]
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":2305
 *         res.m13 = 0.0
 *         res.m21 = 0.0
 *         res.m22 = s[1]             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m31 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":2306
 *         res.m21 = 0.0
 *         res.m22 = s[1]
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":2307
 *         res.m22 = s[1]
 *         res.m23 = 0.0
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = s[2]
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":2308
 *         res.m23 = 0.0
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = s[2]
 *         return res
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":2309
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = s[2]             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":2310
 *         res.m32 = 0.0
 *         res.m33 = s[2]
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def rotation(self, angle, axis):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2297
 *         return res
 * 
 *     def scaling(self, s):             # <<<<<<<<<<<<<<
 *         """Return scaling matrix."""
 *         cdef mat3 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.scaling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2312
 *         return res
 * 
 *     def rotation(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_63rotation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_62rotation[] = "Return rotation matrix.\n\n        angle must be given in radians. axis must be a 3-sequence.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_63rotation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_axis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rotation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle,&__pyx_n_s_axis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_angle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rotation", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_angle = values[0];
    __pyx_v_axis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rotation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2312; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_62rotation(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_angle, __pyx_v_axis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_62rotation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis) {
  double __pyx_v_cangle;
  double __pyx_v_ax;
  double __pyx_v_ay;
  double __pyx_v_az;
  double __pyx_v_sqr_a;
  double __pyx_v_sqr_b;
  double __pyx_v_sqr_c;
  double __pyx_v_len2;
  double __pyx_v_k1;
  double __pyx_v_k2;
  double __pyx_v_k3;
  double __pyx_v_k1ab;
  double __pyx_v_k1ac;
  double __pyx_v_k1bc;
  double __pyx_v_k3a;
  double __pyx_v_k3b;
  double __pyx_v_k3c;
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rotation", 0);

  /* "cgtypes.pyx":2322
 *         cdef mat3 res
 * 
 *         cangle   = angle             # <<<<<<<<<<<<<<
 *         ax    = axis[0]
 *         ay    = axis[1]
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_angle); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cangle = __pyx_t_1;

  /* "cgtypes.pyx":2323
 * 
 *         cangle   = angle
 *         ax    = axis[0]             # <<<<<<<<<<<<<<
 *         ay    = axis[1]
 *         az    = axis[2]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ax = __pyx_t_1;

  /* "cgtypes.pyx":2324
 *         cangle   = angle
 *         ax    = axis[0]
 *         ay    = axis[1]             # <<<<<<<<<<<<<<
 *         az    = axis[2]
 *         sqr_a = ax*ax
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ay = __pyx_t_1;

  /* "cgtypes.pyx":2325
 *         ax    = axis[0]
 *         ay    = axis[1]
 *         az    = axis[2]             # <<<<<<<<<<<<<<
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_az = __pyx_t_1;

  /* "cgtypes.pyx":2326
 *         ay    = axis[1]
 *         az    = axis[2]
 *         sqr_a = ax*ax             # <<<<<<<<<<<<<<
 *         sqr_b = ay*ay
 *         sqr_c = az*az
 */
  __pyx_v_sqr_a = (__pyx_v_ax * __pyx_v_ax);

  /* "cgtypes.pyx":2327
 *         az    = axis[2]
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay             # <<<<<<<<<<<<<<
 *         sqr_c = az*az
 *         len2  = sqr_a+sqr_b+sqr_c
 */
  __pyx_v_sqr_b = (__pyx_v_ay * __pyx_v_ay);

  /* "cgtypes.pyx":2328
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay
 *         sqr_c = az*az             # <<<<<<<<<<<<<<
 *         len2  = sqr_a+sqr_b+sqr_c
 * 
 */
  __pyx_v_sqr_c = (__pyx_v_az * __pyx_v_az);

  /* "cgtypes.pyx":2329
 *         sqr_b = ay*ay
 *         sqr_c = az*az
 *         len2  = sqr_a+sqr_b+sqr_c             # <<<<<<<<<<<<<<
 * 
 *         k2    = cos(cangle)
 */
  __pyx_v_len2 = ((__pyx_v_sqr_a + __pyx_v_sqr_b) + __pyx_v_sqr_c);

  /* "cgtypes.pyx":2331
 *         len2  = sqr_a+sqr_b+sqr_c
 * 
 *         k2    = cos(cangle)             # <<<<<<<<<<<<<<
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)
 */
  __pyx_v_k2 = cos(__pyx_v_cangle);

  /* "cgtypes.pyx":2332
 * 
 *         k2    = cos(cangle)
 *         k1    = (1.0-k2)/len2             # <<<<<<<<<<<<<<
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay
 */
  __pyx_t_1 = (1.0 - __pyx_v_k2);
  if (unlikely(__pyx_v_len2 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_k1 = (__pyx_t_1 / __pyx_v_len2);

  /* "cgtypes.pyx":2333
 *         k2    = cos(cangle)
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)             # <<<<<<<<<<<<<<
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az
 */
  __pyx_t_1 = sin(__pyx_v_cangle);
  __pyx_t_3 = sqrt(__pyx_v_len2);
  if (unlikely(__pyx_t_3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_k3 = (__pyx_t_1 / __pyx_t_3);

  /* "cgtypes.pyx":2334
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay             # <<<<<<<<<<<<<<
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az
 */
  __pyx_v_k1ab = ((__pyx_v_k1 * __pyx_v_ax) * __pyx_v_ay);

  /* "cgtypes.pyx":2335
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az             # <<<<<<<<<<<<<<
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax
 */
  __pyx_v_k1ac = ((__pyx_v_k1 * __pyx_v_ax) * __pyx_v_az);

  /* "cgtypes.pyx":2336
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az             # <<<<<<<<<<<<<<
 *         k3a   = k3*ax
 *         k3b   = k3*ay
 */
  __pyx_v_k1bc = ((__pyx_v_k1 * __pyx_v_ay) * __pyx_v_az);

  /* "cgtypes.pyx":2337
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax             # <<<<<<<<<<<<<<
 *         k3b   = k3*ay
 *         k3c   = k3*az
 */
  __pyx_v_k3a = (__pyx_v_k3 * __pyx_v_ax);

  /* "cgtypes.pyx":2338
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax
 *         k3b   = k3*ay             # <<<<<<<<<<<<<<
 *         k3c   = k3*az
 * 
 */
  __pyx_v_k3b = (__pyx_v_k3 * __pyx_v_ay);

  /* "cgtypes.pyx":2339
 *         k3a   = k3*ax
 *         k3b   = k3*ay
 *         k3c   = k3*az             # <<<<<<<<<<<<<<
 * 
 *         res = mat3()
 */
  __pyx_v_k3c = (__pyx_v_k3 * __pyx_v_az);

  /* "cgtypes.pyx":2341
 *         k3c   = k3*az
 * 
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":2342
 * 
 *         res = mat3()
 *         res.m11 = k1*sqr_a+k2             # <<<<<<<<<<<<<<
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b
 */
  __pyx_v_res->m11 = ((__pyx_v_k1 * __pyx_v_sqr_a) + __pyx_v_k2);

  /* "cgtypes.pyx":2343
 *         res = mat3()
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c             # <<<<<<<<<<<<<<
 *         res.m13 = k1ac+k3b
 *         res.m21 = k1ab+k3c
 */
  __pyx_v_res->m12 = (__pyx_v_k1ab - __pyx_v_k3c);

  /* "cgtypes.pyx":2344
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b             # <<<<<<<<<<<<<<
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2
 */
  __pyx_v_res->m13 = (__pyx_v_k1ac + __pyx_v_k3b);

  /* "cgtypes.pyx":2345
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b
 *         res.m21 = k1ab+k3c             # <<<<<<<<<<<<<<
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a
 */
  __pyx_v_res->m21 = (__pyx_v_k1ab + __pyx_v_k3c);

  /* "cgtypes.pyx":2346
 *         res.m13 = k1ac+k3b
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2             # <<<<<<<<<<<<<<
 *         res.m23 = k1bc-k3a
 *         res.m31 = k1ac-k3b
 */
  __pyx_v_res->m22 = ((__pyx_v_k1 * __pyx_v_sqr_b) + __pyx_v_k2);

  /* "cgtypes.pyx":2347
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a             # <<<<<<<<<<<<<<
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a
 */
  __pyx_v_res->m23 = (__pyx_v_k1bc - __pyx_v_k3a);

  /* "cgtypes.pyx":2348
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a
 *         res.m31 = k1ac-k3b             # <<<<<<<<<<<<<<
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2
 */
  __pyx_v_res->m31 = (__pyx_v_k1ac - __pyx_v_k3b);

  /* "cgtypes.pyx":2349
 *         res.m23 = k1bc-k3a
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a             # <<<<<<<<<<<<<<
 *         res.m33 = k1*sqr_c+k2
 *         return res
 */
  __pyx_v_res->m32 = (__pyx_v_k1bc + __pyx_v_k3a);

  /* "cgtypes.pyx":2350
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m33 = ((__pyx_v_k1 * __pyx_v_sqr_c) + __pyx_v_k2);

  /* "cgtypes.pyx":2351
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2312
 *         return res
 * 
 *     def rotation(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat3.rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2354
 * 
 * 
 *     def scale(self, s):             # <<<<<<<<<<<<<<
 *         """Concatenate a scaling."""
 *         cdef double sx, sy, sz
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_65scale(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_64scale[] = "Concatenate a scaling.";
static PyObject *__pyx_pw_7cgtypes_4mat3_65scale(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_64scale(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_64scale(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_s) {
  double __pyx_v_sx;
  double __pyx_v_sy;
  double __pyx_v_sz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("scale", 0);

  /* "cgtypes.pyx":2357
 *         """Concatenate a scaling."""
 *         cdef double sx, sy, sz
 *         sx = s[0]             # <<<<<<<<<<<<<<
 *         sy = s[1]
 *         sz = s[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sx = __pyx_t_2;

  /* "cgtypes.pyx":2358
 *         cdef double sx, sy, sz
 *         sx = s[0]
 *         sy = s[1]             # <<<<<<<<<<<<<<
 *         sz = s[2]
 *         self.m11 = self.m11*sx
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sy = __pyx_t_2;

  /* "cgtypes.pyx":2359
 *         sx = s[0]
 *         sy = s[1]
 *         sz = s[2]             # <<<<<<<<<<<<<<
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sz = __pyx_t_2;

  /* "cgtypes.pyx":2360
 *         sy = s[1]
 *         sz = s[2]
 *         self.m11 = self.m11*sx             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 * __pyx_v_sx);

  /* "cgtypes.pyx":2361
 *         sz = s[2]
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 * __pyx_v_sy);

  /* "cgtypes.pyx":2362
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 * __pyx_v_sz);

  /* "cgtypes.pyx":2363
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 * __pyx_v_sx);

  /* "cgtypes.pyx":2364
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 * __pyx_v_sy);

  /* "cgtypes.pyx":2365
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 * __pyx_v_sz);

  /* "cgtypes.pyx":2366
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 * __pyx_v_sx);

  /* "cgtypes.pyx":2367
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33*sz
 *         return self
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 * __pyx_v_sy);

  /* "cgtypes.pyx":2368
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 * __pyx_v_sz);

  /* "cgtypes.pyx":2369
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def rotate(self, angle, axis):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":2354
 * 
 * 
 *     def scale(self, s):             # <<<<<<<<<<<<<<
 *         """Concatenate a scaling."""
 *         cdef double sx, sy, sz
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat3.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2371
 *         return self
 * 
 *     def rotate(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Concatenate a rotation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_67rotate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_66rotate[] = "Concatenate a rotation.\n\n        angle must be given in radians. axis must be a 3-sequence.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_67rotate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_axis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rotate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle,&__pyx_n_s_axis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_angle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rotate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_angle = values[0];
    __pyx_v_axis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rotate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2371; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat3.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat3_66rotate(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self), __pyx_v_angle, __pyx_v_axis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_66rotate(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_R = 0;
  double __pyx_v_c1;
  double __pyx_v_c2;
  double __pyx_v_c3;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rotate", 0);

  /* "cgtypes.pyx":2378
 *         cdef mat3 R
 *         cdef double c1, c2, c3
 *         R=self.rotation(angle, axis)             # <<<<<<<<<<<<<<
 * 
 *         # self*R  (in-place)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rotation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_angle);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_angle);
  __Pyx_GIVEREF(__pyx_v_angle);
  __Pyx_INCREF(__pyx_v_axis);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_axis);
  __Pyx_GIVEREF(__pyx_v_axis);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_R = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2381
 * 
 *         # self*R  (in-place)
 *         c1 = self.m11             # <<<<<<<<<<<<<<
 *         c2 = self.m12
 *         c3 = self.m13
 */
  __pyx_t_6 = __pyx_v_self->m11;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":2382
 *         # self*R  (in-place)
 *         c1 = self.m11
 *         c2 = self.m12             # <<<<<<<<<<<<<<
 *         c3 = self.m13
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31
 */
  __pyx_t_6 = __pyx_v_self->m12;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":2383
 *         c1 = self.m11
 *         c2 = self.m12
 *         c3 = self.m13             # <<<<<<<<<<<<<<
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32
 */
  __pyx_t_6 = __pyx_v_self->m13;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":2384
 *         c2 = self.m12
 *         c3 = self.m13
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31             # <<<<<<<<<<<<<<
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33
 */
  __pyx_v_self->m11 = (((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31));

  /* "cgtypes.pyx":2385
 *         c3 = self.m13
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32             # <<<<<<<<<<<<<<
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 */
  __pyx_v_self->m12 = (((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32));

  /* "cgtypes.pyx":2386
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33             # <<<<<<<<<<<<<<
 * 
 *         c1 = self.m21
 */
  __pyx_v_self->m13 = (((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33));

  /* "cgtypes.pyx":2388
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 *         c1 = self.m21             # <<<<<<<<<<<<<<
 *         c2 = self.m22
 *         c3 = self.m23
 */
  __pyx_t_6 = __pyx_v_self->m21;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":2389
 * 
 *         c1 = self.m21
 *         c2 = self.m22             # <<<<<<<<<<<<<<
 *         c3 = self.m23
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31
 */
  __pyx_t_6 = __pyx_v_self->m22;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":2390
 *         c1 = self.m21
 *         c2 = self.m22
 *         c3 = self.m23             # <<<<<<<<<<<<<<
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32
 */
  __pyx_t_6 = __pyx_v_self->m23;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":2391
 *         c2 = self.m22
 *         c3 = self.m23
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31             # <<<<<<<<<<<<<<
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33
 */
  __pyx_v_self->m21 = (((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31));

  /* "cgtypes.pyx":2392
 *         c3 = self.m23
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32             # <<<<<<<<<<<<<<
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 */
  __pyx_v_self->m22 = (((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32));

  /* "cgtypes.pyx":2393
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33             # <<<<<<<<<<<<<<
 * 
 *         c1 = self.m31
 */
  __pyx_v_self->m23 = (((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33));

  /* "cgtypes.pyx":2395
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 *         c1 = self.m31             # <<<<<<<<<<<<<<
 *         c2 = self.m32
 *         c3 = self.m33
 */
  __pyx_t_6 = __pyx_v_self->m31;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":2396
 * 
 *         c1 = self.m31
 *         c2 = self.m32             # <<<<<<<<<<<<<<
 *         c3 = self.m33
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31
 */
  __pyx_t_6 = __pyx_v_self->m32;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":2397
 *         c1 = self.m31
 *         c2 = self.m32
 *         c3 = self.m33             # <<<<<<<<<<<<<<
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32
 */
  __pyx_t_6 = __pyx_v_self->m33;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":2398
 *         c2 = self.m32
 *         c3 = self.m33
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31             # <<<<<<<<<<<<<<
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33
 */
  __pyx_v_self->m31 = (((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31));

  /* "cgtypes.pyx":2399
 *         c3 = self.m33
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32             # <<<<<<<<<<<<<<
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 */
  __pyx_v_self->m32 = (((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32));

  /* "cgtypes.pyx":2400
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33             # <<<<<<<<<<<<<<
 * 
 *         return self
 */
  __pyx_v_self->m33 = (((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33));

  /* "cgtypes.pyx":2402
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33
 * 
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def ortho(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":2371
 *         return self
 * 
 *     def rotate(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Concatenate a rotation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat3.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_R);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2404
 *         return self
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Return a matrix with orthogonal base vectors.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_69ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_68ortho[] = "Return a matrix with orthogonal base vectors.\n\n        Makes the x-, y- and z-axis orthogonal.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_69ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_68ortho(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_68ortho(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_x = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_y = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_z = 0;
  PyObject *__pyx_v_xl = NULL;
  PyObject *__pyx_v_yl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ortho", 0);

  /* "cgtypes.pyx":2412
 *         cdef vec3 x,y,z
 * 
 *         x = vec3(self.m11, self.m21, self.m31)             # <<<<<<<<<<<<<<
 *         y = vec3(self.m12, self.m22, self.m32)
 *         z = vec3(self.m13, self.m23, self.m33)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_x = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2413
 * 
 *         x = vec3(self.m11, self.m21, self.m31)
 *         y = vec3(self.m12, self.m22, self.m32)             # <<<<<<<<<<<<<<
 *         z = vec3(self.m13, self.m23, self.m33)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_y = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":2414
 *         x = vec3(self.m11, self.m21, self.m31)
 *         y = vec3(self.m12, self.m22, self.m32)
 *         z = vec3(self.m13, self.m23, self.m33)             # <<<<<<<<<<<<<<
 * 
 *         xl = x.length()
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_z = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2416
 *         z = vec3(self.m13, self.m23, self.m33)
 * 
 *         xl = x.length()             # <<<<<<<<<<<<<<
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_xl = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2417
 * 
 *         xl = x.length()
 *         xl = xl*xl             # <<<<<<<<<<<<<<
 *         y = y - ((x*y)/xl)*x
 *         z = z - ((x*z)/xl)*x
 */
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_xl, __pyx_v_xl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_xl, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2418
 *         xl = x.length()
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x             # <<<<<<<<<<<<<<
 *         z = z - ((x*z)/xl)*x
 * 
 */
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_xl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_y, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2419
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x
 *         z = z - ((x*z)/xl)*x             # <<<<<<<<<<<<<<
 * 
 *         yl = y.length()
 */
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_z)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_xl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_z), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2421
 *         z = z - ((x*z)/xl)*x
 * 
 *         yl = y.length()             # <<<<<<<<<<<<<<
 *         yl = yl*yl
 *         z = z - ((y*z)/yl)*y
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_yl = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2422
 * 
 *         yl = y.length()
 *         yl = yl*yl             # <<<<<<<<<<<<<<
 *         z = z - ((y*z)/yl)*y
 * 
 */
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_yl, __pyx_v_yl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_yl, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":2423
 *         yl = y.length()
 *         yl = yl*yl
 *         z = z - ((y*z)/yl)*y             # <<<<<<<<<<<<<<
 * 
 *         res = mat3()
 */
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_z)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_yl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_y)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_z), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2425
 *         z = z - ((y*z)/yl)*y
 * 
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = x.x
 *         res.m12 = y.x
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2426
 * 
 *         res = mat3()
 *         res.m11 = x.x             # <<<<<<<<<<<<<<
 *         res.m12 = y.x
 *         res.m13 = z.x
 */
  __pyx_t_5 = __pyx_v_x->x;
  __pyx_v_res->m11 = __pyx_t_5;

  /* "cgtypes.pyx":2427
 *         res = mat3()
 *         res.m11 = x.x
 *         res.m12 = y.x             # <<<<<<<<<<<<<<
 *         res.m13 = z.x
 *         res.m21 = x.y
 */
  __pyx_t_5 = __pyx_v_y->x;
  __pyx_v_res->m12 = __pyx_t_5;

  /* "cgtypes.pyx":2428
 *         res.m11 = x.x
 *         res.m12 = y.x
 *         res.m13 = z.x             # <<<<<<<<<<<<<<
 *         res.m21 = x.y
 *         res.m22 = y.y
 */
  __pyx_t_5 = __pyx_v_z->x;
  __pyx_v_res->m13 = __pyx_t_5;

  /* "cgtypes.pyx":2429
 *         res.m12 = y.x
 *         res.m13 = z.x
 *         res.m21 = x.y             # <<<<<<<<<<<<<<
 *         res.m22 = y.y
 *         res.m23 = z.y
 */
  __pyx_t_5 = __pyx_v_x->y;
  __pyx_v_res->m21 = __pyx_t_5;

  /* "cgtypes.pyx":2430
 *         res.m13 = z.x
 *         res.m21 = x.y
 *         res.m22 = y.y             # <<<<<<<<<<<<<<
 *         res.m23 = z.y
 *         res.m31 = x.z
 */
  __pyx_t_5 = __pyx_v_y->y;
  __pyx_v_res->m22 = __pyx_t_5;

  /* "cgtypes.pyx":2431
 *         res.m21 = x.y
 *         res.m22 = y.y
 *         res.m23 = z.y             # <<<<<<<<<<<<<<
 *         res.m31 = x.z
 *         res.m32 = y.z
 */
  __pyx_t_5 = __pyx_v_z->y;
  __pyx_v_res->m23 = __pyx_t_5;

  /* "cgtypes.pyx":2432
 *         res.m22 = y.y
 *         res.m23 = z.y
 *         res.m31 = x.z             # <<<<<<<<<<<<<<
 *         res.m32 = y.z
 *         res.m33 = z.z
 */
  __pyx_t_5 = __pyx_v_x->z;
  __pyx_v_res->m31 = __pyx_t_5;

  /* "cgtypes.pyx":2433
 *         res.m23 = z.y
 *         res.m31 = x.z
 *         res.m32 = y.z             # <<<<<<<<<<<<<<
 *         res.m33 = z.z
 *         return res
 */
  __pyx_t_5 = __pyx_v_y->z;
  __pyx_v_res->m32 = __pyx_t_5;

  /* "cgtypes.pyx":2434
 *         res.m31 = x.z
 *         res.m32 = y.z
 *         res.m33 = z.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_5 = __pyx_v_z->z;
  __pyx_v_res->m33 = __pyx_t_5;

  /* "cgtypes.pyx":2435
 *         res.m32 = y.z
 *         res.m33 = z.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def decompose(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2404
 *         return self
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Return a matrix with orthogonal base vectors.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.mat3.ortho", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_xl);
  __Pyx_XDECREF(__pyx_v_yl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2437
 *         return res
 * 
 *     def decompose(self):             # <<<<<<<<<<<<<<
 *         """Decomposes the matrix into a rotation and scaling part.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat3_71decompose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat3_70decompose[] = "Decomposes the matrix into a rotation and scaling part.\n\n        Returns a tuple (rotation, scaling). The scaling part is given\n        as a vec3, the rotation is still a mat3.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat3_71decompose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decompose (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat3_70decompose(((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat3_70decompose(struct __pyx_obj_7cgtypes_mat3 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_m = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_c = 0;
  double __pyx_v_al;
  double __pyx_v_bl;
  double __pyx_v_cl;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_scale = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decompose", 0);

  /* "cgtypes.pyx":2447
 *         cdef double al, bl, cl
 * 
 *         m = self.ortho()             # <<<<<<<<<<<<<<
 * 
 *         # a,b,c = Column 0,1,2 of m
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ortho); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_mat3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_m = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2450
 * 
 *         # a,b,c = Column 0,1,2 of m
 *         a = vec3()             # <<<<<<<<<<<<<<
 *         b = vec3()
 *         c = vec3()
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_a = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2451
 *         # a,b,c = Column 0,1,2 of m
 *         a = vec3()
 *         b = vec3()             # <<<<<<<<<<<<<<
 *         c = vec3()
 *         a.x = m.m11
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_b = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2452
 *         a = vec3()
 *         b = vec3()
 *         c = vec3()             # <<<<<<<<<<<<<<
 *         a.x = m.m11
 *         a.y = m.m21
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2453
 *         b = vec3()
 *         c = vec3()
 *         a.x = m.m11             # <<<<<<<<<<<<<<
 *         a.y = m.m21
 *         a.z = m.m31
 */
  __pyx_t_4 = __pyx_v_m->m11;
  __pyx_v_a->x = __pyx_t_4;

  /* "cgtypes.pyx":2454
 *         c = vec3()
 *         a.x = m.m11
 *         a.y = m.m21             # <<<<<<<<<<<<<<
 *         a.z = m.m31
 *         b.x = m.m12
 */
  __pyx_t_4 = __pyx_v_m->m21;
  __pyx_v_a->y = __pyx_t_4;

  /* "cgtypes.pyx":2455
 *         a.x = m.m11
 *         a.y = m.m21
 *         a.z = m.m31             # <<<<<<<<<<<<<<
 *         b.x = m.m12
 *         b.y = m.m22
 */
  __pyx_t_4 = __pyx_v_m->m31;
  __pyx_v_a->z = __pyx_t_4;

  /* "cgtypes.pyx":2456
 *         a.y = m.m21
 *         a.z = m.m31
 *         b.x = m.m12             # <<<<<<<<<<<<<<
 *         b.y = m.m22
 *         b.z = m.m32
 */
  __pyx_t_4 = __pyx_v_m->m12;
  __pyx_v_b->x = __pyx_t_4;

  /* "cgtypes.pyx":2457
 *         a.z = m.m31
 *         b.x = m.m12
 *         b.y = m.m22             # <<<<<<<<<<<<<<
 *         b.z = m.m32
 *         c.x = m.m13
 */
  __pyx_t_4 = __pyx_v_m->m22;
  __pyx_v_b->y = __pyx_t_4;

  /* "cgtypes.pyx":2458
 *         b.x = m.m12
 *         b.y = m.m22
 *         b.z = m.m32             # <<<<<<<<<<<<<<
 *         c.x = m.m13
 *         c.y = m.m23
 */
  __pyx_t_4 = __pyx_v_m->m32;
  __pyx_v_b->z = __pyx_t_4;

  /* "cgtypes.pyx":2459
 *         b.y = m.m22
 *         b.z = m.m32
 *         c.x = m.m13             # <<<<<<<<<<<<<<
 *         c.y = m.m23
 *         c.z = m.m33
 */
  __pyx_t_4 = __pyx_v_m->m13;
  __pyx_v_c->x = __pyx_t_4;

  /* "cgtypes.pyx":2460
 *         b.z = m.m32
 *         c.x = m.m13
 *         c.y = m.m23             # <<<<<<<<<<<<<<
 *         c.z = m.m33
 * 
 */
  __pyx_t_4 = __pyx_v_m->m23;
  __pyx_v_c->y = __pyx_t_4;

  /* "cgtypes.pyx":2461
 *         c.x = m.m13
 *         c.y = m.m23
 *         c.z = m.m33             # <<<<<<<<<<<<<<
 * 
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 */
  __pyx_t_4 = __pyx_v_m->m33;
  __pyx_v_c->z = __pyx_t_4;

  /* "cgtypes.pyx":2464
 * 
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)             # <<<<<<<<<<<<<<
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 */
  __pyx_v_al = sqrt((((__pyx_v_a->x * __pyx_v_a->x) + (__pyx_v_a->y * __pyx_v_a->y)) + (__pyx_v_a->z * __pyx_v_a->z)));

  /* "cgtypes.pyx":2465
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)             # <<<<<<<<<<<<<<
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:
 */
  __pyx_v_bl = sqrt((((__pyx_v_b->x * __pyx_v_b->x) + (__pyx_v_b->y * __pyx_v_b->y)) + (__pyx_v_b->z * __pyx_v_b->z)));

  /* "cgtypes.pyx":2466
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)             # <<<<<<<<<<<<<<
 *         if al<=eps or bl<=eps or cl<=eps:
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 */
  __pyx_v_cl = sqrt((((__pyx_v_c->x * __pyx_v_c->x) + (__pyx_v_c->y * __pyx_v_c->y)) + (__pyx_v_c->z * __pyx_v_c->z)));

  /* "cgtypes.pyx":2467
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 * 
 */
  __pyx_t_6 = ((__pyx_v_al <= __pyx_v_7cgtypes_eps) != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = ((__pyx_v_bl <= __pyx_v_7cgtypes_eps) != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = ((__pyx_v_cl <= __pyx_v_7cgtypes_eps) != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "cgtypes.pyx":2468
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"             # <<<<<<<<<<<<<<
 * 
 *         scale = vec3(al,bl,cl)
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_transformation_contains_a_0_scal, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":2470
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 * 
 *         scale = vec3(al,bl,cl)             # <<<<<<<<<<<<<<
 * 
 *         # normalizing a,b,c
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_al); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_bl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_scale = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2476
 * #        b/=bl
 * #        c/=cl
 *         a.x = a.x/al             # <<<<<<<<<<<<<<
 *         a.y = a.y/al
 *         a.z = a.z/al
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->x = (__pyx_v_a->x / __pyx_v_al);

  /* "cgtypes.pyx":2477
 * #        c/=cl
 *         a.x = a.x/al
 *         a.y = a.y/al             # <<<<<<<<<<<<<<
 *         a.z = a.z/al
 *         b.x = b.x/bl
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->y = (__pyx_v_a->y / __pyx_v_al);

  /* "cgtypes.pyx":2478
 *         a.x = a.x/al
 *         a.y = a.y/al
 *         a.z = a.z/al             # <<<<<<<<<<<<<<
 *         b.x = b.x/bl
 *         b.y = b.y/bl
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->z = (__pyx_v_a->z / __pyx_v_al);

  /* "cgtypes.pyx":2479
 *         a.y = a.y/al
 *         a.z = a.z/al
 *         b.x = b.x/bl             # <<<<<<<<<<<<<<
 *         b.y = b.y/bl
 *         b.z = b.z/bl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->x = (__pyx_v_b->x / __pyx_v_bl);

  /* "cgtypes.pyx":2480
 *         a.z = a.z/al
 *         b.x = b.x/bl
 *         b.y = b.y/bl             # <<<<<<<<<<<<<<
 *         b.z = b.z/bl
 *         c.x = c.x/cl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->y = (__pyx_v_b->y / __pyx_v_bl);

  /* "cgtypes.pyx":2481
 *         b.x = b.x/bl
 *         b.y = b.y/bl
 *         b.z = b.z/bl             # <<<<<<<<<<<<<<
 *         c.x = c.x/cl
 *         c.y = c.y/cl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->z = (__pyx_v_b->z / __pyx_v_bl);

  /* "cgtypes.pyx":2482
 *         b.y = b.y/bl
 *         b.z = b.z/bl
 *         c.x = c.x/cl             # <<<<<<<<<<<<<<
 *         c.y = c.y/cl
 *         c.z = c.z/cl
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->x = (__pyx_v_c->x / __pyx_v_cl);

  /* "cgtypes.pyx":2483
 *         b.z = b.z/bl
 *         c.x = c.x/cl
 *         c.y = c.y/cl             # <<<<<<<<<<<<<<
 *         c.z = c.z/cl
 * 
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->y = (__pyx_v_c->y / __pyx_v_cl);

  /* "cgtypes.pyx":2484
 *         c.x = c.x/cl
 *         c.y = c.y/cl
 *         c.z = c.z/cl             # <<<<<<<<<<<<<<
 * 
 *         m.m11 = a.x
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->z = (__pyx_v_c->z / __pyx_v_cl);

  /* "cgtypes.pyx":2486
 *         c.z = c.z/cl
 * 
 *         m.m11 = a.x             # <<<<<<<<<<<<<<
 *         m.m21 = a.y
 *         m.m31 = a.z
 */
  __pyx_t_4 = __pyx_v_a->x;
  __pyx_v_m->m11 = __pyx_t_4;

  /* "cgtypes.pyx":2487
 * 
 *         m.m11 = a.x
 *         m.m21 = a.y             # <<<<<<<<<<<<<<
 *         m.m31 = a.z
 *         m.m12 = b.x
 */
  __pyx_t_4 = __pyx_v_a->y;
  __pyx_v_m->m21 = __pyx_t_4;

  /* "cgtypes.pyx":2488
 *         m.m11 = a.x
 *         m.m21 = a.y
 *         m.m31 = a.z             # <<<<<<<<<<<<<<
 *         m.m12 = b.x
 *         m.m22 = b.y
 */
  __pyx_t_4 = __pyx_v_a->z;
  __pyx_v_m->m31 = __pyx_t_4;

  /* "cgtypes.pyx":2489
 *         m.m21 = a.y
 *         m.m31 = a.z
 *         m.m12 = b.x             # <<<<<<<<<<<<<<
 *         m.m22 = b.y
 *         m.m32 = b.z
 */
  __pyx_t_4 = __pyx_v_b->x;
  __pyx_v_m->m12 = __pyx_t_4;

  /* "cgtypes.pyx":2490
 *         m.m31 = a.z
 *         m.m12 = b.x
 *         m.m22 = b.y             # <<<<<<<<<<<<<<
 *         m.m32 = b.z
 *         m.m13 = c.x
 */
  __pyx_t_4 = __pyx_v_b->y;
  __pyx_v_m->m22 = __pyx_t_4;

  /* "cgtypes.pyx":2491
 *         m.m12 = b.x
 *         m.m22 = b.y
 *         m.m32 = b.z             # <<<<<<<<<<<<<<
 *         m.m13 = c.x
 *         m.m23 = c.y
 */
  __pyx_t_4 = __pyx_v_b->z;
  __pyx_v_m->m32 = __pyx_t_4;

  /* "cgtypes.pyx":2492
 *         m.m22 = b.y
 *         m.m32 = b.z
 *         m.m13 = c.x             # <<<<<<<<<<<<<<
 *         m.m23 = c.y
 *         m.m33 = c.z
 */
  __pyx_t_4 = __pyx_v_c->x;
  __pyx_v_m->m13 = __pyx_t_4;

  /* "cgtypes.pyx":2493
 *         m.m32 = b.z
 *         m.m13 = c.x
 *         m.m23 = c.y             # <<<<<<<<<<<<<<
 *         m.m33 = c.z
 *         if m.determinant()<0.0:
 */
  __pyx_t_4 = __pyx_v_c->y;
  __pyx_v_m->m23 = __pyx_t_4;

  /* "cgtypes.pyx":2494
 *         m.m13 = c.x
 *         m.m23 = c.y
 *         m.m33 = c.z             # <<<<<<<<<<<<<<
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11
 */
  __pyx_t_4 = __pyx_v_c->z;
  __pyx_v_m->m33 = __pyx_t_4;

  /* "cgtypes.pyx":2495
 *         m.m23 = c.y
 *         m.m33 = c.z
 *         if m.determinant()<0.0:             # <<<<<<<<<<<<<<
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_determinant); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_float_0_0, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "cgtypes.pyx":2496
 *         m.m33 = c.z
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11             # <<<<<<<<<<<<<<
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31
 */
    __pyx_v_m->m11 = (-__pyx_v_m->m11);

    /* "cgtypes.pyx":2497
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21             # <<<<<<<<<<<<<<
 *             m.m31 = -m.m31
 *             scale.x = -scale.x
 */
    __pyx_v_m->m21 = (-__pyx_v_m->m21);

    /* "cgtypes.pyx":2498
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31             # <<<<<<<<<<<<<<
 *             scale.x = -scale.x
 * 
 */
    __pyx_v_m->m31 = (-__pyx_v_m->m31);

    /* "cgtypes.pyx":2499
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31
 *             scale.x = -scale.x             # <<<<<<<<<<<<<<
 * 
 *         return (m, scale)
 */
    __pyx_v_scale->x = (-__pyx_v_scale->x);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "cgtypes.pyx":2501
 *             scale.x = -scale.x
 * 
 *         return (m, scale)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_v_m));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_m));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_m));
  __Pyx_INCREF(((PyObject *)__pyx_v_scale));
  PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_v_scale));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_scale));
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2437
 *         return res
 * 
 *     def decompose(self):             # <<<<<<<<<<<<<<
 *         """Decomposes the matrix into a rotation and scaling part.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat3.decompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_m);
  __Pyx_XDECREF((PyObject *)__pyx_v_a);
  __Pyx_XDECREF((PyObject *)__pyx_v_b);
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XDECREF((PyObject *)__pyx_v_scale);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2512
 *     cdef object m
 * 
 *     def __cinit__(self, m):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.m   = m
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_8mat4iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_8mat4iter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_m = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2512; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4iter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_8mat4iter___cinit__(((struct __pyx_obj_7cgtypes_mat4iter *)__pyx_v_self), __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_8mat4iter___cinit__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self, PyObject *__pyx_v_m) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":2513
 * 
 *     def __cinit__(self, m):
 *         self.idx = 0             # <<<<<<<<<<<<<<
 *         self.m   = m
 * 
 */
  __pyx_v_self->idx = 0;

  /* "cgtypes.pyx":2514
 *     def __cinit__(self, m):
 *         self.idx = 0
 *         self.m   = m             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_GIVEREF(__pyx_v_m);
  __Pyx_GOTREF(__pyx_v_self->m);
  __Pyx_DECREF(__pyx_v_self->m);
  __pyx_v_self->m = __pyx_v_m;

  /* "cgtypes.pyx":2512
 *     cdef object m
 * 
 *     def __cinit__(self, m):             # <<<<<<<<<<<<<<
 *         self.idx = 0
 *         self.m   = m
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2516
 *         self.m   = m
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8mat4iter_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8mat4iter_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8mat4iter_2__iter__(((struct __pyx_obj_7cgtypes_mat4iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8mat4iter_2__iter__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":2517
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":2516
 *         self.m   = m
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2519
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_8mat4iter_5__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_8mat4iter_5__next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_8mat4iter_4__next__(((struct __pyx_obj_7cgtypes_mat4iter *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8mat4iter_4__next__(struct __pyx_obj_7cgtypes_mat4iter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__next__", 0);

  /* "cgtypes.pyx":2529
 *             self.idx=3
 *             return self.m[2]
 *         elif self.idx==3:             # <<<<<<<<<<<<<<
 *             self.idx=4
 *             return self.m[3]
 */
  switch (__pyx_v_self->idx) {

    /* "cgtypes.pyx":2520
 * 
 *     def __next__(self):
 *         if self.idx==0:             # <<<<<<<<<<<<<<
 *             self.idx=1
 *             return self.m[0]
 */
    case 0:

    /* "cgtypes.pyx":2521
 *     def __next__(self):
 *         if self.idx==0:
 *             self.idx=1             # <<<<<<<<<<<<<<
 *             return self.m[0]
 *         elif self.idx==1:
 */
    __pyx_v_self->idx = 1;

    /* "cgtypes.pyx":2522
 *         if self.idx==0:
 *             self.idx=1
 *             return self.m[0]             # <<<<<<<<<<<<<<
 *         elif self.idx==1:
 *             self.idx=2
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2522; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2523
 *             self.idx=1
 *             return self.m[0]
 *         elif self.idx==1:             # <<<<<<<<<<<<<<
 *             self.idx=2
 *             return self.m[1]
 */
    case 1:

    /* "cgtypes.pyx":2524
 *             return self.m[0]
 *         elif self.idx==1:
 *             self.idx=2             # <<<<<<<<<<<<<<
 *             return self.m[1]
 *         elif self.idx==2:
 */
    __pyx_v_self->idx = 2;

    /* "cgtypes.pyx":2525
 *         elif self.idx==1:
 *             self.idx=2
 *             return self.m[1]             # <<<<<<<<<<<<<<
 *         elif self.idx==2:
 *             self.idx=3
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2525; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2526
 *             self.idx=2
 *             return self.m[1]
 *         elif self.idx==2:             # <<<<<<<<<<<<<<
 *             self.idx=3
 *             return self.m[2]
 */
    case 2:

    /* "cgtypes.pyx":2527
 *             return self.m[1]
 *         elif self.idx==2:
 *             self.idx=3             # <<<<<<<<<<<<<<
 *             return self.m[2]
 *         elif self.idx==3:
 */
    __pyx_v_self->idx = 3;

    /* "cgtypes.pyx":2528
 *         elif self.idx==2:
 *             self.idx=3
 *             return self.m[2]             # <<<<<<<<<<<<<<
 *         elif self.idx==3:
 *             self.idx=4
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2529
 *             self.idx=3
 *             return self.m[2]
 *         elif self.idx==3:             # <<<<<<<<<<<<<<
 *             self.idx=4
 *             return self.m[3]
 */
    case 3:

    /* "cgtypes.pyx":2530
 *             return self.m[2]
 *         elif self.idx==3:
 *             self.idx=4             # <<<<<<<<<<<<<<
 *             return self.m[3]
 *         else:
 */
    __pyx_v_self->idx = 4;

    /* "cgtypes.pyx":2531
 *         elif self.idx==3:
 *             self.idx=4
 *             return self.m[3]             # <<<<<<<<<<<<<<
 *         else:
 *             raise StopIteration
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->m, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":2533
 *             return self.m[3]
 *         else:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 * # Calculates m3.determinant() where m3 is a mat3 that is based on m4
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2519
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if self.idx==0:
 *             self.idx=1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4iter.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2537
 * # Calculates m3.determinant() where m3 is a mat3 that is based on m4
 * # where row i and column j are left out.
 * cdef double _subdet(double m4[16], short i, short j):             # <<<<<<<<<<<<<<
 *     cdef double m3[9]
 *     cdef double* p
 */

static double __pyx_f_7cgtypes__subdet(double *__pyx_v_m4, short __pyx_v_i, short __pyx_v_j) {
  double __pyx_v_m3[9];
  double *__pyx_v_p;
  short __pyx_v_k;
  short __pyx_v_l;
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_subdet", 0);

  /* "cgtypes.pyx":2542
 *     cdef short k, l
 * 
 *     p = m3             # <<<<<<<<<<<<<<
 *     k=0
 *     while 1:
 */
  __pyx_v_p = __pyx_v_m3;

  /* "cgtypes.pyx":2543
 * 
 *     p = m3
 *     k=0             # <<<<<<<<<<<<<<
 *     while 1:
 *         if k==i:
 */
  __pyx_v_k = 0;

  /* "cgtypes.pyx":2544
 *     p = m3
 *     k=0
 *     while 1:             # <<<<<<<<<<<<<<
 *         if k==i:
 *             k=k+1
 */
  while (1) {

    /* "cgtypes.pyx":2545
 *     k=0
 *     while 1:
 *         if k==i:             # <<<<<<<<<<<<<<
 *             k=k+1
 *         if k==4:
 */
    __pyx_t_1 = ((__pyx_v_k == __pyx_v_i) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2546
 *     while 1:
 *         if k==i:
 *             k=k+1             # <<<<<<<<<<<<<<
 *         if k==4:
 *             break
 */
      __pyx_v_k = (__pyx_v_k + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "cgtypes.pyx":2547
 *         if k==i:
 *             k=k+1
 *         if k==4:             # <<<<<<<<<<<<<<
 *             break
 *         l=0
 */
    __pyx_t_1 = ((__pyx_v_k == 4) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":2548
 *             k=k+1
 *         if k==4:
 *             break             # <<<<<<<<<<<<<<
 *         l=0
 *         while 1:
 */
      goto __pyx_L4_break;
    }

    /* "cgtypes.pyx":2549
 *         if k==4:
 *             break
 *         l=0             # <<<<<<<<<<<<<<
 *         while 1:
 *             if l==j:
 */
    __pyx_v_l = 0;

    /* "cgtypes.pyx":2550
 *             break
 *         l=0
 *         while 1:             # <<<<<<<<<<<<<<
 *             if l==j:
 *                 l=l+1
 */
    while (1) {

      /* "cgtypes.pyx":2551
 *         l=0
 *         while 1:
 *             if l==j:             # <<<<<<<<<<<<<<
 *                 l=l+1
 *             if l==4:
 */
      __pyx_t_1 = ((__pyx_v_l == __pyx_v_j) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2552
 *         while 1:
 *             if l==j:
 *                 l=l+1             # <<<<<<<<<<<<<<
 *             if l==4:
 *                 break
 */
        __pyx_v_l = (__pyx_v_l + 1);
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":2553
 *             if l==j:
 *                 l=l+1
 *             if l==4:             # <<<<<<<<<<<<<<
 *                 break
 *             p[0]=m4[k*4+l]
 */
      __pyx_t_1 = ((__pyx_v_l == 4) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":2554
 *                 l=l+1
 *             if l==4:
 *                 break             # <<<<<<<<<<<<<<
 *             p[0]=m4[k*4+l]
 *             p=p+1
 */
        goto __pyx_L8_break;
      }

      /* "cgtypes.pyx":2555
 *             if l==4:
 *                 break
 *             p[0]=m4[k*4+l]             # <<<<<<<<<<<<<<
 *             p=p+1
 *             l=l+1
 */
      (__pyx_v_p[0]) = (__pyx_v_m4[((__pyx_v_k * 4) + __pyx_v_l)]);

      /* "cgtypes.pyx":2556
 *                 break
 *             p[0]=m4[k*4+l]
 *             p=p+1             # <<<<<<<<<<<<<<
 *             l=l+1
 *         k=k+1
 */
      __pyx_v_p = (__pyx_v_p + 1);

      /* "cgtypes.pyx":2557
 *             p[0]=m4[k*4+l]
 *             p=p+1
 *             l=l+1             # <<<<<<<<<<<<<<
 *         k=k+1
 * 
 */
      __pyx_v_l = (__pyx_v_l + 1);
    }
    __pyx_L8_break:;

    /* "cgtypes.pyx":2558
 *             p=p+1
 *             l=l+1
 *         k=k+1             # <<<<<<<<<<<<<<
 * 
 *     return m3[0]*m3[4]*m3[8]+ \
 */
    __pyx_v_k = (__pyx_v_k + 1);
  }
  __pyx_L4_break:;

  /* "cgtypes.pyx":2564
 *            m3[2]*m3[3]*m3[7]- \
 *            m3[6]*m3[4]*m3[2]- \
 *            m3[7]*m3[5]*m3[0]- \             # <<<<<<<<<<<<<<
 *            m3[8]*m3[3]*m3[1]
 * 
 */
  __pyx_r = ((((((((__pyx_v_m3[0]) * (__pyx_v_m3[4])) * (__pyx_v_m3[8])) + (((__pyx_v_m3[1]) * (__pyx_v_m3[5])) * (__pyx_v_m3[6]))) + (((__pyx_v_m3[2]) * (__pyx_v_m3[3])) * (__pyx_v_m3[7]))) - (((__pyx_v_m3[6]) * (__pyx_v_m3[4])) * (__pyx_v_m3[2]))) - (((__pyx_v_m3[7]) * (__pyx_v_m3[5])) * (__pyx_v_m3[0]))) - (((__pyx_v_m3[8]) * (__pyx_v_m3[3])) * (__pyx_v_m3[1])));
  goto __pyx_L0;

  /* "cgtypes.pyx":2537
 * # Calculates m3.determinant() where m3 is a mat3 that is based on m4
 * # where row i and column j are left out.
 * cdef double _subdet(double m4[16], short i, short j):             # <<<<<<<<<<<<<<
 *     cdef double m3[9]
 *     cdef double* p
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2577
 *     cdef double m41, m42, m43, m44
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         cdef int arglen
 *         cdef mat4 B
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4mat4_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_4mat4_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7cgtypes_4mat4___cinit__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4mat4___cinit__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_arglen;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_B = 0;
  CYTHON_UNUSED double __pyx_v_m11;
  CYTHON_UNUSED double __pyx_v_m12;
  CYTHON_UNUSED double __pyx_v_m13;
  CYTHON_UNUSED double __pyx_v_m14;
  CYTHON_UNUSED double __pyx_v_m21;
  CYTHON_UNUSED double __pyx_v_m22;
  CYTHON_UNUSED double __pyx_v_m23;
  CYTHON_UNUSED double __pyx_v_m24;
  CYTHON_UNUSED double __pyx_v_m31;
  CYTHON_UNUSED double __pyx_v_m32;
  CYTHON_UNUSED double __pyx_v_m33;
  CYTHON_UNUSED double __pyx_v_m34;
  CYTHON_UNUSED double __pyx_v_m41;
  CYTHON_UNUSED double __pyx_v_m42;
  CYTHON_UNUSED double __pyx_v_m43;
  CYTHON_UNUSED double __pyx_v_m44;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_v_s = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_seq = NULL;
  Py_ssize_t __pyx_v_seqlen;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_d = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":2580
 *         cdef int arglen
 *         cdef mat4 B
 *         arglen = len(args)             # <<<<<<<<<<<<<<
 * 
 *         # No arguments
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arglen = __pyx_t_1;

  /* "cgtypes.pyx":2726
 * 
 *         # 16 arguments
 *         elif arglen==16:             # <<<<<<<<<<<<<<
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 */
  switch (__pyx_v_arglen) {

    /* "cgtypes.pyx":2583
 * 
 *         # No arguments
 *         if arglen==0:             # <<<<<<<<<<<<<<
 *             m11=m12=m13=m14=0.0
 *             m21=m22=m23=m24=0.0
 */
    case 0:

    /* "cgtypes.pyx":2584
 *         # No arguments
 *         if arglen==0:
 *             m11=m12=m13=m14=0.0             # <<<<<<<<<<<<<<
 *             m21=m22=m23=m24=0.0
 *             m31=m32=m33=m34=0.0
 */
    __pyx_v_m11 = 0.0;
    __pyx_v_m12 = 0.0;
    __pyx_v_m13 = 0.0;
    __pyx_v_m14 = 0.0;

    /* "cgtypes.pyx":2585
 *         if arglen==0:
 *             m11=m12=m13=m14=0.0
 *             m21=m22=m23=m24=0.0             # <<<<<<<<<<<<<<
 *             m31=m32=m33=m34=0.0
 *             m41=m42=m43=m44=0.0
 */
    __pyx_v_m21 = 0.0;
    __pyx_v_m22 = 0.0;
    __pyx_v_m23 = 0.0;
    __pyx_v_m24 = 0.0;

    /* "cgtypes.pyx":2586
 *             m11=m12=m13=m14=0.0
 *             m21=m22=m23=m24=0.0
 *             m31=m32=m33=m34=0.0             # <<<<<<<<<<<<<<
 *             m41=m42=m43=m44=0.0
 * 
 */
    __pyx_v_m31 = 0.0;
    __pyx_v_m32 = 0.0;
    __pyx_v_m33 = 0.0;
    __pyx_v_m34 = 0.0;

    /* "cgtypes.pyx":2587
 *             m21=m22=m23=m24=0.0
 *             m31=m32=m33=m34=0.0
 *             m41=m42=m43=m44=0.0             # <<<<<<<<<<<<<<
 * 
 *         # 1 argument (list, scalar or mat4)
 */
    __pyx_v_m41 = 0.0;
    __pyx_v_m42 = 0.0;
    __pyx_v_m43 = 0.0;
    __pyx_v_m44 = 0.0;
    break;

    /* "cgtypes.pyx":2590
 * 
 *         # 1 argument (list, scalar or mat4)
 *         elif arglen==1:             # <<<<<<<<<<<<<<
 *             T = type(args[0])
 *             # scalar
 */
    case 1:

    /* "cgtypes.pyx":2591
 *         # 1 argument (list, scalar or mat4)
 *         elif arglen==1:
 *             T = type(args[0])             # <<<<<<<<<<<<<<
 *             # scalar
 *             if T==float or T==int or T==long:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2)));
    __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_t_2)));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":2593
 *             T = type(args[0])
 *             # scalar
 *             if T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":2594
 *             # scalar
 *             if T==float or T==int or T==long:
 *                 self.m11 = args[0]             # <<<<<<<<<<<<<<
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":2595
 *             if T==float or T==int or T==long:
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m13 = 0.0
 *                 self.m14 = 0.0
 */
      __pyx_v_self->m12 = 0.0;

      /* "cgtypes.pyx":2596
 *                 self.m11 = args[0]
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m14 = 0.0
 *                 self.m21 = 0.0
 */
      __pyx_v_self->m13 = 0.0;

      /* "cgtypes.pyx":2597
 *                 self.m12 = 0.0
 *                 self.m13 = 0.0
 *                 self.m14 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11
 */
      __pyx_v_self->m14 = 0.0;

      /* "cgtypes.pyx":2598
 *                 self.m13 = 0.0
 *                 self.m14 = 0.0
 *                 self.m21 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0
 */
      __pyx_v_self->m21 = 0.0;

      /* "cgtypes.pyx":2599
 *                 self.m14 = 0.0
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11             # <<<<<<<<<<<<<<
 *                 self.m23 = 0.0
 *                 self.m24 = 0.0
 */
      __pyx_t_5 = __pyx_v_self->m11;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":2600
 *                 self.m21 = 0.0
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m24 = 0.0
 *                 self.m31 = 0.0
 */
      __pyx_v_self->m23 = 0.0;

      /* "cgtypes.pyx":2601
 *                 self.m22 = self.m11
 *                 self.m23 = 0.0
 *                 self.m24 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0
 */
      __pyx_v_self->m24 = 0.0;

      /* "cgtypes.pyx":2602
 *                 self.m23 = 0.0
 *                 self.m24 = 0.0
 *                 self.m31 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m32 = 0.0
 *                 self.m33 = self.m11
 */
      __pyx_v_self->m31 = 0.0;

      /* "cgtypes.pyx":2603
 *                 self.m24 = 0.0
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m33 = self.m11
 *                 self.m34 = 0.0
 */
      __pyx_v_self->m32 = 0.0;

      /* "cgtypes.pyx":2604
 *                 self.m31 = 0.0
 *                 self.m32 = 0.0
 *                 self.m33 = self.m11             # <<<<<<<<<<<<<<
 *                 self.m34 = 0.0
 *                 self.m41 = 0.0
 */
      __pyx_t_5 = __pyx_v_self->m11;
      __pyx_v_self->m33 = __pyx_t_5;

      /* "cgtypes.pyx":2605
 *                 self.m32 = 0.0
 *                 self.m33 = self.m11
 *                 self.m34 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m41 = 0.0
 *                 self.m42 = 0.0
 */
      __pyx_v_self->m34 = 0.0;

      /* "cgtypes.pyx":2606
 *                 self.m33 = self.m11
 *                 self.m34 = 0.0
 *                 self.m41 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m42 = 0.0
 *                 self.m43 = 0.0
 */
      __pyx_v_self->m41 = 0.0;

      /* "cgtypes.pyx":2607
 *                 self.m34 = 0.0
 *                 self.m41 = 0.0
 *                 self.m42 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m43 = 0.0
 *                 self.m44 = self.m11
 */
      __pyx_v_self->m42 = 0.0;

      /* "cgtypes.pyx":2608
 *                 self.m41 = 0.0
 *                 self.m42 = 0.0
 *                 self.m43 = 0.0             # <<<<<<<<<<<<<<
 *                 self.m44 = self.m11
 *             # mat4
 */
      __pyx_v_self->m43 = 0.0;

      /* "cgtypes.pyx":2609
 *                 self.m42 = 0.0
 *                 self.m43 = 0.0
 *                 self.m44 = self.m11             # <<<<<<<<<<<<<<
 *             # mat4
 *             elif T==mat4:
 */
      __pyx_t_5 = __pyx_v_self->m11;
      __pyx_v_self->m44 = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":2611
 *                 self.m44 = self.m11
 *             # mat4
 *             elif T==mat4:             # <<<<<<<<<<<<<<
 *                 B = args[0]
 *                 self.m11 = B.m11
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":2612
 *             # mat4
 *             elif T==mat4:
 *                 B = args[0]             # <<<<<<<<<<<<<<
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2612; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_B = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":2613
 *             elif T==mat4:
 *                 B = args[0]
 *                 self.m11 = B.m11             # <<<<<<<<<<<<<<
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 */
      __pyx_t_5 = __pyx_v_B->m11;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":2614
 *                 B = args[0]
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12             # <<<<<<<<<<<<<<
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14
 */
      __pyx_t_5 = __pyx_v_B->m12;
      __pyx_v_self->m12 = __pyx_t_5;

      /* "cgtypes.pyx":2615
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13             # <<<<<<<<<<<<<<
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21
 */
      __pyx_t_5 = __pyx_v_B->m13;
      __pyx_v_self->m13 = __pyx_t_5;

      /* "cgtypes.pyx":2616
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14             # <<<<<<<<<<<<<<
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 */
      __pyx_t_5 = __pyx_v_B->m14;
      __pyx_v_self->m14 = __pyx_t_5;

      /* "cgtypes.pyx":2617
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21             # <<<<<<<<<<<<<<
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 */
      __pyx_t_5 = __pyx_v_B->m21;
      __pyx_v_self->m21 = __pyx_t_5;

      /* "cgtypes.pyx":2618
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22             # <<<<<<<<<<<<<<
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24
 */
      __pyx_t_5 = __pyx_v_B->m22;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":2619
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23             # <<<<<<<<<<<<<<
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31
 */
      __pyx_t_5 = __pyx_v_B->m23;
      __pyx_v_self->m23 = __pyx_t_5;

      /* "cgtypes.pyx":2620
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24             # <<<<<<<<<<<<<<
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 */
      __pyx_t_5 = __pyx_v_B->m24;
      __pyx_v_self->m24 = __pyx_t_5;

      /* "cgtypes.pyx":2621
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31             # <<<<<<<<<<<<<<
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 */
      __pyx_t_5 = __pyx_v_B->m31;
      __pyx_v_self->m31 = __pyx_t_5;

      /* "cgtypes.pyx":2622
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32             # <<<<<<<<<<<<<<
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34
 */
      __pyx_t_5 = __pyx_v_B->m32;
      __pyx_v_self->m32 = __pyx_t_5;

      /* "cgtypes.pyx":2623
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33             # <<<<<<<<<<<<<<
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41
 */
      __pyx_t_5 = __pyx_v_B->m33;
      __pyx_v_self->m33 = __pyx_t_5;

      /* "cgtypes.pyx":2624
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34             # <<<<<<<<<<<<<<
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42
 */
      __pyx_t_5 = __pyx_v_B->m34;
      __pyx_v_self->m34 = __pyx_t_5;

      /* "cgtypes.pyx":2625
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41             # <<<<<<<<<<<<<<
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43
 */
      __pyx_t_5 = __pyx_v_B->m41;
      __pyx_v_self->m41 = __pyx_t_5;

      /* "cgtypes.pyx":2626
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42             # <<<<<<<<<<<<<<
 *                 self.m43 = B.m43
 *                 self.m44 = B.m44
 */
      __pyx_t_5 = __pyx_v_B->m42;
      __pyx_v_self->m42 = __pyx_t_5;

      /* "cgtypes.pyx":2627
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43             # <<<<<<<<<<<<<<
 *                 self.m44 = B.m44
 *             # String
 */
      __pyx_t_5 = __pyx_v_B->m43;
      __pyx_v_self->m43 = __pyx_t_5;

      /* "cgtypes.pyx":2628
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43
 *                 self.m44 = B.m44             # <<<<<<<<<<<<<<
 *             # String
 *             elif T==str or T==unicode:
 */
      __pyx_t_5 = __pyx_v_B->m44;
      __pyx_v_self->m44 = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":2630
 *                 self.m44 = B.m44
 *             # String
 *             elif T==str or T==unicode:             # <<<<<<<<<<<<<<
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":2631
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":2632
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:             # <<<<<<<<<<<<<<
 *                     s=[]
 *                 for i in range(len(s)):
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s__7);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__7);
      __Pyx_GIVEREF(__pyx_kp_s__7);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_s, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {

        /* "cgtypes.pyx":2633
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 *                     s=[]             # <<<<<<<<<<<<<<
 *                 for i in range(len(s)):
 *                     try:
 */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":2634
 *                 if s==[""]:
 *                     s=[]
 *                 for i in range(len(s)):             # <<<<<<<<<<<<<<
 *                     try:
 *                         s[i] = float(s[i])
 */
      __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "cgtypes.pyx":2635
 *                     s=[]
 *                 for i in range(len(s)):
 *                     try:             # <<<<<<<<<<<<<<
 *                         s[i] = float(s[i])
 *                     except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cgtypes.pyx":2636
 *                 for i in range(len(s)):
 *                     try:
 *                         s[i] = float(s[i])             # <<<<<<<<<<<<<<
 *                     except:
 *                         raise ValueError,"mat4() arg is a malformed string"
 */
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (unlikely(__Pyx_SetItemInt(__pyx_v_s, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2636; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cgtypes.pyx":2637
 *                     try:
 *                         s[i] = float(s[i])
 *                     except:             # <<<<<<<<<<<<<<
 *                         raise ValueError,"mat4() arg is a malformed string"
 *                 B = mat4(s)
 */
          /*except:*/ {
            __Pyx_AddTraceback("cgtypes.mat4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_6);

            /* "cgtypes.pyx":2638
 *                         s[i] = float(s[i])
 *                     except:
 *                         raise ValueError,"mat4() arg is a malformed string"             # <<<<<<<<<<<<<<
 *                 B = mat4(s)
 *                 self.m11 = B.m11
 */
            __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_mat4_arg_is_a_malformed_string, 0, 0);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          }
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L19_try_end:;
        }
      }

      /* "cgtypes.pyx":2639
 *                     except:
 *                         raise ValueError,"mat4() arg is a malformed string"
 *                 B = mat4(s)             # <<<<<<<<<<<<<<
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_B = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":2640
 *                         raise ValueError,"mat4() arg is a malformed string"
 *                 B = mat4(s)
 *                 self.m11 = B.m11             # <<<<<<<<<<<<<<
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 */
      __pyx_t_5 = __pyx_v_B->m11;
      __pyx_v_self->m11 = __pyx_t_5;

      /* "cgtypes.pyx":2641
 *                 B = mat4(s)
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12             # <<<<<<<<<<<<<<
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14
 */
      __pyx_t_5 = __pyx_v_B->m12;
      __pyx_v_self->m12 = __pyx_t_5;

      /* "cgtypes.pyx":2642
 *                 self.m11 = B.m11
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13             # <<<<<<<<<<<<<<
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21
 */
      __pyx_t_5 = __pyx_v_B->m13;
      __pyx_v_self->m13 = __pyx_t_5;

      /* "cgtypes.pyx":2643
 *                 self.m12 = B.m12
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14             # <<<<<<<<<<<<<<
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 */
      __pyx_t_5 = __pyx_v_B->m14;
      __pyx_v_self->m14 = __pyx_t_5;

      /* "cgtypes.pyx":2644
 *                 self.m13 = B.m13
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21             # <<<<<<<<<<<<<<
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 */
      __pyx_t_5 = __pyx_v_B->m21;
      __pyx_v_self->m21 = __pyx_t_5;

      /* "cgtypes.pyx":2645
 *                 self.m14 = B.m14
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22             # <<<<<<<<<<<<<<
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24
 */
      __pyx_t_5 = __pyx_v_B->m22;
      __pyx_v_self->m22 = __pyx_t_5;

      /* "cgtypes.pyx":2646
 *                 self.m21 = B.m21
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23             # <<<<<<<<<<<<<<
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31
 */
      __pyx_t_5 = __pyx_v_B->m23;
      __pyx_v_self->m23 = __pyx_t_5;

      /* "cgtypes.pyx":2647
 *                 self.m22 = B.m22
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24             # <<<<<<<<<<<<<<
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 */
      __pyx_t_5 = __pyx_v_B->m24;
      __pyx_v_self->m24 = __pyx_t_5;

      /* "cgtypes.pyx":2648
 *                 self.m23 = B.m23
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31             # <<<<<<<<<<<<<<
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 */
      __pyx_t_5 = __pyx_v_B->m31;
      __pyx_v_self->m31 = __pyx_t_5;

      /* "cgtypes.pyx":2649
 *                 self.m24 = B.m24
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32             # <<<<<<<<<<<<<<
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34
 */
      __pyx_t_5 = __pyx_v_B->m32;
      __pyx_v_self->m32 = __pyx_t_5;

      /* "cgtypes.pyx":2650
 *                 self.m31 = B.m31
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33             # <<<<<<<<<<<<<<
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41
 */
      __pyx_t_5 = __pyx_v_B->m33;
      __pyx_v_self->m33 = __pyx_t_5;

      /* "cgtypes.pyx":2651
 *                 self.m32 = B.m32
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34             # <<<<<<<<<<<<<<
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42
 */
      __pyx_t_5 = __pyx_v_B->m34;
      __pyx_v_self->m34 = __pyx_t_5;

      /* "cgtypes.pyx":2652
 *                 self.m33 = B.m33
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41             # <<<<<<<<<<<<<<
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43
 */
      __pyx_t_5 = __pyx_v_B->m41;
      __pyx_v_self->m41 = __pyx_t_5;

      /* "cgtypes.pyx":2653
 *                 self.m34 = B.m34
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42             # <<<<<<<<<<<<<<
 *                 self.m43 = B.m43
 *                 self.m44 = B.m44
 */
      __pyx_t_5 = __pyx_v_B->m42;
      __pyx_v_self->m42 = __pyx_t_5;

      /* "cgtypes.pyx":2654
 *                 self.m41 = B.m41
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43             # <<<<<<<<<<<<<<
 *                 self.m44 = B.m44
 *             # Sequence of 16 floats or 4 4-sequences
 */
      __pyx_t_5 = __pyx_v_B->m43;
      __pyx_v_self->m43 = __pyx_t_5;

      /* "cgtypes.pyx":2655
 *                 self.m42 = B.m42
 *                 self.m43 = B.m43
 *                 self.m44 = B.m44             # <<<<<<<<<<<<<<
 *             # Sequence of 16 floats or 4 4-sequences
 *             else:
 */
      __pyx_t_5 = __pyx_v_B->m44;
      __pyx_v_self->m44 = __pyx_t_5;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cgtypes.pyx":2658
 *             # Sequence of 16 floats or 4 4-sequences
 *             else:
 *                 seq = args[0]             # <<<<<<<<<<<<<<
 *                 try:
 *                     seqlen = len(seq)
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seq = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":2659
 *             else:
 *                 seq = args[0]
 *                 try:             # <<<<<<<<<<<<<<
 *                     seqlen = len(seq)
 *                 except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cgtypes.pyx":2660
 *                 seq = args[0]
 *                 try:
 *                     seqlen = len(seq)             # <<<<<<<<<<<<<<
 *                 except:
 *                     raise TypeError,"mat4() arg can't be converted to mat4"
 */
          __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2660; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __pyx_v_seqlen = __pyx_t_1;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cgtypes.pyx":2661
 *                 try:
 *                     seqlen = len(seq)
 *                 except:             # <<<<<<<<<<<<<<
 *                     raise TypeError,"mat4() arg can't be converted to mat4"
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cgtypes.mat4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cgtypes.pyx":2662
 *                     seqlen = len(seq)
 *                 except:
 *                     raise TypeError,"mat4() arg can't be converted to mat4"             # <<<<<<<<<<<<<<
 * 
 *                 if seqlen==16:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat4_arg_can_t_be_converted_to_m, 0, 0);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2662; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_L24_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L29_try_end:;
      }

      /* "cgtypes.pyx":2664
 *                     raise TypeError,"mat4() arg can't be converted to mat4"
 * 
 *                 if seqlen==16:             # <<<<<<<<<<<<<<
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 16) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":2665
 * 
 *                 if seqlen==16:
 *                     self.m11 = seq[0]             # <<<<<<<<<<<<<<
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2665; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m11 = __pyx_t_5;

        /* "cgtypes.pyx":2666
 *                 if seqlen==16:
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]             # <<<<<<<<<<<<<<
 *                     self.m13 = seq[2]
 *                     self.m14 = seq[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m12 = __pyx_t_5;

        /* "cgtypes.pyx":2667
 *                     self.m11 = seq[0]
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]             # <<<<<<<<<<<<<<
 *                     self.m14 = seq[3]
 *                     self.m21 = seq[4]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m13 = __pyx_t_5;

        /* "cgtypes.pyx":2668
 *                     self.m12 = seq[1]
 *                     self.m13 = seq[2]
 *                     self.m14 = seq[3]             # <<<<<<<<<<<<<<
 *                     self.m21 = seq[4]
 *                     self.m22 = seq[5]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m14 = __pyx_t_5;

        /* "cgtypes.pyx":2669
 *                     self.m13 = seq[2]
 *                     self.m14 = seq[3]
 *                     self.m21 = seq[4]             # <<<<<<<<<<<<<<
 *                     self.m22 = seq[5]
 *                     self.m23 = seq[6]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2669; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m21 = __pyx_t_5;

        /* "cgtypes.pyx":2670
 *                     self.m14 = seq[3]
 *                     self.m21 = seq[4]
 *                     self.m22 = seq[5]             # <<<<<<<<<<<<<<
 *                     self.m23 = seq[6]
 *                     self.m24 = seq[7]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m22 = __pyx_t_5;

        /* "cgtypes.pyx":2671
 *                     self.m21 = seq[4]
 *                     self.m22 = seq[5]
 *                     self.m23 = seq[6]             # <<<<<<<<<<<<<<
 *                     self.m24 = seq[7]
 *                     self.m31 = seq[8]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m23 = __pyx_t_5;

        /* "cgtypes.pyx":2672
 *                     self.m22 = seq[5]
 *                     self.m23 = seq[6]
 *                     self.m24 = seq[7]             # <<<<<<<<<<<<<<
 *                     self.m31 = seq[8]
 *                     self.m32 = seq[9]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2672; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m24 = __pyx_t_5;

        /* "cgtypes.pyx":2673
 *                     self.m23 = seq[6]
 *                     self.m24 = seq[7]
 *                     self.m31 = seq[8]             # <<<<<<<<<<<<<<
 *                     self.m32 = seq[9]
 *                     self.m33 = seq[10]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m31 = __pyx_t_5;

        /* "cgtypes.pyx":2674
 *                     self.m24 = seq[7]
 *                     self.m31 = seq[8]
 *                     self.m32 = seq[9]             # <<<<<<<<<<<<<<
 *                     self.m33 = seq[10]
 *                     self.m34 = seq[11]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2674; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m32 = __pyx_t_5;

        /* "cgtypes.pyx":2675
 *                     self.m31 = seq[8]
 *                     self.m32 = seq[9]
 *                     self.m33 = seq[10]             # <<<<<<<<<<<<<<
 *                     self.m34 = seq[11]
 *                     self.m41 = seq[12]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m33 = __pyx_t_5;

        /* "cgtypes.pyx":2676
 *                     self.m32 = seq[9]
 *                     self.m33 = seq[10]
 *                     self.m34 = seq[11]             # <<<<<<<<<<<<<<
 *                     self.m41 = seq[12]
 *                     self.m42 = seq[13]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m34 = __pyx_t_5;

        /* "cgtypes.pyx":2677
 *                     self.m33 = seq[10]
 *                     self.m34 = seq[11]
 *                     self.m41 = seq[12]             # <<<<<<<<<<<<<<
 *                     self.m42 = seq[13]
 *                     self.m43 = seq[14]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m41 = __pyx_t_5;

        /* "cgtypes.pyx":2678
 *                     self.m34 = seq[11]
 *                     self.m41 = seq[12]
 *                     self.m42 = seq[13]             # <<<<<<<<<<<<<<
 *                     self.m43 = seq[14]
 *                     self.m44 = seq[15]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m42 = __pyx_t_5;

        /* "cgtypes.pyx":2679
 *                     self.m41 = seq[12]
 *                     self.m42 = seq[13]
 *                     self.m43 = seq[14]             # <<<<<<<<<<<<<<
 *                     self.m44 = seq[15]
 *                 elif seqlen==4:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m43 = __pyx_t_5;

        /* "cgtypes.pyx":2680
 *                     self.m42 = seq[13]
 *                     self.m43 = seq[14]
 *                     self.m44 = seq[15]             # <<<<<<<<<<<<<<
 *                 elif seqlen==4:
 *                     b = seq[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m44 = __pyx_t_5;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":2681
 *                     self.m43 = seq[14]
 *                     self.m44 = seq[15]
 *                 elif seqlen==4:             # <<<<<<<<<<<<<<
 *                     b = seq[0]
 *                     self.m11 = b[0]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 4) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":2682
 *                     self.m44 = seq[15]
 *                 elif seqlen==4:
 *                     b = seq[0]             # <<<<<<<<<<<<<<
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2682; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_v_b = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":2683
 *                 elif seqlen==4:
 *                     b = seq[0]
 *                     self.m11 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m11 = __pyx_t_5;

        /* "cgtypes.pyx":2684
 *                     b = seq[0]
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m31 = b[2]
 *                     self.m41 = b[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m21 = __pyx_t_5;

        /* "cgtypes.pyx":2685
 *                     self.m11 = b[0]
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]             # <<<<<<<<<<<<<<
 *                     self.m41 = b[3]
 *                     b = seq[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2685; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m31 = __pyx_t_5;

        /* "cgtypes.pyx":2686
 *                     self.m21 = b[1]
 *                     self.m31 = b[2]
 *                     self.m41 = b[3]             # <<<<<<<<<<<<<<
 *                     b = seq[1]
 *                     self.m12 = b[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m41 = __pyx_t_5;

        /* "cgtypes.pyx":2687
 *                     self.m31 = b[2]
 *                     self.m41 = b[3]
 *                     b = seq[1]             # <<<<<<<<<<<<<<
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2687; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":2688
 *                     self.m41 = b[3]
 *                     b = seq[1]
 *                     self.m12 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m12 = __pyx_t_5;

        /* "cgtypes.pyx":2689
 *                     b = seq[1]
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m32 = b[2]
 *                     self.m42 = b[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2689; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m22 = __pyx_t_5;

        /* "cgtypes.pyx":2690
 *                     self.m12 = b[0]
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]             # <<<<<<<<<<<<<<
 *                     self.m42 = b[3]
 *                     b = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m32 = __pyx_t_5;

        /* "cgtypes.pyx":2691
 *                     self.m22 = b[1]
 *                     self.m32 = b[2]
 *                     self.m42 = b[3]             # <<<<<<<<<<<<<<
 *                     b = seq[2]
 *                     self.m13 = b[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m42 = __pyx_t_5;

        /* "cgtypes.pyx":2692
 *                     self.m32 = b[2]
 *                     self.m42 = b[3]
 *                     b = seq[2]             # <<<<<<<<<<<<<<
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2692; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":2693
 *                     self.m42 = b[3]
 *                     b = seq[2]
 *                     self.m13 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m23 = b[1]
 *                     self.m33 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2693; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2693; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m13 = __pyx_t_5;

        /* "cgtypes.pyx":2694
 *                     b = seq[2]
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m33 = b[2]
 *                     self.m43 = b[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m23 = __pyx_t_5;

        /* "cgtypes.pyx":2695
 *                     self.m13 = b[0]
 *                     self.m23 = b[1]
 *                     self.m33 = b[2]             # <<<<<<<<<<<<<<
 *                     self.m43 = b[3]
 *                     b = seq[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m33 = __pyx_t_5;

        /* "cgtypes.pyx":2696
 *                     self.m23 = b[1]
 *                     self.m33 = b[2]
 *                     self.m43 = b[3]             # <<<<<<<<<<<<<<
 *                     b = seq[3]
 *                     self.m14 = b[0]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m43 = __pyx_t_5;

        /* "cgtypes.pyx":2697
 *                     self.m33 = b[2]
 *                     self.m43 = b[3]
 *                     b = seq[3]             # <<<<<<<<<<<<<<
 *                     self.m14 = b[0]
 *                     self.m24 = b[1]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2697; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "cgtypes.pyx":2698
 *                     self.m43 = b[3]
 *                     b = seq[3]
 *                     self.m14 = b[0]             # <<<<<<<<<<<<<<
 *                     self.m24 = b[1]
 *                     self.m34 = b[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m14 = __pyx_t_5;

        /* "cgtypes.pyx":2699
 *                     b = seq[3]
 *                     self.m14 = b[0]
 *                     self.m24 = b[1]             # <<<<<<<<<<<<<<
 *                     self.m34 = b[2]
 *                     self.m44 = b[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m24 = __pyx_t_5;

        /* "cgtypes.pyx":2700
 *                     self.m14 = b[0]
 *                     self.m24 = b[1]
 *                     self.m34 = b[2]             # <<<<<<<<<<<<<<
 *                     self.m44 = b[3]
 *                 else:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m34 = __pyx_t_5;

        /* "cgtypes.pyx":2701
 *                     self.m24 = b[1]
 *                     self.m34 = b[2]
 *                     self.m44 = b[3]             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError, "mat4() takes at most 16 arguments"
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_b, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2701; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->m44 = __pyx_t_5;
        goto __pyx_L32;
      }
      /*else*/ {

        /* "cgtypes.pyx":2703
 *                     self.m44 = b[3]
 *                 else:
 *                     raise TypeError, "mat4() takes at most 16 arguments"             # <<<<<<<<<<<<<<
 * 
 *         # 4 arguments (columns as sequences)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat4_takes_at_most_16_arguments, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L32:;
    }
    __pyx_L3:;
    break;

    /* "cgtypes.pyx":2706
 * 
 *         # 4 arguments (columns as sequences)
 *         elif arglen==4:             # <<<<<<<<<<<<<<
 *             a,b,c,d=args
 *             self.m11 = a[0]
 */
    case 4:

    /* "cgtypes.pyx":2707
 *         # 4 arguments (columns as sequences)
 *         elif arglen==4:
 *             a,b,c,d=args             # <<<<<<<<<<<<<<
 *             self.m11 = a[0]
 *             self.m12 = b[0]
 */
    if (1) {
      PyObject* sequence = __pyx_v_args;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_7,&__pyx_t_6,&__pyx_t_2,&__pyx_t_12};
        for (i=0; i < 4; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
    }
    __pyx_v_a = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_b = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_v_c = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_d = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "cgtypes.pyx":2708
 *         elif arglen==4:
 *             a,b,c,d=args
 *             self.m11 = a[0]             # <<<<<<<<<<<<<<
 *             self.m12 = b[0]
 *             self.m13 = c[0]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_a, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m11 = __pyx_t_5;

    /* "cgtypes.pyx":2709
 *             a,b,c,d=args
 *             self.m11 = a[0]
 *             self.m12 = b[0]             # <<<<<<<<<<<<<<
 *             self.m13 = c[0]
 *             self.m14 = d[0]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_b, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2709; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m12 = __pyx_t_5;

    /* "cgtypes.pyx":2710
 *             self.m11 = a[0]
 *             self.m12 = b[0]
 *             self.m13 = c[0]             # <<<<<<<<<<<<<<
 *             self.m14 = d[0]
 *             self.m21 = a[1]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_c, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m13 = __pyx_t_5;

    /* "cgtypes.pyx":2711
 *             self.m12 = b[0]
 *             self.m13 = c[0]
 *             self.m14 = d[0]             # <<<<<<<<<<<<<<
 *             self.m21 = a[1]
 *             self.m22 = b[1]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_d, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m14 = __pyx_t_5;

    /* "cgtypes.pyx":2712
 *             self.m13 = c[0]
 *             self.m14 = d[0]
 *             self.m21 = a[1]             # <<<<<<<<<<<<<<
 *             self.m22 = b[1]
 *             self.m23 = c[1]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_a, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m21 = __pyx_t_5;

    /* "cgtypes.pyx":2713
 *             self.m14 = d[0]
 *             self.m21 = a[1]
 *             self.m22 = b[1]             # <<<<<<<<<<<<<<
 *             self.m23 = c[1]
 *             self.m24 = d[1]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_b, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m22 = __pyx_t_5;

    /* "cgtypes.pyx":2714
 *             self.m21 = a[1]
 *             self.m22 = b[1]
 *             self.m23 = c[1]             # <<<<<<<<<<<<<<
 *             self.m24 = d[1]
 *             self.m31 = a[2]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_c, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m23 = __pyx_t_5;

    /* "cgtypes.pyx":2715
 *             self.m22 = b[1]
 *             self.m23 = c[1]
 *             self.m24 = d[1]             # <<<<<<<<<<<<<<
 *             self.m31 = a[2]
 *             self.m32 = b[2]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_d, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m24 = __pyx_t_5;

    /* "cgtypes.pyx":2716
 *             self.m23 = c[1]
 *             self.m24 = d[1]
 *             self.m31 = a[2]             # <<<<<<<<<<<<<<
 *             self.m32 = b[2]
 *             self.m33 = c[2]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_a, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m31 = __pyx_t_5;

    /* "cgtypes.pyx":2717
 *             self.m24 = d[1]
 *             self.m31 = a[2]
 *             self.m32 = b[2]             # <<<<<<<<<<<<<<
 *             self.m33 = c[2]
 *             self.m34 = d[2]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_b, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2717; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m32 = __pyx_t_5;

    /* "cgtypes.pyx":2718
 *             self.m31 = a[2]
 *             self.m32 = b[2]
 *             self.m33 = c[2]             # <<<<<<<<<<<<<<
 *             self.m34 = d[2]
 *             self.m41 = a[3]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_c, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m33 = __pyx_t_5;

    /* "cgtypes.pyx":2719
 *             self.m32 = b[2]
 *             self.m33 = c[2]
 *             self.m34 = d[2]             # <<<<<<<<<<<<<<
 *             self.m41 = a[3]
 *             self.m42 = b[3]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_d, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m34 = __pyx_t_5;

    /* "cgtypes.pyx":2720
 *             self.m33 = c[2]
 *             self.m34 = d[2]
 *             self.m41 = a[3]             # <<<<<<<<<<<<<<
 *             self.m42 = b[3]
 *             self.m43 = c[3]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_a, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m41 = __pyx_t_5;

    /* "cgtypes.pyx":2721
 *             self.m34 = d[2]
 *             self.m41 = a[3]
 *             self.m42 = b[3]             # <<<<<<<<<<<<<<
 *             self.m43 = c[3]
 *             self.m44 = d[3]
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_b, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m42 = __pyx_t_5;

    /* "cgtypes.pyx":2722
 *             self.m41 = a[3]
 *             self.m42 = b[3]
 *             self.m43 = c[3]             # <<<<<<<<<<<<<<
 *             self.m44 = d[3]
 * 
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_c, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m43 = __pyx_t_5;

    /* "cgtypes.pyx":2723
 *             self.m42 = b[3]
 *             self.m43 = c[3]
 *             self.m44 = d[3]             # <<<<<<<<<<<<<<
 * 
 *         # 16 arguments
 */
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_d, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m44 = __pyx_t_5;
    break;

    /* "cgtypes.pyx":2726
 * 
 *         # 16 arguments
 *         elif arglen==16:             # <<<<<<<<<<<<<<
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 */
    case 16:

    /* "cgtypes.pyx":2727
 *         # 16 arguments
 *         elif arglen==16:
 *             self.m11 = args[0]             # <<<<<<<<<<<<<<
 *             self.m12 = args[1]
 *             self.m13 = args[2]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m11 = __pyx_t_5;

    /* "cgtypes.pyx":2728
 *         elif arglen==16:
 *             self.m11 = args[0]
 *             self.m12 = args[1]             # <<<<<<<<<<<<<<
 *             self.m13 = args[2]
 *             self.m14 = args[3]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m12 = __pyx_t_5;

    /* "cgtypes.pyx":2729
 *             self.m11 = args[0]
 *             self.m12 = args[1]
 *             self.m13 = args[2]             # <<<<<<<<<<<<<<
 *             self.m14 = args[3]
 *             self.m21 = args[4]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m13 = __pyx_t_5;

    /* "cgtypes.pyx":2730
 *             self.m12 = args[1]
 *             self.m13 = args[2]
 *             self.m14 = args[3]             # <<<<<<<<<<<<<<
 *             self.m21 = args[4]
 *             self.m22 = args[5]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m14 = __pyx_t_5;

    /* "cgtypes.pyx":2731
 *             self.m13 = args[2]
 *             self.m14 = args[3]
 *             self.m21 = args[4]             # <<<<<<<<<<<<<<
 *             self.m22 = args[5]
 *             self.m23 = args[6]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m21 = __pyx_t_5;

    /* "cgtypes.pyx":2732
 *             self.m14 = args[3]
 *             self.m21 = args[4]
 *             self.m22 = args[5]             # <<<<<<<<<<<<<<
 *             self.m23 = args[6]
 *             self.m24 = args[7]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2732; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m22 = __pyx_t_5;

    /* "cgtypes.pyx":2733
 *             self.m21 = args[4]
 *             self.m22 = args[5]
 *             self.m23 = args[6]             # <<<<<<<<<<<<<<
 *             self.m24 = args[7]
 *             self.m31 = args[8]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 6, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m23 = __pyx_t_5;

    /* "cgtypes.pyx":2734
 *             self.m22 = args[5]
 *             self.m23 = args[6]
 *             self.m24 = args[7]             # <<<<<<<<<<<<<<
 *             self.m31 = args[8]
 *             self.m32 = args[9]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 7, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m24 = __pyx_t_5;

    /* "cgtypes.pyx":2735
 *             self.m23 = args[6]
 *             self.m24 = args[7]
 *             self.m31 = args[8]             # <<<<<<<<<<<<<<
 *             self.m32 = args[9]
 *             self.m33 = args[10]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 8, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2735; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m31 = __pyx_t_5;

    /* "cgtypes.pyx":2736
 *             self.m24 = args[7]
 *             self.m31 = args[8]
 *             self.m32 = args[9]             # <<<<<<<<<<<<<<
 *             self.m33 = args[10]
 *             self.m34 = args[11]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 9, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2736; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m32 = __pyx_t_5;

    /* "cgtypes.pyx":2737
 *             self.m31 = args[8]
 *             self.m32 = args[9]
 *             self.m33 = args[10]             # <<<<<<<<<<<<<<
 *             self.m34 = args[11]
 *             self.m41 = args[12]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 10, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m33 = __pyx_t_5;

    /* "cgtypes.pyx":2738
 *             self.m32 = args[9]
 *             self.m33 = args[10]
 *             self.m34 = args[11]             # <<<<<<<<<<<<<<
 *             self.m41 = args[12]
 *             self.m42 = args[13]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 11, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m34 = __pyx_t_5;

    /* "cgtypes.pyx":2739
 *             self.m33 = args[10]
 *             self.m34 = args[11]
 *             self.m41 = args[12]             # <<<<<<<<<<<<<<
 *             self.m42 = args[13]
 *             self.m43 = args[14]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 12, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m41 = __pyx_t_5;

    /* "cgtypes.pyx":2740
 *             self.m34 = args[11]
 *             self.m41 = args[12]
 *             self.m42 = args[13]             # <<<<<<<<<<<<<<
 *             self.m43 = args[14]
 *             self.m44 = args[15]
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 13, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m42 = __pyx_t_5;

    /* "cgtypes.pyx":2741
 *             self.m41 = args[12]
 *             self.m42 = args[13]
 *             self.m43 = args[14]             # <<<<<<<<<<<<<<
 *             self.m44 = args[15]
 * 
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 14, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m43 = __pyx_t_5;

    /* "cgtypes.pyx":2742
 *             self.m42 = args[13]
 *             self.m43 = args[14]
 *             self.m44 = args[15]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_12 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 15, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_self->m44 = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":2745
 * 
 *         else:
 *             raise TypeError,"mat4() arg can't be converted to mat4"             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_mat4_arg_can_t_be_converted_to_m, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2577
 *     cdef double m41, m42, m43, m44
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         cdef int arglen
 *         cdef mat4 B
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cgtypes.mat4.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2747
 *             raise TypeError,"mat4() arg can't be converted to mat4"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_mat4construct, (self[0], self[1], self[2], self[3]))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_2__reduce__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_2__reduce__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cgtypes.pyx":2748
 * 
 *     def __reduce__(self):
 *         return (_mat4construct, (self[0], self[1], self[2], self[3]))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_mat4construct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2747
 *             raise TypeError,"mat4() arg can't be converted to mat4"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_mat4construct, (self[0], self[1], self[2], self[3]))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cgtypes.mat4.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2750
 *         return (_mat4construct, (self[0], self[1], self[2], self[3]))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_4__repr__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_4__repr__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cgtypes.pyx":2751
 * 
 *     def __repr__(self):
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(             # <<<<<<<<<<<<<<
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":2752
 *     def __repr__(self):
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),             # <<<<<<<<<<<<<<
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 *             repr(self.m31),repr(self.m32),repr(self.m33),repr(self.m34),
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":2753
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),             # <<<<<<<<<<<<<<
 *             repr(self.m31),repr(self.m32),repr(self.m33),repr(self.m34),
 *             repr(self.m41),repr(self.m42),repr(self.m43),repr(self.m44))
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":2754
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 *             repr(self.m31),repr(self.m32),repr(self.m33),repr(self.m34),             # <<<<<<<<<<<<<<
 *             repr(self.m41),repr(self.m42),repr(self.m43),repr(self.m44))
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":2755
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 *             repr(self.m31),repr(self.m32),repr(self.m33),repr(self.m34),
 *             repr(self.m41),repr(self.m42),repr(self.m43),repr(self.m44))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_14 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_15 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":2752
 *     def __repr__(self):
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),             # <<<<<<<<<<<<<<
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 *             repr(self.m31),repr(self.m32),repr(self.m33),repr(self.m34),
 */
  __pyx_t_1 = PyTuple_New(16); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_1, 9, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_1, 10, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_1, 11, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_1, 12, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_1, 13, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_1, 14, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_1, 15, __pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_17);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;
  __pyx_t_17 = 0;

  /* "cgtypes.pyx":2751
 * 
 *     def __repr__(self):
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(             # <<<<<<<<<<<<<<
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 *             repr(self.m21),repr(self.m22),repr(self.m23),repr(self.m24),
 */
  __pyx_t_17 = __Pyx_PyString_Format(__pyx_kp_s_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_17;
  __pyx_t_17 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2750
 *         return (_mat4construct, (self[0], self[1], self[2], self[3]))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'mat4(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)'%(
 *             repr(self.m11),repr(self.m12),repr(self.m13),repr(self.m14),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cgtypes.mat4.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2757
 *             repr(self.m41),repr(self.m42),repr(self.m43),repr(self.m44))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13, self.m14,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_6__str__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_6__str__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cgtypes.pyx":2758
 * 
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(             # <<<<<<<<<<<<<<
 *             self.m11, self.m12, self.m13, self.m14,
 *             self.m21, self.m22, self.m23, self.m24,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":2759
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13, self.m14,             # <<<<<<<<<<<<<<
 *             self.m21, self.m22, self.m23, self.m24,
 *             self.m31, self.m32, self.m33, self.m34,
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);

  /* "cgtypes.pyx":2760
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13, self.m14,
 *             self.m21, self.m22, self.m23, self.m24,             # <<<<<<<<<<<<<<
 *             self.m31, self.m32, self.m33, self.m34,
 *             self.m41, self.m42, self.m43, self.m44)
 */
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);

  /* "cgtypes.pyx":2761
 *             self.m11, self.m12, self.m13, self.m14,
 *             self.m21, self.m22, self.m23, self.m24,
 *             self.m31, self.m32, self.m33, self.m34,             # <<<<<<<<<<<<<<
 *             self.m41, self.m42, self.m43, self.m44)
 * 
 */
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);

  /* "cgtypes.pyx":2762
 *             self.m21, self.m22, self.m23, self.m24,
 *             self.m31, self.m32, self.m33, self.m34,
 *             self.m41, self.m42, self.m43, self.m44)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);

  /* "cgtypes.pyx":2759
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13, self.m14,             # <<<<<<<<<<<<<<
 *             self.m21, self.m22, self.m23, self.m24,
 *             self.m31, self.m32, self.m33, self.m34,
 */
  __pyx_t_17 = PyTuple_New(16); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_17);
  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_17, 5, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_17, 6, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_17, 7, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_17, 8, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_17, 9, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_17, 10, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_17, 11, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_17, 12, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_17, 13, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_17, 14, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_17, 15, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_16);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_15 = 0;
  __pyx_t_16 = 0;

  /* "cgtypes.pyx":2758
 * 
 *     def __str__(self):
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(             # <<<<<<<<<<<<<<
 *             self.m11, self.m12, self.m13, self.m14,
 *             self.m21, self.m22, self.m23, self.m24,
 */
  __pyx_t_16 = __Pyx_PyString_Format(__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2, __pyx_t_17); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_r = __pyx_t_16;
  __pyx_t_16 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2757
 *             repr(self.m41),repr(self.m42),repr(self.m43),repr(self.m44))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]\n[%9.4f, %9.4f, %9.4f, %9.4f]"%(
 *             self.m11, self.m12, self.m13, self.m14,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("cgtypes.mat4.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2764
 *             self.m41, self.m42, self.m43, self.m44)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return mat4iter(self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_9__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_8__iter__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_8__iter__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "cgtypes.pyx":2765
 * 
 *     def __iter__(self):
 *         return mat4iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(a,b,op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4iter)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":2764
 *             self.m41, self.m42, self.m43, self.m44)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return mat4iter(self)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2767
 *         return mat4iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef mat4 ma, mb
 *         cdef int cop
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_11__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_10__richcmp__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b), ((PyObject *)__pyx_v_op));

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_10__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_ma = 0;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_mb = 0;
  int __pyx_v_cop;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cgtypes.pyx":2771
 *         cdef int cop
 * 
 *         cop = op             # <<<<<<<<<<<<<<
 * 
 *         ta = type(a)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_op); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cop = __pyx_t_1;

  /* "cgtypes.pyx":2773
 *         cop = op
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 *         if (ta!=mat4 or tb!=mat4):
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":2774
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 *         if (ta!=mat4 or tb!=mat4):
 *             if cop==3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":2775
 *         ta = type(a)
 *         tb = type(b)
 *         if (ta!=mat4 or tb!=mat4):             # <<<<<<<<<<<<<<
 *             if cop==3:
 *                 return 1
 */
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":2776
 *         tb = type(b)
 *         if (ta!=mat4 or tb!=mat4):
 *             if cop==3:             # <<<<<<<<<<<<<<
 *                 return 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cop == 3) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":2777
 *         if (ta!=mat4 or tb!=mat4):
 *             if cop==3:
 *                 return 1             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cgtypes.pyx":2779
 *                 return 1
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *         ma = a
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
    }
  }

  /* "cgtypes.pyx":2781
 *                 return 0
 * 
 *         ma = a             # <<<<<<<<<<<<<<
 *         mb = b
 * 
 */
  if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_a;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_ma = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2782
 * 
 *         ma = a
 *         mb = b             # <<<<<<<<<<<<<<
 * 
 *         # <
 */
  if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_b;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":2814
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
  switch (__pyx_v_cop) {

    /* "cgtypes.pyx":2785
 * 
 *         # <
 *         if cop==0:             # <<<<<<<<<<<<<<
 *             return 0
 *         # <=
 */
    case 0:

    /* "cgtypes.pyx":2786
 *         # <
 *         if cop==0:
 *             return 0             # <<<<<<<<<<<<<<
 *         # <=
 *         elif cop==1:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2788
 *             return 0
 *         # <=
 *         elif cop==1:             # <<<<<<<<<<<<<<
 *             return 0
 *         # ==
 */
    case 1:

    /* "cgtypes.pyx":2789
 *         # <=
 *         elif cop==1:
 *             return 0             # <<<<<<<<<<<<<<
 *         # ==
 *         elif cop==2:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2791
 *             return 0
 *         # ==
 *         elif cop==2:             # <<<<<<<<<<<<<<
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and fabs(ma.m14-mb.m14)<=eps and
 */
    case 2:

    /* "cgtypes.pyx":2792
 *         # ==
 *         elif cop==2:
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m13-mb.m13)<=eps and fabs(ma.m14-mb.m14)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_ma->m11 - __pyx_v_mb->m11)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m12 - __pyx_v_mb->m12)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2793
 *         elif cop==2:
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and fabs(ma.m14-mb.m14)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and fabs(ma.m24-mb.m24)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m13 - __pyx_v_mb->m13)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m14 - __pyx_v_mb->m14)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2794
 *             return (fabs(ma.m11-mb.m11)<=eps and fabs(ma.m12-mb.m12)<=eps and
 *                     fabs(ma.m13-mb.m13)<=eps and fabs(ma.m14-mb.m14)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m23-mb.m23)<=eps and fabs(ma.m24-mb.m24)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m21 - __pyx_v_mb->m21)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m22 - __pyx_v_mb->m22)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2795
 *                     fabs(ma.m13-mb.m13)<=eps and fabs(ma.m14-mb.m14)<=eps and
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and fabs(ma.m24-mb.m24)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 *                     fabs(ma.m33-mb.m33)<=eps and fabs(ma.m34-mb.m34)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m23 - __pyx_v_mb->m23)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m24 - __pyx_v_mb->m24)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2796
 *                     fabs(ma.m21-mb.m21)<=eps and fabs(ma.m22-mb.m22)<=eps and
 *                     fabs(ma.m23-mb.m23)<=eps and fabs(ma.m24-mb.m24)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m33-mb.m33)<=eps and fabs(ma.m34-mb.m34)<=eps and
 *                     fabs(ma.m41-mb.m41)<=eps and fabs(ma.m42-mb.m42)<=eps and
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m31 - __pyx_v_mb->m31)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m32 - __pyx_v_mb->m32)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2797
 *                     fabs(ma.m23-mb.m23)<=eps and fabs(ma.m24-mb.m24)<=eps and
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 *                     fabs(ma.m33-mb.m33)<=eps and fabs(ma.m34-mb.m34)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m41-mb.m41)<=eps and fabs(ma.m42-mb.m42)<=eps and
 *                     fabs(ma.m43-mb.m43)<=eps and fabs(ma.m44-mb.m44)<=eps)
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m33 - __pyx_v_mb->m33)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m34 - __pyx_v_mb->m34)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2798
 *                     fabs(ma.m31-mb.m31)<=eps and fabs(ma.m32-mb.m32)<=eps and
 *                     fabs(ma.m33-mb.m33)<=eps and fabs(ma.m34-mb.m34)<=eps and
 *                     fabs(ma.m41-mb.m41)<=eps and fabs(ma.m42-mb.m42)<=eps and             # <<<<<<<<<<<<<<
 *                     fabs(ma.m43-mb.m43)<=eps and fabs(ma.m44-mb.m44)<=eps)
 *         # !=
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m41 - __pyx_v_mb->m41)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m42 - __pyx_v_mb->m42)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }

    /* "cgtypes.pyx":2799
 *                     fabs(ma.m33-mb.m33)<=eps and fabs(ma.m34-mb.m34)<=eps and
 *                     fabs(ma.m41-mb.m41)<=eps and fabs(ma.m42-mb.m42)<=eps and
 *                     fabs(ma.m43-mb.m43)<=eps and fabs(ma.m44-mb.m44)<=eps)             # <<<<<<<<<<<<<<
 *         # !=
 *         elif cop==3:
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m43 - __pyx_v_mb->m43)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m44 - __pyx_v_mb->m44)) <= __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2801
 *                     fabs(ma.m43-mb.m43)<=eps and fabs(ma.m44-mb.m44)<=eps)
 *         # !=
 *         elif cop==3:             # <<<<<<<<<<<<<<
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or fabs(ma.m14-mb.m14)>eps or
 */
    case 3:

    /* "cgtypes.pyx":2802
 *         # !=
 *         elif cop==3:
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m13-mb.m13)>eps or fabs(ma.m14-mb.m14)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_ma->m11 - __pyx_v_mb->m11)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m12 - __pyx_v_mb->m12)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2803
 *         elif cop==3:
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or fabs(ma.m14-mb.m14)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or fabs(ma.m24-mb.m24)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m13 - __pyx_v_mb->m13)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m14 - __pyx_v_mb->m14)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2804
 *             return (fabs(ma.m11-mb.m11)>eps or fabs(ma.m12-mb.m12)>eps or
 *                     fabs(ma.m13-mb.m13)>eps or fabs(ma.m14-mb.m14)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m23-mb.m23)>eps or fabs(ma.m24-mb.m24)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m21 - __pyx_v_mb->m21)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m22 - __pyx_v_mb->m22)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2805
 *                     fabs(ma.m13-mb.m13)>eps or fabs(ma.m14-mb.m14)>eps or
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or fabs(ma.m24-mb.m24)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 *                     fabs(ma.m33-mb.m33)>eps or fabs(ma.m34-mb.m34)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m23 - __pyx_v_mb->m23)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m24 - __pyx_v_mb->m24)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2806
 *                     fabs(ma.m21-mb.m21)>eps or fabs(ma.m22-mb.m22)>eps or
 *                     fabs(ma.m23-mb.m23)>eps or fabs(ma.m24-mb.m24)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m33-mb.m33)>eps or fabs(ma.m34-mb.m34)>eps or
 *                     fabs(ma.m41-mb.m41)>eps or fabs(ma.m42-mb.m42)>eps or
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m31 - __pyx_v_mb->m31)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m32 - __pyx_v_mb->m32)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2807
 *                     fabs(ma.m23-mb.m23)>eps or fabs(ma.m24-mb.m24)>eps or
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 *                     fabs(ma.m33-mb.m33)>eps or fabs(ma.m34-mb.m34)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m41-mb.m41)>eps or fabs(ma.m42-mb.m42)>eps or
 *                     fabs(ma.m43-mb.m43)>eps or fabs(ma.m44-mb.m44)>eps)
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m33 - __pyx_v_mb->m33)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m34 - __pyx_v_mb->m34)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2808
 *                     fabs(ma.m31-mb.m31)>eps or fabs(ma.m32-mb.m32)>eps or
 *                     fabs(ma.m33-mb.m33)>eps or fabs(ma.m34-mb.m34)>eps or
 *                     fabs(ma.m41-mb.m41)>eps or fabs(ma.m42-mb.m42)>eps or             # <<<<<<<<<<<<<<
 *                     fabs(ma.m43-mb.m43)>eps or fabs(ma.m44-mb.m44)>eps)
 *         # >
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m41 - __pyx_v_mb->m41)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m42 - __pyx_v_mb->m42)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }

    /* "cgtypes.pyx":2809
 *                     fabs(ma.m33-mb.m33)>eps or fabs(ma.m34-mb.m34)>eps or
 *                     fabs(ma.m41-mb.m41)>eps or fabs(ma.m42-mb.m42)>eps or
 *                     fabs(ma.m43-mb.m43)>eps or fabs(ma.m44-mb.m44)>eps)             # <<<<<<<<<<<<<<
 *         # >
 *         elif cop==4:
 */
    __pyx_t_2 = (fabs((__pyx_v_ma->m43 - __pyx_v_mb->m43)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_ma->m44 - __pyx_v_mb->m44)) > __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L23_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2811
 *                     fabs(ma.m43-mb.m43)>eps or fabs(ma.m44-mb.m44)>eps)
 *         # >
 *         elif cop==4:             # <<<<<<<<<<<<<<
 *             return 0
 *         # >=
 */
    case 4:

    /* "cgtypes.pyx":2812
 *         # >
 *         elif cop==4:
 *             return 0             # <<<<<<<<<<<<<<
 *         # >=
 *         elif cop==5:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":2814
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
    case 5:

    /* "cgtypes.pyx":2815
 *         # >=
 *         elif cop==5:
 *             return 0             # <<<<<<<<<<<<<<
 *         # sonst (Fehler)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":2818
 *         # sonst (Fehler)
 *         else:
 *             raise ValueError,"internal error: illegal rich comparison number"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_internal_error_illegal_rich_comp, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":2767
 *         return mat4iter(self)
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef mat4 ma, mb
 *         cdef int cop
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat4.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ma);
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2821
 * 
 * 
 *     def __add__(mat4 a, mat4 b):             # <<<<<<<<<<<<<<
 *         """Matrix addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_12__add__[] = "Matrix addition.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M+M\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_12__add__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_13__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_mat4, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_12__add__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_12__add__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cgtypes.pyx":2832
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2833
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = a.m11 + b.m11             # <<<<<<<<<<<<<<
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13
 */
  __pyx_v_res->m11 = (__pyx_v_a->m11 + __pyx_v_b->m11);

  /* "cgtypes.pyx":2834
 *         res = mat4()
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12             # <<<<<<<<<<<<<<
 *         res.m13 = a.m13 + b.m13
 *         res.m14 = a.m14 + b.m14
 */
  __pyx_v_res->m12 = (__pyx_v_a->m12 + __pyx_v_b->m12);

  /* "cgtypes.pyx":2835
 *         res.m11 = a.m11 + b.m11
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13             # <<<<<<<<<<<<<<
 *         res.m14 = a.m14 + b.m14
 *         res.m21 = a.m21 + b.m21
 */
  __pyx_v_res->m13 = (__pyx_v_a->m13 + __pyx_v_b->m13);

  /* "cgtypes.pyx":2836
 *         res.m12 = a.m12 + b.m12
 *         res.m13 = a.m13 + b.m13
 *         res.m14 = a.m14 + b.m14             # <<<<<<<<<<<<<<
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22
 */
  __pyx_v_res->m14 = (__pyx_v_a->m14 + __pyx_v_b->m14);

  /* "cgtypes.pyx":2837
 *         res.m13 = a.m13 + b.m13
 *         res.m14 = a.m14 + b.m14
 *         res.m21 = a.m21 + b.m21             # <<<<<<<<<<<<<<
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23
 */
  __pyx_v_res->m21 = (__pyx_v_a->m21 + __pyx_v_b->m21);

  /* "cgtypes.pyx":2838
 *         res.m14 = a.m14 + b.m14
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22             # <<<<<<<<<<<<<<
 *         res.m23 = a.m23 + b.m23
 *         res.m24 = a.m24 + b.m24
 */
  __pyx_v_res->m22 = (__pyx_v_a->m22 + __pyx_v_b->m22);

  /* "cgtypes.pyx":2839
 *         res.m21 = a.m21 + b.m21
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23             # <<<<<<<<<<<<<<
 *         res.m24 = a.m24 + b.m24
 *         res.m31 = a.m31 + b.m31
 */
  __pyx_v_res->m23 = (__pyx_v_a->m23 + __pyx_v_b->m23);

  /* "cgtypes.pyx":2840
 *         res.m22 = a.m22 + b.m22
 *         res.m23 = a.m23 + b.m23
 *         res.m24 = a.m24 + b.m24             # <<<<<<<<<<<<<<
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32
 */
  __pyx_v_res->m24 = (__pyx_v_a->m24 + __pyx_v_b->m24);

  /* "cgtypes.pyx":2841
 *         res.m23 = a.m23 + b.m23
 *         res.m24 = a.m24 + b.m24
 *         res.m31 = a.m31 + b.m31             # <<<<<<<<<<<<<<
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33
 */
  __pyx_v_res->m31 = (__pyx_v_a->m31 + __pyx_v_b->m31);

  /* "cgtypes.pyx":2842
 *         res.m24 = a.m24 + b.m24
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32             # <<<<<<<<<<<<<<
 *         res.m33 = a.m33 + b.m33
 *         res.m34 = a.m34 + b.m34
 */
  __pyx_v_res->m32 = (__pyx_v_a->m32 + __pyx_v_b->m32);

  /* "cgtypes.pyx":2843
 *         res.m31 = a.m31 + b.m31
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33             # <<<<<<<<<<<<<<
 *         res.m34 = a.m34 + b.m34
 *         res.m41 = a.m41 + b.m41
 */
  __pyx_v_res->m33 = (__pyx_v_a->m33 + __pyx_v_b->m33);

  /* "cgtypes.pyx":2844
 *         res.m32 = a.m32 + b.m32
 *         res.m33 = a.m33 + b.m33
 *         res.m34 = a.m34 + b.m34             # <<<<<<<<<<<<<<
 *         res.m41 = a.m41 + b.m41
 *         res.m42 = a.m42 + b.m42
 */
  __pyx_v_res->m34 = (__pyx_v_a->m34 + __pyx_v_b->m34);

  /* "cgtypes.pyx":2845
 *         res.m33 = a.m33 + b.m33
 *         res.m34 = a.m34 + b.m34
 *         res.m41 = a.m41 + b.m41             # <<<<<<<<<<<<<<
 *         res.m42 = a.m42 + b.m42
 *         res.m43 = a.m43 + b.m43
 */
  __pyx_v_res->m41 = (__pyx_v_a->m41 + __pyx_v_b->m41);

  /* "cgtypes.pyx":2846
 *         res.m34 = a.m34 + b.m34
 *         res.m41 = a.m41 + b.m41
 *         res.m42 = a.m42 + b.m42             # <<<<<<<<<<<<<<
 *         res.m43 = a.m43 + b.m43
 *         res.m44 = a.m44 + b.m44
 */
  __pyx_v_res->m42 = (__pyx_v_a->m42 + __pyx_v_b->m42);

  /* "cgtypes.pyx":2847
 *         res.m41 = a.m41 + b.m41
 *         res.m42 = a.m42 + b.m42
 *         res.m43 = a.m43 + b.m43             # <<<<<<<<<<<<<<
 *         res.m44 = a.m44 + b.m44
 *         return res
 */
  __pyx_v_res->m43 = (__pyx_v_a->m43 + __pyx_v_b->m43);

  /* "cgtypes.pyx":2848
 *         res.m42 = a.m42 + b.m42
 *         res.m43 = a.m43 + b.m43
 *         res.m44 = a.m44 + b.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = (__pyx_v_a->m44 + __pyx_v_b->m44);

  /* "cgtypes.pyx":2849
 *         res.m43 = a.m43 + b.m43
 *         res.m44 = a.m44 + b.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(mat4 a, mat4 b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2821
 * 
 * 
 *     def __add__(mat4 a, mat4 b):             # <<<<<<<<<<<<<<
 *         """Matrix addition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2851
 *         return res
 * 
 *     def __sub__(mat4 a, mat4 b):             # <<<<<<<<<<<<<<
 *         """Matrix subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_14__sub__[] = "Matrix subtraction.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M-M\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_14__sub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_15__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_mat4, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_14__sub__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_14__sub__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cgtypes.pyx":2862
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":2863
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = a.m11 - b.m11             # <<<<<<<<<<<<<<
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13
 */
  __pyx_v_res->m11 = (__pyx_v_a->m11 - __pyx_v_b->m11);

  /* "cgtypes.pyx":2864
 *         res = mat4()
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12             # <<<<<<<<<<<<<<
 *         res.m13 = a.m13 - b.m13
 *         res.m14 = a.m14 - b.m14
 */
  __pyx_v_res->m12 = (__pyx_v_a->m12 - __pyx_v_b->m12);

  /* "cgtypes.pyx":2865
 *         res.m11 = a.m11 - b.m11
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13             # <<<<<<<<<<<<<<
 *         res.m14 = a.m14 - b.m14
 *         res.m21 = a.m21 - b.m21
 */
  __pyx_v_res->m13 = (__pyx_v_a->m13 - __pyx_v_b->m13);

  /* "cgtypes.pyx":2866
 *         res.m12 = a.m12 - b.m12
 *         res.m13 = a.m13 - b.m13
 *         res.m14 = a.m14 - b.m14             # <<<<<<<<<<<<<<
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22
 */
  __pyx_v_res->m14 = (__pyx_v_a->m14 - __pyx_v_b->m14);

  /* "cgtypes.pyx":2867
 *         res.m13 = a.m13 - b.m13
 *         res.m14 = a.m14 - b.m14
 *         res.m21 = a.m21 - b.m21             # <<<<<<<<<<<<<<
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23
 */
  __pyx_v_res->m21 = (__pyx_v_a->m21 - __pyx_v_b->m21);

  /* "cgtypes.pyx":2868
 *         res.m14 = a.m14 - b.m14
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22             # <<<<<<<<<<<<<<
 *         res.m23 = a.m23 - b.m23
 *         res.m24 = a.m24 - b.m24
 */
  __pyx_v_res->m22 = (__pyx_v_a->m22 - __pyx_v_b->m22);

  /* "cgtypes.pyx":2869
 *         res.m21 = a.m21 - b.m21
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23             # <<<<<<<<<<<<<<
 *         res.m24 = a.m24 - b.m24
 *         res.m31 = a.m31 - b.m31
 */
  __pyx_v_res->m23 = (__pyx_v_a->m23 - __pyx_v_b->m23);

  /* "cgtypes.pyx":2870
 *         res.m22 = a.m22 - b.m22
 *         res.m23 = a.m23 - b.m23
 *         res.m24 = a.m24 - b.m24             # <<<<<<<<<<<<<<
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32
 */
  __pyx_v_res->m24 = (__pyx_v_a->m24 - __pyx_v_b->m24);

  /* "cgtypes.pyx":2871
 *         res.m23 = a.m23 - b.m23
 *         res.m24 = a.m24 - b.m24
 *         res.m31 = a.m31 - b.m31             # <<<<<<<<<<<<<<
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33
 */
  __pyx_v_res->m31 = (__pyx_v_a->m31 - __pyx_v_b->m31);

  /* "cgtypes.pyx":2872
 *         res.m24 = a.m24 - b.m24
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32             # <<<<<<<<<<<<<<
 *         res.m33 = a.m33 - b.m33
 *         res.m34 = a.m34 - b.m34
 */
  __pyx_v_res->m32 = (__pyx_v_a->m32 - __pyx_v_b->m32);

  /* "cgtypes.pyx":2873
 *         res.m31 = a.m31 - b.m31
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33             # <<<<<<<<<<<<<<
 *         res.m34 = a.m34 - b.m34
 *         res.m41 = a.m41 - b.m41
 */
  __pyx_v_res->m33 = (__pyx_v_a->m33 - __pyx_v_b->m33);

  /* "cgtypes.pyx":2874
 *         res.m32 = a.m32 - b.m32
 *         res.m33 = a.m33 - b.m33
 *         res.m34 = a.m34 - b.m34             # <<<<<<<<<<<<<<
 *         res.m41 = a.m41 - b.m41
 *         res.m42 = a.m42 - b.m42
 */
  __pyx_v_res->m34 = (__pyx_v_a->m34 - __pyx_v_b->m34);

  /* "cgtypes.pyx":2875
 *         res.m33 = a.m33 - b.m33
 *         res.m34 = a.m34 - b.m34
 *         res.m41 = a.m41 - b.m41             # <<<<<<<<<<<<<<
 *         res.m42 = a.m42 - b.m42
 *         res.m43 = a.m43 - b.m43
 */
  __pyx_v_res->m41 = (__pyx_v_a->m41 - __pyx_v_b->m41);

  /* "cgtypes.pyx":2876
 *         res.m34 = a.m34 - b.m34
 *         res.m41 = a.m41 - b.m41
 *         res.m42 = a.m42 - b.m42             # <<<<<<<<<<<<<<
 *         res.m43 = a.m43 - b.m43
 *         res.m44 = a.m44 - b.m44
 */
  __pyx_v_res->m42 = (__pyx_v_a->m42 - __pyx_v_b->m42);

  /* "cgtypes.pyx":2877
 *         res.m41 = a.m41 - b.m41
 *         res.m42 = a.m42 - b.m42
 *         res.m43 = a.m43 - b.m43             # <<<<<<<<<<<<<<
 *         res.m44 = a.m44 - b.m44
 *         return res
 */
  __pyx_v_res->m43 = (__pyx_v_a->m43 - __pyx_v_b->m43);

  /* "cgtypes.pyx":2878
 *         res.m42 = a.m42 - b.m42
 *         res.m43 = a.m43 - b.m43
 *         res.m44 = a.m44 - b.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = (__pyx_v_a->m44 - __pyx_v_b->m44);

  /* "cgtypes.pyx":2879
 *         res.m43 = a.m43 - b.m43
 *         res.m44 = a.m44 - b.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":2851
 *         return res
 * 
 *     def __sub__(mat4 a, mat4 b):             # <<<<<<<<<<<<<<
 *         """Matrix subtraction.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":2881
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_16__mul__[] = "Multiplication.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M*2.0\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        >>> print 2.0*M\n        [   2.0000,    4.0000,    6.0000,    8.0000]\n        [  10.0000,   12.0000,   14.0000,   16.0000]\n        [  18.0000,   20.0000,   22.0000,   24.0000]\n        [  26.0000,   28.0000,   30.0000,   32.0000]\n        >>> print M*M\n        [  90.0000,  100.0000,  110.0000,  120.0000]\n        [ 202.0000,  228.0000,  254.0000,  280.0000]\n        [ 314.0000,  356.0000,  398.0000,  440.0000]\n        [ 426.0000,  484.0000,  542.0000,  600.0000]\n        >>> print M*_vec3(1,2,3)\n        (0.1765, 0.4510, 0.7255)\n        >>> print _vec3(1,2,3)*M\n        (0.7083, 0.8056, 0.9028)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_16__mul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_17__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_16__mul__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_16__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_ma = 0;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_mb = 0;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vb = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vres = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_wa = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_wb = 0;
  struct __pyx_obj_7cgtypes_vec4 *__pyx_v_wres = 0;
  double __pyx_v_r;
  double __pyx_v_w;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cgtypes.pyx":2910
 *         cdef double r, w
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 * 
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":2911
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         # mat4 on the left?
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":2914
 * 
 *         # mat4 on the left?
 *         if ta==mat4:             # <<<<<<<<<<<<<<
 *             ma = a
 *             # mat4 on the right?
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":2915
 *         # mat4 on the left?
 *         if ta==mat4:
 *             ma = a             # <<<<<<<<<<<<<<
 *             # mat4 on the right?
 *             if tb==mat4:
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_ma = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":2917
 *             ma = a
 *             # mat4 on the right?
 *             if tb==mat4:             # <<<<<<<<<<<<<<
 *                 # mat4*mat4
 *                 res = mat4()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":2919
 *             if tb==mat4:
 *                 # mat4*mat4
 *                 res = mat4()             # <<<<<<<<<<<<<<
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31+ma.m14*mb.m41
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2920
 *                 # mat4*mat4
 *                 res = mat4()
 *                 mb = b             # <<<<<<<<<<<<<<
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31+ma.m14*mb.m41
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32+ma.m14*mb.m42
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2921
 *                 res = mat4()
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31+ma.m14*mb.m41             # <<<<<<<<<<<<<<
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32+ma.m14*mb.m42
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33+ma.m14*mb.m43
 */
      __pyx_v_res->m11 = ((((__pyx_v_ma->m11 * __pyx_v_mb->m11) + (__pyx_v_ma->m12 * __pyx_v_mb->m21)) + (__pyx_v_ma->m13 * __pyx_v_mb->m31)) + (__pyx_v_ma->m14 * __pyx_v_mb->m41));

      /* "cgtypes.pyx":2922
 *                 mb = b
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31+ma.m14*mb.m41
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32+ma.m14*mb.m42             # <<<<<<<<<<<<<<
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33+ma.m14*mb.m43
 *                 res.m14 = ma.m11*mb.m14+ma.m12*mb.m24+ma.m13*mb.m34+ma.m14*mb.m44
 */
      __pyx_v_res->m12 = ((((__pyx_v_ma->m11 * __pyx_v_mb->m12) + (__pyx_v_ma->m12 * __pyx_v_mb->m22)) + (__pyx_v_ma->m13 * __pyx_v_mb->m32)) + (__pyx_v_ma->m14 * __pyx_v_mb->m42));

      /* "cgtypes.pyx":2923
 *                 res.m11 = ma.m11*mb.m11+ma.m12*mb.m21+ma.m13*mb.m31+ma.m14*mb.m41
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32+ma.m14*mb.m42
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33+ma.m14*mb.m43             # <<<<<<<<<<<<<<
 *                 res.m14 = ma.m11*mb.m14+ma.m12*mb.m24+ma.m13*mb.m34+ma.m14*mb.m44
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31+ma.m24*mb.m41
 */
      __pyx_v_res->m13 = ((((__pyx_v_ma->m11 * __pyx_v_mb->m13) + (__pyx_v_ma->m12 * __pyx_v_mb->m23)) + (__pyx_v_ma->m13 * __pyx_v_mb->m33)) + (__pyx_v_ma->m14 * __pyx_v_mb->m43));

      /* "cgtypes.pyx":2924
 *                 res.m12 = ma.m11*mb.m12+ma.m12*mb.m22+ma.m13*mb.m32+ma.m14*mb.m42
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33+ma.m14*mb.m43
 *                 res.m14 = ma.m11*mb.m14+ma.m12*mb.m24+ma.m13*mb.m34+ma.m14*mb.m44             # <<<<<<<<<<<<<<
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31+ma.m24*mb.m41
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32+ma.m24*mb.m42
 */
      __pyx_v_res->m14 = ((((__pyx_v_ma->m11 * __pyx_v_mb->m14) + (__pyx_v_ma->m12 * __pyx_v_mb->m24)) + (__pyx_v_ma->m13 * __pyx_v_mb->m34)) + (__pyx_v_ma->m14 * __pyx_v_mb->m44));

      /* "cgtypes.pyx":2925
 *                 res.m13 = ma.m11*mb.m13+ma.m12*mb.m23+ma.m13*mb.m33+ma.m14*mb.m43
 *                 res.m14 = ma.m11*mb.m14+ma.m12*mb.m24+ma.m13*mb.m34+ma.m14*mb.m44
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31+ma.m24*mb.m41             # <<<<<<<<<<<<<<
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32+ma.m24*mb.m42
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33+ma.m24*mb.m43
 */
      __pyx_v_res->m21 = ((((__pyx_v_ma->m21 * __pyx_v_mb->m11) + (__pyx_v_ma->m22 * __pyx_v_mb->m21)) + (__pyx_v_ma->m23 * __pyx_v_mb->m31)) + (__pyx_v_ma->m24 * __pyx_v_mb->m41));

      /* "cgtypes.pyx":2926
 *                 res.m14 = ma.m11*mb.m14+ma.m12*mb.m24+ma.m13*mb.m34+ma.m14*mb.m44
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31+ma.m24*mb.m41
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32+ma.m24*mb.m42             # <<<<<<<<<<<<<<
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33+ma.m24*mb.m43
 *                 res.m24 = ma.m21*mb.m14+ma.m22*mb.m24+ma.m23*mb.m34+ma.m24*mb.m44
 */
      __pyx_v_res->m22 = ((((__pyx_v_ma->m21 * __pyx_v_mb->m12) + (__pyx_v_ma->m22 * __pyx_v_mb->m22)) + (__pyx_v_ma->m23 * __pyx_v_mb->m32)) + (__pyx_v_ma->m24 * __pyx_v_mb->m42));

      /* "cgtypes.pyx":2927
 *                 res.m21 = ma.m21*mb.m11+ma.m22*mb.m21+ma.m23*mb.m31+ma.m24*mb.m41
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32+ma.m24*mb.m42
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33+ma.m24*mb.m43             # <<<<<<<<<<<<<<
 *                 res.m24 = ma.m21*mb.m14+ma.m22*mb.m24+ma.m23*mb.m34+ma.m24*mb.m44
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31+ma.m34*mb.m41
 */
      __pyx_v_res->m23 = ((((__pyx_v_ma->m21 * __pyx_v_mb->m13) + (__pyx_v_ma->m22 * __pyx_v_mb->m23)) + (__pyx_v_ma->m23 * __pyx_v_mb->m33)) + (__pyx_v_ma->m24 * __pyx_v_mb->m43));

      /* "cgtypes.pyx":2928
 *                 res.m22 = ma.m21*mb.m12+ma.m22*mb.m22+ma.m23*mb.m32+ma.m24*mb.m42
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33+ma.m24*mb.m43
 *                 res.m24 = ma.m21*mb.m14+ma.m22*mb.m24+ma.m23*mb.m34+ma.m24*mb.m44             # <<<<<<<<<<<<<<
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31+ma.m34*mb.m41
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32+ma.m34*mb.m42
 */
      __pyx_v_res->m24 = ((((__pyx_v_ma->m21 * __pyx_v_mb->m14) + (__pyx_v_ma->m22 * __pyx_v_mb->m24)) + (__pyx_v_ma->m23 * __pyx_v_mb->m34)) + (__pyx_v_ma->m24 * __pyx_v_mb->m44));

      /* "cgtypes.pyx":2929
 *                 res.m23 = ma.m21*mb.m13+ma.m22*mb.m23+ma.m23*mb.m33+ma.m24*mb.m43
 *                 res.m24 = ma.m21*mb.m14+ma.m22*mb.m24+ma.m23*mb.m34+ma.m24*mb.m44
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31+ma.m34*mb.m41             # <<<<<<<<<<<<<<
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32+ma.m34*mb.m42
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33+ma.m34*mb.m43
 */
      __pyx_v_res->m31 = ((((__pyx_v_ma->m31 * __pyx_v_mb->m11) + (__pyx_v_ma->m32 * __pyx_v_mb->m21)) + (__pyx_v_ma->m33 * __pyx_v_mb->m31)) + (__pyx_v_ma->m34 * __pyx_v_mb->m41));

      /* "cgtypes.pyx":2930
 *                 res.m24 = ma.m21*mb.m14+ma.m22*mb.m24+ma.m23*mb.m34+ma.m24*mb.m44
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31+ma.m34*mb.m41
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32+ma.m34*mb.m42             # <<<<<<<<<<<<<<
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33+ma.m34*mb.m43
 *                 res.m34 = ma.m31*mb.m14+ma.m32*mb.m24+ma.m33*mb.m34+ma.m34*mb.m44
 */
      __pyx_v_res->m32 = ((((__pyx_v_ma->m31 * __pyx_v_mb->m12) + (__pyx_v_ma->m32 * __pyx_v_mb->m22)) + (__pyx_v_ma->m33 * __pyx_v_mb->m32)) + (__pyx_v_ma->m34 * __pyx_v_mb->m42));

      /* "cgtypes.pyx":2931
 *                 res.m31 = ma.m31*mb.m11+ma.m32*mb.m21+ma.m33*mb.m31+ma.m34*mb.m41
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32+ma.m34*mb.m42
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33+ma.m34*mb.m43             # <<<<<<<<<<<<<<
 *                 res.m34 = ma.m31*mb.m14+ma.m32*mb.m24+ma.m33*mb.m34+ma.m34*mb.m44
 *                 res.m41 = ma.m41*mb.m11+ma.m42*mb.m21+ma.m43*mb.m31+ma.m44*mb.m41
 */
      __pyx_v_res->m33 = ((((__pyx_v_ma->m31 * __pyx_v_mb->m13) + (__pyx_v_ma->m32 * __pyx_v_mb->m23)) + (__pyx_v_ma->m33 * __pyx_v_mb->m33)) + (__pyx_v_ma->m34 * __pyx_v_mb->m43));

      /* "cgtypes.pyx":2932
 *                 res.m32 = ma.m31*mb.m12+ma.m32*mb.m22+ma.m33*mb.m32+ma.m34*mb.m42
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33+ma.m34*mb.m43
 *                 res.m34 = ma.m31*mb.m14+ma.m32*mb.m24+ma.m33*mb.m34+ma.m34*mb.m44             # <<<<<<<<<<<<<<
 *                 res.m41 = ma.m41*mb.m11+ma.m42*mb.m21+ma.m43*mb.m31+ma.m44*mb.m41
 *                 res.m42 = ma.m41*mb.m12+ma.m42*mb.m22+ma.m43*mb.m32+ma.m44*mb.m42
 */
      __pyx_v_res->m34 = ((((__pyx_v_ma->m31 * __pyx_v_mb->m14) + (__pyx_v_ma->m32 * __pyx_v_mb->m24)) + (__pyx_v_ma->m33 * __pyx_v_mb->m34)) + (__pyx_v_ma->m34 * __pyx_v_mb->m44));

      /* "cgtypes.pyx":2933
 *                 res.m33 = ma.m31*mb.m13+ma.m32*mb.m23+ma.m33*mb.m33+ma.m34*mb.m43
 *                 res.m34 = ma.m31*mb.m14+ma.m32*mb.m24+ma.m33*mb.m34+ma.m34*mb.m44
 *                 res.m41 = ma.m41*mb.m11+ma.m42*mb.m21+ma.m43*mb.m31+ma.m44*mb.m41             # <<<<<<<<<<<<<<
 *                 res.m42 = ma.m41*mb.m12+ma.m42*mb.m22+ma.m43*mb.m32+ma.m44*mb.m42
 *                 res.m43 = ma.m41*mb.m13+ma.m42*mb.m23+ma.m43*mb.m33+ma.m44*mb.m43
 */
      __pyx_v_res->m41 = ((((__pyx_v_ma->m41 * __pyx_v_mb->m11) + (__pyx_v_ma->m42 * __pyx_v_mb->m21)) + (__pyx_v_ma->m43 * __pyx_v_mb->m31)) + (__pyx_v_ma->m44 * __pyx_v_mb->m41));

      /* "cgtypes.pyx":2934
 *                 res.m34 = ma.m31*mb.m14+ma.m32*mb.m24+ma.m33*mb.m34+ma.m34*mb.m44
 *                 res.m41 = ma.m41*mb.m11+ma.m42*mb.m21+ma.m43*mb.m31+ma.m44*mb.m41
 *                 res.m42 = ma.m41*mb.m12+ma.m42*mb.m22+ma.m43*mb.m32+ma.m44*mb.m42             # <<<<<<<<<<<<<<
 *                 res.m43 = ma.m41*mb.m13+ma.m42*mb.m23+ma.m43*mb.m33+ma.m44*mb.m43
 *                 res.m44 = ma.m41*mb.m14+ma.m42*mb.m24+ma.m43*mb.m34+ma.m44*mb.m44
 */
      __pyx_v_res->m42 = ((((__pyx_v_ma->m41 * __pyx_v_mb->m12) + (__pyx_v_ma->m42 * __pyx_v_mb->m22)) + (__pyx_v_ma->m43 * __pyx_v_mb->m32)) + (__pyx_v_ma->m44 * __pyx_v_mb->m42));

      /* "cgtypes.pyx":2935
 *                 res.m41 = ma.m41*mb.m11+ma.m42*mb.m21+ma.m43*mb.m31+ma.m44*mb.m41
 *                 res.m42 = ma.m41*mb.m12+ma.m42*mb.m22+ma.m43*mb.m32+ma.m44*mb.m42
 *                 res.m43 = ma.m41*mb.m13+ma.m42*mb.m23+ma.m43*mb.m33+ma.m44*mb.m43             # <<<<<<<<<<<<<<
 *                 res.m44 = ma.m41*mb.m14+ma.m42*mb.m24+ma.m43*mb.m34+ma.m44*mb.m44
 *                 return res
 */
      __pyx_v_res->m43 = ((((__pyx_v_ma->m41 * __pyx_v_mb->m13) + (__pyx_v_ma->m42 * __pyx_v_mb->m23)) + (__pyx_v_ma->m43 * __pyx_v_mb->m33)) + (__pyx_v_ma->m44 * __pyx_v_mb->m43));

      /* "cgtypes.pyx":2936
 *                 res.m42 = ma.m41*mb.m12+ma.m42*mb.m22+ma.m43*mb.m32+ma.m44*mb.m42
 *                 res.m43 = ma.m41*mb.m13+ma.m42*mb.m23+ma.m43*mb.m33+ma.m44*mb.m43
 *                 res.m44 = ma.m41*mb.m14+ma.m42*mb.m24+ma.m43*mb.m34+ma.m44*mb.m44             # <<<<<<<<<<<<<<
 *                 return res
 *             # vec4 on the right?
 */
      __pyx_v_res->m44 = ((((__pyx_v_ma->m41 * __pyx_v_mb->m14) + (__pyx_v_ma->m42 * __pyx_v_mb->m24)) + (__pyx_v_ma->m43 * __pyx_v_mb->m34)) + (__pyx_v_ma->m44 * __pyx_v_mb->m44));

      /* "cgtypes.pyx":2937
 *                 res.m43 = ma.m41*mb.m13+ma.m42*mb.m23+ma.m43*mb.m33+ma.m44*mb.m43
 *                 res.m44 = ma.m41*mb.m14+ma.m42*mb.m24+ma.m43*mb.m34+ma.m44*mb.m44
 *                 return res             # <<<<<<<<<<<<<<
 *             # vec4 on the right?
 *             elif tb==vec4:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":2939
 *                 return res
 *             # vec4 on the right?
 *             elif tb==vec4:             # <<<<<<<<<<<<<<
 *                 # mat4*vec4
 *                 wres = vec4()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":2941
 *             elif tb==vec4:
 *                 # mat4*vec4
 *                 wres = vec4()             # <<<<<<<<<<<<<<
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z + ma.m14*wb.w
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_wres = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2942
 *                 # mat4*vec4
 *                 wres = vec4()
 *                 wb   = b             # <<<<<<<<<<<<<<
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z + ma.m14*wb.w
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z + ma.m24*wb.w
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_wb = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2943
 *                 wres = vec4()
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z + ma.m14*wb.w             # <<<<<<<<<<<<<<
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z + ma.m24*wb.w
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z + ma.m34*wb.w
 */
      __pyx_v_wres->x = ((((__pyx_v_ma->m11 * __pyx_v_wb->x) + (__pyx_v_ma->m12 * __pyx_v_wb->y)) + (__pyx_v_ma->m13 * __pyx_v_wb->z)) + (__pyx_v_ma->m14 * __pyx_v_wb->w));

      /* "cgtypes.pyx":2944
 *                 wb   = b
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z + ma.m14*wb.w
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z + ma.m24*wb.w             # <<<<<<<<<<<<<<
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z + ma.m34*wb.w
 *                 wres.w = ma.m41*wb.x + ma.m42*wb.y + ma.m43*wb.z + ma.m44*wb.w
 */
      __pyx_v_wres->y = ((((__pyx_v_ma->m21 * __pyx_v_wb->x) + (__pyx_v_ma->m22 * __pyx_v_wb->y)) + (__pyx_v_ma->m23 * __pyx_v_wb->z)) + (__pyx_v_ma->m24 * __pyx_v_wb->w));

      /* "cgtypes.pyx":2945
 *                 wres.x = ma.m11*wb.x + ma.m12*wb.y + ma.m13*wb.z + ma.m14*wb.w
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z + ma.m24*wb.w
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z + ma.m34*wb.w             # <<<<<<<<<<<<<<
 *                 wres.w = ma.m41*wb.x + ma.m42*wb.y + ma.m43*wb.z + ma.m44*wb.w
 *                 return wres
 */
      __pyx_v_wres->z = ((((__pyx_v_ma->m31 * __pyx_v_wb->x) + (__pyx_v_ma->m32 * __pyx_v_wb->y)) + (__pyx_v_ma->m33 * __pyx_v_wb->z)) + (__pyx_v_ma->m34 * __pyx_v_wb->w));

      /* "cgtypes.pyx":2946
 *                 wres.y = ma.m21*wb.x + ma.m22*wb.y + ma.m23*wb.z + ma.m24*wb.w
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z + ma.m34*wb.w
 *                 wres.w = ma.m41*wb.x + ma.m42*wb.y + ma.m43*wb.z + ma.m44*wb.w             # <<<<<<<<<<<<<<
 *                 return wres
 *             # vec3 on the right?
 */
      __pyx_v_wres->w = ((((__pyx_v_ma->m41 * __pyx_v_wb->x) + (__pyx_v_ma->m42 * __pyx_v_wb->y)) + (__pyx_v_ma->m43 * __pyx_v_wb->z)) + (__pyx_v_ma->m44 * __pyx_v_wb->w));

      /* "cgtypes.pyx":2947
 *                 wres.z = ma.m31*wb.x + ma.m32*wb.y + ma.m33*wb.z + ma.m34*wb.w
 *                 wres.w = ma.m41*wb.x + ma.m42*wb.y + ma.m43*wb.z + ma.m44*wb.w
 *                 return wres             # <<<<<<<<<<<<<<
 *             # vec3 on the right?
 *             elif tb==vec3:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_wres));
      __pyx_r = ((PyObject *)__pyx_v_wres);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":2949
 *                 return wres
 *             # vec3 on the right?
 *             elif tb==vec3:             # <<<<<<<<<<<<<<
 *                 # mat4*vec3
 *                 vres = vec3()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":2951
 *             elif tb==vec3:
 *                 # mat4*vec3
 *                 vres = vec3()             # <<<<<<<<<<<<<<
 *                 vb   = b
 *                 vres.x = ma.m11*vb.x + ma.m12*vb.y + ma.m13*vb.z + ma.m14
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_vres = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2952
 *                 # mat4*vec3
 *                 vres = vec3()
 *                 vb   = b             # <<<<<<<<<<<<<<
 *                 vres.x = ma.m11*vb.x + ma.m12*vb.y + ma.m13*vb.z + ma.m14
 *                 vres.y = ma.m21*vb.x + ma.m22*vb.y + ma.m23*vb.z + ma.m24
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2953
 *                 vres = vec3()
 *                 vb   = b
 *                 vres.x = ma.m11*vb.x + ma.m12*vb.y + ma.m13*vb.z + ma.m14             # <<<<<<<<<<<<<<
 *                 vres.y = ma.m21*vb.x + ma.m22*vb.y + ma.m23*vb.z + ma.m24
 *                 vres.z = ma.m31*vb.x + ma.m32*vb.y + ma.m33*vb.z + ma.m34
 */
      __pyx_v_vres->x = ((((__pyx_v_ma->m11 * __pyx_v_vb->x) + (__pyx_v_ma->m12 * __pyx_v_vb->y)) + (__pyx_v_ma->m13 * __pyx_v_vb->z)) + __pyx_v_ma->m14);

      /* "cgtypes.pyx":2954
 *                 vb   = b
 *                 vres.x = ma.m11*vb.x + ma.m12*vb.y + ma.m13*vb.z + ma.m14
 *                 vres.y = ma.m21*vb.x + ma.m22*vb.y + ma.m23*vb.z + ma.m24             # <<<<<<<<<<<<<<
 *                 vres.z = ma.m31*vb.x + ma.m32*vb.y + ma.m33*vb.z + ma.m34
 *                 w    = ma.m41*vb.x + ma.m42*vb.y + ma.m43*vb.z + ma.m44
 */
      __pyx_v_vres->y = ((((__pyx_v_ma->m21 * __pyx_v_vb->x) + (__pyx_v_ma->m22 * __pyx_v_vb->y)) + (__pyx_v_ma->m23 * __pyx_v_vb->z)) + __pyx_v_ma->m24);

      /* "cgtypes.pyx":2955
 *                 vres.x = ma.m11*vb.x + ma.m12*vb.y + ma.m13*vb.z + ma.m14
 *                 vres.y = ma.m21*vb.x + ma.m22*vb.y + ma.m23*vb.z + ma.m24
 *                 vres.z = ma.m31*vb.x + ma.m32*vb.y + ma.m33*vb.z + ma.m34             # <<<<<<<<<<<<<<
 *                 w    = ma.m41*vb.x + ma.m42*vb.y + ma.m43*vb.z + ma.m44
 *                 if fabs(w)>eps:
 */
      __pyx_v_vres->z = ((((__pyx_v_ma->m31 * __pyx_v_vb->x) + (__pyx_v_ma->m32 * __pyx_v_vb->y)) + (__pyx_v_ma->m33 * __pyx_v_vb->z)) + __pyx_v_ma->m34);

      /* "cgtypes.pyx":2956
 *                 vres.y = ma.m21*vb.x + ma.m22*vb.y + ma.m23*vb.z + ma.m24
 *                 vres.z = ma.m31*vb.x + ma.m32*vb.y + ma.m33*vb.z + ma.m34
 *                 w    = ma.m41*vb.x + ma.m42*vb.y + ma.m43*vb.z + ma.m44             # <<<<<<<<<<<<<<
 *                 if fabs(w)>eps:
 *                     vres.x = vres.x/w
 */
      __pyx_v_w = ((((__pyx_v_ma->m41 * __pyx_v_vb->x) + (__pyx_v_ma->m42 * __pyx_v_vb->y)) + (__pyx_v_ma->m43 * __pyx_v_vb->z)) + __pyx_v_ma->m44);

      /* "cgtypes.pyx":2957
 *                 vres.z = ma.m31*vb.x + ma.m32*vb.y + ma.m33*vb.z + ma.m34
 *                 w    = ma.m41*vb.x + ma.m42*vb.y + ma.m43*vb.z + ma.m44
 *                 if fabs(w)>eps:             # <<<<<<<<<<<<<<
 *                     vres.x = vres.x/w
 *                     vres.y = vres.y/w
 */
      __pyx_t_2 = ((fabs(__pyx_v_w) > __pyx_v_7cgtypes_eps) != 0);
      if (__pyx_t_2) {

        /* "cgtypes.pyx":2958
 *                 w    = ma.m41*vb.x + ma.m42*vb.y + ma.m43*vb.z + ma.m44
 *                 if fabs(w)>eps:
 *                     vres.x = vres.x/w             # <<<<<<<<<<<<<<
 *                     vres.y = vres.y/w
 *                     vres.z = vres.z/w
 */
        if (unlikely(__pyx_v_w == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_vres->x = (__pyx_v_vres->x / __pyx_v_w);

        /* "cgtypes.pyx":2959
 *                 if fabs(w)>eps:
 *                     vres.x = vres.x/w
 *                     vres.y = vres.y/w             # <<<<<<<<<<<<<<
 *                     vres.z = vres.z/w
 *                 return vres
 */
        if (unlikely(__pyx_v_w == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2959; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_vres->y = (__pyx_v_vres->y / __pyx_v_w);

        /* "cgtypes.pyx":2960
 *                     vres.x = vres.x/w
 *                     vres.y = vres.y/w
 *                     vres.z = vres.z/w             # <<<<<<<<<<<<<<
 *                 return vres
 *             # Scalar on the right?
 */
        if (unlikely(__pyx_v_w == 0)) {
          #ifdef WITH_THREAD
          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
          #endif
          PyErr_SetString(PyExc_ZeroDivisionError, "float division");
          #ifdef WITH_THREAD
          PyGILState_Release(__pyx_gilstate_save);
          #endif
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_vres->z = (__pyx_v_vres->z / __pyx_v_w);
        goto __pyx_L5;
      }
      __pyx_L5:;

      /* "cgtypes.pyx":2961
 *                     vres.y = vres.y/w
 *                     vres.z = vres.z/w
 *                 return vres             # <<<<<<<<<<<<<<
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_vres));
      __pyx_r = ((PyObject *)__pyx_v_vres);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":2963
 *                 return vres
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *                 res = mat4()
 *                 r = b
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __pyx_t_3;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":2964
 *             # Scalar on the right?
 *             elif tb==float or tb==int or tb==long:
 *                 res = mat4()             # <<<<<<<<<<<<<<
 *                 r = b
 *                 res.m11 = ma.m11*r
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":2965
 *             elif tb==float or tb==int or tb==long:
 *                 res = mat4()
 *                 r = b             # <<<<<<<<<<<<<<
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":2966
 *                 res = mat4()
 *                 r = b
 *                 res.m11 = ma.m11*r             # <<<<<<<<<<<<<<
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r
 */
      __pyx_v_res->m11 = (__pyx_v_ma->m11 * __pyx_v_r);

      /* "cgtypes.pyx":2967
 *                 r = b
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r             # <<<<<<<<<<<<<<
 *                 res.m13 = ma.m13*r
 *                 res.m14 = ma.m14*r
 */
      __pyx_v_res->m12 = (__pyx_v_ma->m12 * __pyx_v_r);

      /* "cgtypes.pyx":2968
 *                 res.m11 = ma.m11*r
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r             # <<<<<<<<<<<<<<
 *                 res.m14 = ma.m14*r
 *                 res.m21 = ma.m21*r
 */
      __pyx_v_res->m13 = (__pyx_v_ma->m13 * __pyx_v_r);

      /* "cgtypes.pyx":2969
 *                 res.m12 = ma.m12*r
 *                 res.m13 = ma.m13*r
 *                 res.m14 = ma.m14*r             # <<<<<<<<<<<<<<
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r
 */
      __pyx_v_res->m14 = (__pyx_v_ma->m14 * __pyx_v_r);

      /* "cgtypes.pyx":2970
 *                 res.m13 = ma.m13*r
 *                 res.m14 = ma.m14*r
 *                 res.m21 = ma.m21*r             # <<<<<<<<<<<<<<
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r
 */
      __pyx_v_res->m21 = (__pyx_v_ma->m21 * __pyx_v_r);

      /* "cgtypes.pyx":2971
 *                 res.m14 = ma.m14*r
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r             # <<<<<<<<<<<<<<
 *                 res.m23 = ma.m23*r
 *                 res.m24 = ma.m24*r
 */
      __pyx_v_res->m22 = (__pyx_v_ma->m22 * __pyx_v_r);

      /* "cgtypes.pyx":2972
 *                 res.m21 = ma.m21*r
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r             # <<<<<<<<<<<<<<
 *                 res.m24 = ma.m24*r
 *                 res.m31 = ma.m31*r
 */
      __pyx_v_res->m23 = (__pyx_v_ma->m23 * __pyx_v_r);

      /* "cgtypes.pyx":2973
 *                 res.m22 = ma.m22*r
 *                 res.m23 = ma.m23*r
 *                 res.m24 = ma.m24*r             # <<<<<<<<<<<<<<
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r
 */
      __pyx_v_res->m24 = (__pyx_v_ma->m24 * __pyx_v_r);

      /* "cgtypes.pyx":2974
 *                 res.m23 = ma.m23*r
 *                 res.m24 = ma.m24*r
 *                 res.m31 = ma.m31*r             # <<<<<<<<<<<<<<
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r
 */
      __pyx_v_res->m31 = (__pyx_v_ma->m31 * __pyx_v_r);

      /* "cgtypes.pyx":2975
 *                 res.m24 = ma.m24*r
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r             # <<<<<<<<<<<<<<
 *                 res.m33 = ma.m33*r
 *                 res.m34 = ma.m34*r
 */
      __pyx_v_res->m32 = (__pyx_v_ma->m32 * __pyx_v_r);

      /* "cgtypes.pyx":2976
 *                 res.m31 = ma.m31*r
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r             # <<<<<<<<<<<<<<
 *                 res.m34 = ma.m34*r
 *                 res.m41 = ma.m41*r
 */
      __pyx_v_res->m33 = (__pyx_v_ma->m33 * __pyx_v_r);

      /* "cgtypes.pyx":2977
 *                 res.m32 = ma.m32*r
 *                 res.m33 = ma.m33*r
 *                 res.m34 = ma.m34*r             # <<<<<<<<<<<<<<
 *                 res.m41 = ma.m41*r
 *                 res.m42 = ma.m42*r
 */
      __pyx_v_res->m34 = (__pyx_v_ma->m34 * __pyx_v_r);

      /* "cgtypes.pyx":2978
 *                 res.m33 = ma.m33*r
 *                 res.m34 = ma.m34*r
 *                 res.m41 = ma.m41*r             # <<<<<<<<<<<<<<
 *                 res.m42 = ma.m42*r
 *                 res.m43 = ma.m43*r
 */
      __pyx_v_res->m41 = (__pyx_v_ma->m41 * __pyx_v_r);

      /* "cgtypes.pyx":2979
 *                 res.m34 = ma.m34*r
 *                 res.m41 = ma.m41*r
 *                 res.m42 = ma.m42*r             # <<<<<<<<<<<<<<
 *                 res.m43 = ma.m43*r
 *                 res.m44 = ma.m44*r
 */
      __pyx_v_res->m42 = (__pyx_v_ma->m42 * __pyx_v_r);

      /* "cgtypes.pyx":2980
 *                 res.m41 = ma.m41*r
 *                 res.m42 = ma.m42*r
 *                 res.m43 = ma.m43*r             # <<<<<<<<<<<<<<
 *                 res.m44 = ma.m44*r
 *                 return res
 */
      __pyx_v_res->m43 = (__pyx_v_ma->m43 * __pyx_v_r);

      /* "cgtypes.pyx":2981
 *                 res.m42 = ma.m42*r
 *                 res.m43 = ma.m43*r
 *                 res.m44 = ma.m44*r             # <<<<<<<<<<<<<<
 *                 return res
 * 
 */
      __pyx_v_res->m44 = (__pyx_v_ma->m44 * __pyx_v_r);

      /* "cgtypes.pyx":2982
 *                 res.m43 = ma.m43*r
 *                 res.m44 = ma.m44*r
 *                 return res             # <<<<<<<<<<<<<<
 * 
 *         # vec4 on the left? (then there must be a mat4 on the right)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":2985
 * 
 *         # vec4 on the left? (then there must be a mat4 on the right)
 *         elif ta==vec4:             # <<<<<<<<<<<<<<
 *             # vec4*mat4
 *             wres = vec4()
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":2987
 *         elif ta==vec4:
 *             # vec4*mat4
 *             wres = vec4()             # <<<<<<<<<<<<<<
 *             wa   = a
 *             mb   = b
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_wres = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":2988
 *             # vec4*mat4
 *             wres = vec4()
 *             wa   = a             # <<<<<<<<<<<<<<
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31 + wa.w*mb.m41
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_wa = ((struct __pyx_obj_7cgtypes_vec4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":2989
 *             wres = vec4()
 *             wa   = a
 *             mb   = b             # <<<<<<<<<<<<<<
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31 + wa.w*mb.m41
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32 + wa.w*mb.m42
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":2990
 *             wa   = a
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31 + wa.w*mb.m41             # <<<<<<<<<<<<<<
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32 + wa.w*mb.m42
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33 + wa.w*mb.m43
 */
    __pyx_v_wres->x = ((((__pyx_v_wa->x * __pyx_v_mb->m11) + (__pyx_v_wa->y * __pyx_v_mb->m21)) + (__pyx_v_wa->z * __pyx_v_mb->m31)) + (__pyx_v_wa->w * __pyx_v_mb->m41));

    /* "cgtypes.pyx":2991
 *             mb   = b
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31 + wa.w*mb.m41
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32 + wa.w*mb.m42             # <<<<<<<<<<<<<<
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33 + wa.w*mb.m43
 *             wres.w = wa.x*mb.m14 + wa.y*mb.m24 + wa.z*mb.m34 + wa.w*mb.m44
 */
    __pyx_v_wres->y = ((((__pyx_v_wa->x * __pyx_v_mb->m12) + (__pyx_v_wa->y * __pyx_v_mb->m22)) + (__pyx_v_wa->z * __pyx_v_mb->m32)) + (__pyx_v_wa->w * __pyx_v_mb->m42));

    /* "cgtypes.pyx":2992
 *             wres.x = wa.x*mb.m11 + wa.y*mb.m21 + wa.z*mb.m31 + wa.w*mb.m41
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32 + wa.w*mb.m42
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33 + wa.w*mb.m43             # <<<<<<<<<<<<<<
 *             wres.w = wa.x*mb.m14 + wa.y*mb.m24 + wa.z*mb.m34 + wa.w*mb.m44
 *             return wres
 */
    __pyx_v_wres->z = ((((__pyx_v_wa->x * __pyx_v_mb->m13) + (__pyx_v_wa->y * __pyx_v_mb->m23)) + (__pyx_v_wa->z * __pyx_v_mb->m33)) + (__pyx_v_wa->w * __pyx_v_mb->m43));

    /* "cgtypes.pyx":2993
 *             wres.y = wa.x*mb.m12 + wa.y*mb.m22 + wa.z*mb.m32 + wa.w*mb.m42
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33 + wa.w*mb.m43
 *             wres.w = wa.x*mb.m14 + wa.y*mb.m24 + wa.z*mb.m34 + wa.w*mb.m44             # <<<<<<<<<<<<<<
 *             return wres
 * 
 */
    __pyx_v_wres->w = ((((__pyx_v_wa->x * __pyx_v_mb->m14) + (__pyx_v_wa->y * __pyx_v_mb->m24)) + (__pyx_v_wa->z * __pyx_v_mb->m34)) + (__pyx_v_wa->w * __pyx_v_mb->m44));

    /* "cgtypes.pyx":2994
 *             wres.z = wa.x*mb.m13 + wa.y*mb.m23 + wa.z*mb.m33 + wa.w*mb.m43
 *             wres.w = wa.x*mb.m14 + wa.y*mb.m24 + wa.z*mb.m34 + wa.w*mb.m44
 *             return wres             # <<<<<<<<<<<<<<
 * 
 *         # vec3 on the left? (then there must be a mat4 on the right)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_wres));
    __pyx_r = ((PyObject *)__pyx_v_wres);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":2997
 * 
 *         # vec3 on the left? (then there must be a mat4 on the right)
 *         elif ta==vec3:             # <<<<<<<<<<<<<<
 *             # vec3*mat4
 *             vres = vec3()
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":2999
 *         elif ta==vec3:
 *             # vec3*mat4
 *             vres = vec3()             # <<<<<<<<<<<<<<
 *             va   = a
 *             mb   = b
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_vres = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":3000
 *             # vec3*mat4
 *             vres = vec3()
 *             va   = a             # <<<<<<<<<<<<<<
 *             mb   = b
 *             vres.x = va.x*mb.m11 + va.y*mb.m21 + va.z*mb.m31 + mb.m41
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_va = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":3001
 *             vres = vec3()
 *             va   = a
 *             mb   = b             # <<<<<<<<<<<<<<
 *             vres.x = va.x*mb.m11 + va.y*mb.m21 + va.z*mb.m31 + mb.m41
 *             vres.y = va.x*mb.m12 + va.y*mb.m22 + va.z*mb.m32 + mb.m42
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":3002
 *             va   = a
 *             mb   = b
 *             vres.x = va.x*mb.m11 + va.y*mb.m21 + va.z*mb.m31 + mb.m41             # <<<<<<<<<<<<<<
 *             vres.y = va.x*mb.m12 + va.y*mb.m22 + va.z*mb.m32 + mb.m42
 *             vres.z = va.x*mb.m13 + va.y*mb.m23 + va.z*mb.m33 + mb.m43
 */
    __pyx_v_vres->x = ((((__pyx_v_va->x * __pyx_v_mb->m11) + (__pyx_v_va->y * __pyx_v_mb->m21)) + (__pyx_v_va->z * __pyx_v_mb->m31)) + __pyx_v_mb->m41);

    /* "cgtypes.pyx":3003
 *             mb   = b
 *             vres.x = va.x*mb.m11 + va.y*mb.m21 + va.z*mb.m31 + mb.m41
 *             vres.y = va.x*mb.m12 + va.y*mb.m22 + va.z*mb.m32 + mb.m42             # <<<<<<<<<<<<<<
 *             vres.z = va.x*mb.m13 + va.y*mb.m23 + va.z*mb.m33 + mb.m43
 *             w = va.x*mb.m14 + va.y*mb.m24 + va.z*mb.m34 + mb.m44
 */
    __pyx_v_vres->y = ((((__pyx_v_va->x * __pyx_v_mb->m12) + (__pyx_v_va->y * __pyx_v_mb->m22)) + (__pyx_v_va->z * __pyx_v_mb->m32)) + __pyx_v_mb->m42);

    /* "cgtypes.pyx":3004
 *             vres.x = va.x*mb.m11 + va.y*mb.m21 + va.z*mb.m31 + mb.m41
 *             vres.y = va.x*mb.m12 + va.y*mb.m22 + va.z*mb.m32 + mb.m42
 *             vres.z = va.x*mb.m13 + va.y*mb.m23 + va.z*mb.m33 + mb.m43             # <<<<<<<<<<<<<<
 *             w = va.x*mb.m14 + va.y*mb.m24 + va.z*mb.m34 + mb.m44
 *             if fabs(w)>eps:
 */
    __pyx_v_vres->z = ((((__pyx_v_va->x * __pyx_v_mb->m13) + (__pyx_v_va->y * __pyx_v_mb->m23)) + (__pyx_v_va->z * __pyx_v_mb->m33)) + __pyx_v_mb->m43);

    /* "cgtypes.pyx":3005
 *             vres.y = va.x*mb.m12 + va.y*mb.m22 + va.z*mb.m32 + mb.m42
 *             vres.z = va.x*mb.m13 + va.y*mb.m23 + va.z*mb.m33 + mb.m43
 *             w = va.x*mb.m14 + va.y*mb.m24 + va.z*mb.m34 + mb.m44             # <<<<<<<<<<<<<<
 *             if fabs(w)>eps:
 *                 vres.x = vres.x/w
 */
    __pyx_v_w = ((((__pyx_v_va->x * __pyx_v_mb->m14) + (__pyx_v_va->y * __pyx_v_mb->m24)) + (__pyx_v_va->z * __pyx_v_mb->m34)) + __pyx_v_mb->m44);

    /* "cgtypes.pyx":3006
 *             vres.z = va.x*mb.m13 + va.y*mb.m23 + va.z*mb.m33 + mb.m43
 *             w = va.x*mb.m14 + va.y*mb.m24 + va.z*mb.m34 + mb.m44
 *             if fabs(w)>eps:             # <<<<<<<<<<<<<<
 *                 vres.x = vres.x/w
 *                 vres.y = vres.y/w
 */
    __pyx_t_2 = ((fabs(__pyx_v_w) > __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":3007
 *             w = va.x*mb.m14 + va.y*mb.m24 + va.z*mb.m34 + mb.m44
 *             if fabs(w)>eps:
 *                 vres.x = vres.x/w             # <<<<<<<<<<<<<<
 *                 vres.y = vres.y/w
 *                 vres.z = vres.z/w
 */
      if (unlikely(__pyx_v_w == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_vres->x = (__pyx_v_vres->x / __pyx_v_w);

      /* "cgtypes.pyx":3008
 *             if fabs(w)>eps:
 *                 vres.x = vres.x/w
 *                 vres.y = vres.y/w             # <<<<<<<<<<<<<<
 *                 vres.z = vres.z/w
 *             return vres
 */
      if (unlikely(__pyx_v_w == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_vres->y = (__pyx_v_vres->y / __pyx_v_w);

      /* "cgtypes.pyx":3009
 *                 vres.x = vres.x/w
 *                 vres.y = vres.y/w
 *                 vres.z = vres.z/w             # <<<<<<<<<<<<<<
 *             return vres
 * 
 */
      if (unlikely(__pyx_v_w == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_vres->z = (__pyx_v_vres->z / __pyx_v_w);
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "cgtypes.pyx":3010
 *                 vres.y = vres.y/w
 *                 vres.z = vres.z/w
 *             return vres             # <<<<<<<<<<<<<<
 * 
 *         # Scalar on the left? (then there must be a mat4 on the right)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_vres));
    __pyx_r = ((PyObject *)__pyx_v_vres);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":3013
 * 
 *         # Scalar on the left? (then there must be a mat4 on the right)
 *         elif ta==float or ta==int or ta==long:             # <<<<<<<<<<<<<<
 *             res = mat4()
 *             r  = a
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":3014
 *         # Scalar on the left? (then there must be a mat4 on the right)
 *         elif ta==float or ta==int or ta==long:
 *             res = mat4()             # <<<<<<<<<<<<<<
 *             r  = a
 *             mb = b
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":3015
 *         elif ta==float or ta==int or ta==long:
 *             res = mat4()
 *             r  = a             # <<<<<<<<<<<<<<
 *             mb = b
 *             res.m11 = r*mb.m11
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_a); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":3016
 *             res = mat4()
 *             r  = a
 *             mb = b             # <<<<<<<<<<<<<<
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":3017
 *             r  = a
 *             mb = b
 *             res.m11 = r*mb.m11             # <<<<<<<<<<<<<<
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13
 */
    __pyx_v_res->m11 = (__pyx_v_r * __pyx_v_mb->m11);

    /* "cgtypes.pyx":3018
 *             mb = b
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12             # <<<<<<<<<<<<<<
 *             res.m13 = r*mb.m13
 *             res.m14 = r*mb.m14
 */
    __pyx_v_res->m12 = (__pyx_v_r * __pyx_v_mb->m12);

    /* "cgtypes.pyx":3019
 *             res.m11 = r*mb.m11
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13             # <<<<<<<<<<<<<<
 *             res.m14 = r*mb.m14
 *             res.m21 = r*mb.m21
 */
    __pyx_v_res->m13 = (__pyx_v_r * __pyx_v_mb->m13);

    /* "cgtypes.pyx":3020
 *             res.m12 = r*mb.m12
 *             res.m13 = r*mb.m13
 *             res.m14 = r*mb.m14             # <<<<<<<<<<<<<<
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22
 */
    __pyx_v_res->m14 = (__pyx_v_r * __pyx_v_mb->m14);

    /* "cgtypes.pyx":3021
 *             res.m13 = r*mb.m13
 *             res.m14 = r*mb.m14
 *             res.m21 = r*mb.m21             # <<<<<<<<<<<<<<
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23
 */
    __pyx_v_res->m21 = (__pyx_v_r * __pyx_v_mb->m21);

    /* "cgtypes.pyx":3022
 *             res.m14 = r*mb.m14
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22             # <<<<<<<<<<<<<<
 *             res.m23 = r*mb.m23
 *             res.m24 = r*mb.m24
 */
    __pyx_v_res->m22 = (__pyx_v_r * __pyx_v_mb->m22);

    /* "cgtypes.pyx":3023
 *             res.m21 = r*mb.m21
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23             # <<<<<<<<<<<<<<
 *             res.m24 = r*mb.m24
 *             res.m31 = r*mb.m31
 */
    __pyx_v_res->m23 = (__pyx_v_r * __pyx_v_mb->m23);

    /* "cgtypes.pyx":3024
 *             res.m22 = r*mb.m22
 *             res.m23 = r*mb.m23
 *             res.m24 = r*mb.m24             # <<<<<<<<<<<<<<
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32
 */
    __pyx_v_res->m24 = (__pyx_v_r * __pyx_v_mb->m24);

    /* "cgtypes.pyx":3025
 *             res.m23 = r*mb.m23
 *             res.m24 = r*mb.m24
 *             res.m31 = r*mb.m31             # <<<<<<<<<<<<<<
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33
 */
    __pyx_v_res->m31 = (__pyx_v_r * __pyx_v_mb->m31);

    /* "cgtypes.pyx":3026
 *             res.m24 = r*mb.m24
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32             # <<<<<<<<<<<<<<
 *             res.m33 = r*mb.m33
 *             res.m34 = r*mb.m34
 */
    __pyx_v_res->m32 = (__pyx_v_r * __pyx_v_mb->m32);

    /* "cgtypes.pyx":3027
 *             res.m31 = r*mb.m31
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33             # <<<<<<<<<<<<<<
 *             res.m34 = r*mb.m34
 *             res.m41 = r*mb.m41
 */
    __pyx_v_res->m33 = (__pyx_v_r * __pyx_v_mb->m33);

    /* "cgtypes.pyx":3028
 *             res.m32 = r*mb.m32
 *             res.m33 = r*mb.m33
 *             res.m34 = r*mb.m34             # <<<<<<<<<<<<<<
 *             res.m41 = r*mb.m41
 *             res.m42 = r*mb.m42
 */
    __pyx_v_res->m34 = (__pyx_v_r * __pyx_v_mb->m34);

    /* "cgtypes.pyx":3029
 *             res.m33 = r*mb.m33
 *             res.m34 = r*mb.m34
 *             res.m41 = r*mb.m41             # <<<<<<<<<<<<<<
 *             res.m42 = r*mb.m42
 *             res.m43 = r*mb.m43
 */
    __pyx_v_res->m41 = (__pyx_v_r * __pyx_v_mb->m41);

    /* "cgtypes.pyx":3030
 *             res.m34 = r*mb.m34
 *             res.m41 = r*mb.m41
 *             res.m42 = r*mb.m42             # <<<<<<<<<<<<<<
 *             res.m43 = r*mb.m43
 *             res.m44 = r*mb.m44
 */
    __pyx_v_res->m42 = (__pyx_v_r * __pyx_v_mb->m42);

    /* "cgtypes.pyx":3031
 *             res.m41 = r*mb.m41
 *             res.m42 = r*mb.m42
 *             res.m43 = r*mb.m43             # <<<<<<<<<<<<<<
 *             res.m44 = r*mb.m44
 *             return res
 */
    __pyx_v_res->m43 = (__pyx_v_r * __pyx_v_mb->m43);

    /* "cgtypes.pyx":3032
 *             res.m42 = r*mb.m42
 *             res.m43 = r*mb.m43
 *             res.m44 = r*mb.m44             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_v_res->m44 = (__pyx_v_r * __pyx_v_mb->m44);

    /* "cgtypes.pyx":3033
 *             res.m43 = r*mb.m43
 *             res.m44 = r*mb.m44
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         # No valid combination found
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":3036
 * 
 *         # No valid combination found
 *         raise TypeError, "unsupported operand type for *"             # <<<<<<<<<<<<<<
 * 
 *     def __div__(mat4 a, b):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":2881
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ma);
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF((PyObject *)__pyx_v_vres);
  __Pyx_XDECREF((PyObject *)__pyx_v_wa);
  __Pyx_XDECREF((PyObject *)__pyx_v_wb);
  __Pyx_XDECREF((PyObject *)__pyx_v_wres);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3038
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(mat4 a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4mat4_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_18__div__[] = "Division.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M/2.0\n        [   0.5000,    1.0000,    1.5000,    2.0000]\n        [   2.5000,    3.0000,    3.5000,    4.0000]\n        [   4.5000,    5.0000,    5.5000,    6.0000]\n        [   6.5000,    7.0000,    7.5000,    8.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_18__div__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_19__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_mat4, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_18__div__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat4_18__div__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cgtypes.pyx":3051
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":3053
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # mat4/scalar
 *             res = mat4()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3055
 *         if tb==float or tb==int or tb==long:
 *             # mat4/scalar
 *             res = mat4()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3056
 *             # mat4/scalar
 *             res = mat4()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":3057
 *             res = mat4()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 division"
 *             res.m11 = a.m11/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3058
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"             # <<<<<<<<<<<<<<
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3059
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"
 *             res.m11 = a.m11/r             # <<<<<<<<<<<<<<
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m11 = (__pyx_v_a->m11 / __pyx_v_r);

    /* "cgtypes.pyx":3060
 *                 raise ZeroDivisionError,"mat4 division"
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r             # <<<<<<<<<<<<<<
 *             res.m13 = a.m13/r
 *             res.m14 = a.m14/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m12 = (__pyx_v_a->m12 / __pyx_v_r);

    /* "cgtypes.pyx":3061
 *             res.m11 = a.m11/r
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r             # <<<<<<<<<<<<<<
 *             res.m14 = a.m14/r
 *             res.m21 = a.m21/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m13 = (__pyx_v_a->m13 / __pyx_v_r);

    /* "cgtypes.pyx":3062
 *             res.m12 = a.m12/r
 *             res.m13 = a.m13/r
 *             res.m14 = a.m14/r             # <<<<<<<<<<<<<<
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m14 = (__pyx_v_a->m14 / __pyx_v_r);

    /* "cgtypes.pyx":3063
 *             res.m13 = a.m13/r
 *             res.m14 = a.m14/r
 *             res.m21 = a.m21/r             # <<<<<<<<<<<<<<
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m21 = (__pyx_v_a->m21 / __pyx_v_r);

    /* "cgtypes.pyx":3064
 *             res.m14 = a.m14/r
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r             # <<<<<<<<<<<<<<
 *             res.m23 = a.m23/r
 *             res.m24 = a.m24/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m22 = (__pyx_v_a->m22 / __pyx_v_r);

    /* "cgtypes.pyx":3065
 *             res.m21 = a.m21/r
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r             # <<<<<<<<<<<<<<
 *             res.m24 = a.m24/r
 *             res.m31 = a.m31/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m23 = (__pyx_v_a->m23 / __pyx_v_r);

    /* "cgtypes.pyx":3066
 *             res.m22 = a.m22/r
 *             res.m23 = a.m23/r
 *             res.m24 = a.m24/r             # <<<<<<<<<<<<<<
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m24 = (__pyx_v_a->m24 / __pyx_v_r);

    /* "cgtypes.pyx":3067
 *             res.m23 = a.m23/r
 *             res.m24 = a.m24/r
 *             res.m31 = a.m31/r             # <<<<<<<<<<<<<<
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m31 = (__pyx_v_a->m31 / __pyx_v_r);

    /* "cgtypes.pyx":3068
 *             res.m24 = a.m24/r
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r             # <<<<<<<<<<<<<<
 *             res.m33 = a.m33/r
 *             res.m34 = a.m34/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m32 = (__pyx_v_a->m32 / __pyx_v_r);

    /* "cgtypes.pyx":3069
 *             res.m31 = a.m31/r
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r             # <<<<<<<<<<<<<<
 *             res.m34 = a.m34/r
 *             res.m41 = a.m41/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m33 = (__pyx_v_a->m33 / __pyx_v_r);

    /* "cgtypes.pyx":3070
 *             res.m32 = a.m32/r
 *             res.m33 = a.m33/r
 *             res.m34 = a.m34/r             # <<<<<<<<<<<<<<
 *             res.m41 = a.m41/r
 *             res.m42 = a.m42/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m34 = (__pyx_v_a->m34 / __pyx_v_r);

    /* "cgtypes.pyx":3071
 *             res.m33 = a.m33/r
 *             res.m34 = a.m34/r
 *             res.m41 = a.m41/r             # <<<<<<<<<<<<<<
 *             res.m42 = a.m42/r
 *             res.m43 = a.m43/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m41 = (__pyx_v_a->m41 / __pyx_v_r);

    /* "cgtypes.pyx":3072
 *             res.m34 = a.m34/r
 *             res.m41 = a.m41/r
 *             res.m42 = a.m42/r             # <<<<<<<<<<<<<<
 *             res.m43 = a.m43/r
 *             res.m44 = a.m44/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m42 = (__pyx_v_a->m42 / __pyx_v_r);

    /* "cgtypes.pyx":3073
 *             res.m41 = a.m41/r
 *             res.m42 = a.m42/r
 *             res.m43 = a.m43/r             # <<<<<<<<<<<<<<
 *             res.m44 = a.m44/r
 *             return res
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m43 = (__pyx_v_a->m43 / __pyx_v_r);

    /* "cgtypes.pyx":3074
 *             res.m42 = a.m42/r
 *             res.m43 = a.m43/r
 *             res.m44 = a.m44/r             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->m44 = (__pyx_v_a->m44 / __pyx_v_r);

    /* "cgtypes.pyx":3075
 *             res.m43 = a.m43/r
 *             res.m44 = a.m44/r
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3077
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for /"             # <<<<<<<<<<<<<<
 * 
 *     def __mod__(mat4 self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_2, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3038
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(mat4 a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":3079
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(mat4 self, other):             # <<<<<<<<<<<<<<
 *         """Modulo.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_20__mod__[] = "Modulo.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M%5.0\n        [   1.0000,    2.0000,    3.0000,    4.0000]\n        [   0.0000,    1.0000,    2.0000,    3.0000]\n        [   4.0000,    0.0000,    1.0000,    2.0000]\n        [   3.0000,    4.0000,    0.0000,    1.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_20__mod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_21__mod__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mod__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_7cgtypes_mat4, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_20__mod__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_20__mod__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_mb = 0;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mod__", 0);

  /* "cgtypes.pyx":3091
 *         cdef mat4 mb, res
 * 
 *         tb = type(other)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":3093
 *         tb = type(other)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r = other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3094
 * 
 *         if tb==float or tb==int or tb==long:
 *             r = other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"
 */
    __Pyx_INCREF(__pyx_v_other);
    __pyx_v_r = __pyx_v_other;

    /* "cgtypes.pyx":3095
 *         if tb==float or tb==int or tb==long:
 *             r = other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             res = mat4()
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((fabs(__pyx_t_4) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3096
 *             r = other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"             # <<<<<<<<<<<<<<
 *             res = mat4()
 *             res.m11 = _fmod(self.m11, r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3097
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             res = mat4()             # <<<<<<<<<<<<<<
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3098
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             res = mat4()
 *             res.m11 = _fmod(self.m11, r)             # <<<<<<<<<<<<<<
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_t_4);

    /* "cgtypes.pyx":3099
 *             res = mat4()
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)             # <<<<<<<<<<<<<<
 *             res.m13 = _fmod(self.m13, r)
 *             res.m14 = _fmod(self.m14, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_t_4);

    /* "cgtypes.pyx":3100
 *             res.m11 = _fmod(self.m11, r)
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)             # <<<<<<<<<<<<<<
 *             res.m14 = _fmod(self.m14, r)
 *             res.m21 = _fmod(self.m21, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_t_4);

    /* "cgtypes.pyx":3101
 *             res.m12 = _fmod(self.m12, r)
 *             res.m13 = _fmod(self.m13, r)
 *             res.m14 = _fmod(self.m14, r)             # <<<<<<<<<<<<<<
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m14 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m14, __pyx_t_4);

    /* "cgtypes.pyx":3102
 *             res.m13 = _fmod(self.m13, r)
 *             res.m14 = _fmod(self.m14, r)
 *             res.m21 = _fmod(self.m21, r)             # <<<<<<<<<<<<<<
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_t_4);

    /* "cgtypes.pyx":3103
 *             res.m14 = _fmod(self.m14, r)
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)             # <<<<<<<<<<<<<<
 *             res.m23 = _fmod(self.m23, r)
 *             res.m24 = _fmod(self.m24, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_t_4);

    /* "cgtypes.pyx":3104
 *             res.m21 = _fmod(self.m21, r)
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)             # <<<<<<<<<<<<<<
 *             res.m24 = _fmod(self.m24, r)
 *             res.m31 = _fmod(self.m31, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_t_4);

    /* "cgtypes.pyx":3105
 *             res.m22 = _fmod(self.m22, r)
 *             res.m23 = _fmod(self.m23, r)
 *             res.m24 = _fmod(self.m24, r)             # <<<<<<<<<<<<<<
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m24 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m24, __pyx_t_4);

    /* "cgtypes.pyx":3106
 *             res.m23 = _fmod(self.m23, r)
 *             res.m24 = _fmod(self.m24, r)
 *             res.m31 = _fmod(self.m31, r)             # <<<<<<<<<<<<<<
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_t_4);

    /* "cgtypes.pyx":3107
 *             res.m24 = _fmod(self.m24, r)
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)             # <<<<<<<<<<<<<<
 *             res.m33 = _fmod(self.m33, r)
 *             res.m34 = _fmod(self.m34, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_t_4);

    /* "cgtypes.pyx":3108
 *             res.m31 = _fmod(self.m31, r)
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)             # <<<<<<<<<<<<<<
 *             res.m34 = _fmod(self.m34, r)
 *             res.m41 = _fmod(self.m41, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_t_4);

    /* "cgtypes.pyx":3109
 *             res.m32 = _fmod(self.m32, r)
 *             res.m33 = _fmod(self.m33, r)
 *             res.m34 = _fmod(self.m34, r)             # <<<<<<<<<<<<<<
 *             res.m41 = _fmod(self.m41, r)
 *             res.m42 = _fmod(self.m42, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m34 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m34, __pyx_t_4);

    /* "cgtypes.pyx":3110
 *             res.m33 = _fmod(self.m33, r)
 *             res.m34 = _fmod(self.m34, r)
 *             res.m41 = _fmod(self.m41, r)             # <<<<<<<<<<<<<<
 *             res.m42 = _fmod(self.m42, r)
 *             res.m43 = _fmod(self.m43, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m41 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m41, __pyx_t_4);

    /* "cgtypes.pyx":3111
 *             res.m34 = _fmod(self.m34, r)
 *             res.m41 = _fmod(self.m41, r)
 *             res.m42 = _fmod(self.m42, r)             # <<<<<<<<<<<<<<
 *             res.m43 = _fmod(self.m43, r)
 *             res.m44 = _fmod(self.m44, r)
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m42 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m42, __pyx_t_4);

    /* "cgtypes.pyx":3112
 *             res.m41 = _fmod(self.m41, r)
 *             res.m42 = _fmod(self.m42, r)
 *             res.m43 = _fmod(self.m43, r)             # <<<<<<<<<<<<<<
 *             res.m44 = _fmod(self.m44, r)
 *             return res
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m43 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m43, __pyx_t_4);

    /* "cgtypes.pyx":3113
 *             res.m42 = _fmod(self.m42, r)
 *             res.m43 = _fmod(self.m43, r)
 *             res.m44 = _fmod(self.m44, r)             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_res->m44 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m44, __pyx_t_4);

    /* "cgtypes.pyx":3114
 *             res.m43 = _fmod(self.m43, r)
 *             res.m44 = _fmod(self.m44, r)
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         elif tb==mat4:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":3116
 *             return res
 * 
 *         elif tb==mat4:             # <<<<<<<<<<<<<<
 *             mb = other
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3117
 * 
 *         elif tb==mat4:
 *             mb = other             # <<<<<<<<<<<<<<
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3119
 *             mb = other
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m11) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m12) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m13) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3120
 * 
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m14)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m14) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3121
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m21) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m22) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m23) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3122
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m24) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3123
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m31) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m32) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m33) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3124
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m34) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3125
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m44)<=eps):
 *                 raise ZeroDivisionError,"mat4 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m41) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m42) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m43) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3126
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 modulo"
 * 
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m44) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3127
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):
 *                 raise ZeroDivisionError,"mat4 modulo"             # <<<<<<<<<<<<<<
 * 
 *             res=mat4()
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3129
 *                 raise ZeroDivisionError,"mat4 modulo"
 * 
 *             res=mat4()             # <<<<<<<<<<<<<<
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3130
 * 
 *             res=mat4()
 *             res.m11 = _fmod(self.m11, mb.m11)             # <<<<<<<<<<<<<<
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)
 */
    __pyx_v_res->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_mb->m11);

    /* "cgtypes.pyx":3131
 *             res=mat4()
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)             # <<<<<<<<<<<<<<
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m14 = _fmod(self.m14, mb.m14)
 */
    __pyx_v_res->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_mb->m12);

    /* "cgtypes.pyx":3132
 *             res.m11 = _fmod(self.m11, mb.m11)
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)             # <<<<<<<<<<<<<<
 *             res.m14 = _fmod(self.m14, mb.m14)
 *             res.m21 = _fmod(self.m21, mb.m21)
 */
    __pyx_v_res->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_mb->m13);

    /* "cgtypes.pyx":3133
 *             res.m12 = _fmod(self.m12, mb.m12)
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m14 = _fmod(self.m14, mb.m14)             # <<<<<<<<<<<<<<
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)
 */
    __pyx_v_res->m14 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m14, __pyx_v_mb->m14);

    /* "cgtypes.pyx":3134
 *             res.m13 = _fmod(self.m13, mb.m13)
 *             res.m14 = _fmod(self.m14, mb.m14)
 *             res.m21 = _fmod(self.m21, mb.m21)             # <<<<<<<<<<<<<<
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)
 */
    __pyx_v_res->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_mb->m21);

    /* "cgtypes.pyx":3135
 *             res.m14 = _fmod(self.m14, mb.m14)
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)             # <<<<<<<<<<<<<<
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m24 = _fmod(self.m24, mb.m24)
 */
    __pyx_v_res->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_mb->m22);

    /* "cgtypes.pyx":3136
 *             res.m21 = _fmod(self.m21, mb.m21)
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)             # <<<<<<<<<<<<<<
 *             res.m24 = _fmod(self.m24, mb.m24)
 *             res.m31 = _fmod(self.m31, mb.m31)
 */
    __pyx_v_res->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_mb->m23);

    /* "cgtypes.pyx":3137
 *             res.m22 = _fmod(self.m22, mb.m22)
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m24 = _fmod(self.m24, mb.m24)             # <<<<<<<<<<<<<<
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)
 */
    __pyx_v_res->m24 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m24, __pyx_v_mb->m24);

    /* "cgtypes.pyx":3138
 *             res.m23 = _fmod(self.m23, mb.m23)
 *             res.m24 = _fmod(self.m24, mb.m24)
 *             res.m31 = _fmod(self.m31, mb.m31)             # <<<<<<<<<<<<<<
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)
 */
    __pyx_v_res->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_mb->m31);

    /* "cgtypes.pyx":3139
 *             res.m24 = _fmod(self.m24, mb.m24)
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)             # <<<<<<<<<<<<<<
 *             res.m33 = _fmod(self.m33, mb.m33)
 *             res.m34 = _fmod(self.m34, mb.m34)
 */
    __pyx_v_res->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_mb->m32);

    /* "cgtypes.pyx":3140
 *             res.m31 = _fmod(self.m31, mb.m31)
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)             # <<<<<<<<<<<<<<
 *             res.m34 = _fmod(self.m34, mb.m34)
 *             res.m41 = _fmod(self.m41, mb.m41)
 */
    __pyx_v_res->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_mb->m33);

    /* "cgtypes.pyx":3141
 *             res.m32 = _fmod(self.m32, mb.m32)
 *             res.m33 = _fmod(self.m33, mb.m33)
 *             res.m34 = _fmod(self.m34, mb.m34)             # <<<<<<<<<<<<<<
 *             res.m41 = _fmod(self.m41, mb.m41)
 *             res.m42 = _fmod(self.m42, mb.m42)
 */
    __pyx_v_res->m34 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m34, __pyx_v_mb->m34);

    /* "cgtypes.pyx":3142
 *             res.m33 = _fmod(self.m33, mb.m33)
 *             res.m34 = _fmod(self.m34, mb.m34)
 *             res.m41 = _fmod(self.m41, mb.m41)             # <<<<<<<<<<<<<<
 *             res.m42 = _fmod(self.m42, mb.m42)
 *             res.m43 = _fmod(self.m43, mb.m43)
 */
    __pyx_v_res->m41 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m41, __pyx_v_mb->m41);

    /* "cgtypes.pyx":3143
 *             res.m34 = _fmod(self.m34, mb.m34)
 *             res.m41 = _fmod(self.m41, mb.m41)
 *             res.m42 = _fmod(self.m42, mb.m42)             # <<<<<<<<<<<<<<
 *             res.m43 = _fmod(self.m43, mb.m43)
 *             res.m44 = _fmod(self.m44, mb.m44)
 */
    __pyx_v_res->m42 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m42, __pyx_v_mb->m42);

    /* "cgtypes.pyx":3144
 *             res.m41 = _fmod(self.m41, mb.m41)
 *             res.m42 = _fmod(self.m42, mb.m42)
 *             res.m43 = _fmod(self.m43, mb.m43)             # <<<<<<<<<<<<<<
 *             res.m44 = _fmod(self.m44, mb.m44)
 *             return res
 */
    __pyx_v_res->m43 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m43, __pyx_v_mb->m43);

    /* "cgtypes.pyx":3145
 *             res.m42 = _fmod(self.m42, mb.m42)
 *             res.m43 = _fmod(self.m43, mb.m43)
 *             res.m44 = _fmod(self.m44, mb.m44)             # <<<<<<<<<<<<<<
 *             return res
 * 
 */
    __pyx_v_res->m44 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m44, __pyx_v_mb->m44);

    /* "cgtypes.pyx":3146
 *             res.m43 = _fmod(self.m43, mb.m43)
 *             res.m44 = _fmod(self.m44, mb.m44)
 *             return res             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3149
 * 
 *         else:
 *             raise TypeError, "unsupported operand type for %"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_3, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3079
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __mod__(mat4 self, other):             # <<<<<<<<<<<<<<
 *         """Modulo.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3152
 * 
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_23__neg__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_22__neg__[] = "Negation.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print -M\n        [  -1.0000,   -2.0000,   -3.0000,   -4.0000]\n        [  -5.0000,   -6.0000,   -7.0000,   -8.0000]\n        [  -9.0000,  -10.0000,  -11.0000,  -12.0000]\n        [ -13.0000,  -14.0000,  -15.0000,  -16.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_22__neg__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_23__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_22__neg__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_22__neg__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cgtypes.pyx":3163
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3164
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = -self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13
 */
  __pyx_v_res->m11 = (-__pyx_v_self->m11);

  /* "cgtypes.pyx":3165
 *         res = mat4()
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12             # <<<<<<<<<<<<<<
 *         res.m13 = -self.m13
 *         res.m14 = -self.m14
 */
  __pyx_v_res->m12 = (-__pyx_v_self->m12);

  /* "cgtypes.pyx":3166
 *         res.m11 = -self.m11
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13             # <<<<<<<<<<<<<<
 *         res.m14 = -self.m14
 *         res.m21 = -self.m21
 */
  __pyx_v_res->m13 = (-__pyx_v_self->m13);

  /* "cgtypes.pyx":3167
 *         res.m12 = -self.m12
 *         res.m13 = -self.m13
 *         res.m14 = -self.m14             # <<<<<<<<<<<<<<
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22
 */
  __pyx_v_res->m14 = (-__pyx_v_self->m14);

  /* "cgtypes.pyx":3168
 *         res.m13 = -self.m13
 *         res.m14 = -self.m14
 *         res.m21 = -self.m21             # <<<<<<<<<<<<<<
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23
 */
  __pyx_v_res->m21 = (-__pyx_v_self->m21);

  /* "cgtypes.pyx":3169
 *         res.m14 = -self.m14
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = -self.m23
 *         res.m24 = -self.m24
 */
  __pyx_v_res->m22 = (-__pyx_v_self->m22);

  /* "cgtypes.pyx":3170
 *         res.m21 = -self.m21
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23             # <<<<<<<<<<<<<<
 *         res.m24 = -self.m24
 *         res.m31 = -self.m31
 */
  __pyx_v_res->m23 = (-__pyx_v_self->m23);

  /* "cgtypes.pyx":3171
 *         res.m22 = -self.m22
 *         res.m23 = -self.m23
 *         res.m24 = -self.m24             # <<<<<<<<<<<<<<
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32
 */
  __pyx_v_res->m24 = (-__pyx_v_self->m24);

  /* "cgtypes.pyx":3172
 *         res.m23 = -self.m23
 *         res.m24 = -self.m24
 *         res.m31 = -self.m31             # <<<<<<<<<<<<<<
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33
 */
  __pyx_v_res->m31 = (-__pyx_v_self->m31);

  /* "cgtypes.pyx":3173
 *         res.m24 = -self.m24
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32             # <<<<<<<<<<<<<<
 *         res.m33 = -self.m33
 *         res.m34 = -self.m34
 */
  __pyx_v_res->m32 = (-__pyx_v_self->m32);

  /* "cgtypes.pyx":3174
 *         res.m31 = -self.m31
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33             # <<<<<<<<<<<<<<
 *         res.m34 = -self.m34
 *         res.m41 = -self.m41
 */
  __pyx_v_res->m33 = (-__pyx_v_self->m33);

  /* "cgtypes.pyx":3175
 *         res.m32 = -self.m32
 *         res.m33 = -self.m33
 *         res.m34 = -self.m34             # <<<<<<<<<<<<<<
 *         res.m41 = -self.m41
 *         res.m42 = -self.m42
 */
  __pyx_v_res->m34 = (-__pyx_v_self->m34);

  /* "cgtypes.pyx":3176
 *         res.m33 = -self.m33
 *         res.m34 = -self.m34
 *         res.m41 = -self.m41             # <<<<<<<<<<<<<<
 *         res.m42 = -self.m42
 *         res.m43 = -self.m43
 */
  __pyx_v_res->m41 = (-__pyx_v_self->m41);

  /* "cgtypes.pyx":3177
 *         res.m34 = -self.m34
 *         res.m41 = -self.m41
 *         res.m42 = -self.m42             # <<<<<<<<<<<<<<
 *         res.m43 = -self.m43
 *         res.m44 = -self.m44
 */
  __pyx_v_res->m42 = (-__pyx_v_self->m42);

  /* "cgtypes.pyx":3178
 *         res.m41 = -self.m41
 *         res.m42 = -self.m42
 *         res.m43 = -self.m43             # <<<<<<<<<<<<<<
 *         res.m44 = -self.m44
 *         return res
 */
  __pyx_v_res->m43 = (-__pyx_v_self->m43);

  /* "cgtypes.pyx":3179
 *         res.m42 = -self.m42
 *         res.m43 = -self.m43
 *         res.m44 = -self.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = (-__pyx_v_self->m44);

  /* "cgtypes.pyx":3180
 *         res.m43 = -self.m43
 *         res.m44 = -self.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3152
 * 
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3182
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_25__pos__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_24__pos__[] = "\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print +M\n        [   1.0000,    2.0000,    3.0000,    4.0000]\n        [   5.0000,    6.0000,    7.0000,    8.0000]\n        [   9.0000,   10.0000,   11.0000,   12.0000]\n        [  13.0000,   14.0000,   15.0000,   16.0000]\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_24__pos__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_25__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_24__pos__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_24__pos__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "cgtypes.pyx":3192
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3193
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 */
  __pyx_t_2 = __pyx_v_self->m11;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":3194
 *         res = mat4()
 *         res.m11 = self.m11
 *         res.m12 = self.m12             # <<<<<<<<<<<<<<
 *         res.m13 = self.m13
 *         res.m14 = self.m14
 */
  __pyx_t_2 = __pyx_v_self->m12;
  __pyx_v_res->m12 = __pyx_t_2;

  /* "cgtypes.pyx":3195
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 *         res.m13 = self.m13             # <<<<<<<<<<<<<<
 *         res.m14 = self.m14
 *         res.m21 = self.m21
 */
  __pyx_t_2 = __pyx_v_self->m13;
  __pyx_v_res->m13 = __pyx_t_2;

  /* "cgtypes.pyx":3196
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 *         res.m14 = self.m14             # <<<<<<<<<<<<<<
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 */
  __pyx_t_2 = __pyx_v_self->m14;
  __pyx_v_res->m14 = __pyx_t_2;

  /* "cgtypes.pyx":3197
 *         res.m13 = self.m13
 *         res.m14 = self.m14
 *         res.m21 = self.m21             # <<<<<<<<<<<<<<
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 */
  __pyx_t_2 = __pyx_v_self->m21;
  __pyx_v_res->m21 = __pyx_t_2;

  /* "cgtypes.pyx":3198
 *         res.m14 = self.m14
 *         res.m21 = self.m21
 *         res.m22 = self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = self.m23
 *         res.m24 = self.m24
 */
  __pyx_t_2 = __pyx_v_self->m22;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":3199
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 *         res.m23 = self.m23             # <<<<<<<<<<<<<<
 *         res.m24 = self.m24
 *         res.m31 = self.m31
 */
  __pyx_t_2 = __pyx_v_self->m23;
  __pyx_v_res->m23 = __pyx_t_2;

  /* "cgtypes.pyx":3200
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 *         res.m24 = self.m24             # <<<<<<<<<<<<<<
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 */
  __pyx_t_2 = __pyx_v_self->m24;
  __pyx_v_res->m24 = __pyx_t_2;

  /* "cgtypes.pyx":3201
 *         res.m23 = self.m23
 *         res.m24 = self.m24
 *         res.m31 = self.m31             # <<<<<<<<<<<<<<
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 */
  __pyx_t_2 = __pyx_v_self->m31;
  __pyx_v_res->m31 = __pyx_t_2;

  /* "cgtypes.pyx":3202
 *         res.m24 = self.m24
 *         res.m31 = self.m31
 *         res.m32 = self.m32             # <<<<<<<<<<<<<<
 *         res.m33 = self.m33
 *         res.m34 = self.m34
 */
  __pyx_t_2 = __pyx_v_self->m32;
  __pyx_v_res->m32 = __pyx_t_2;

  /* "cgtypes.pyx":3203
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 *         res.m33 = self.m33             # <<<<<<<<<<<<<<
 *         res.m34 = self.m34
 *         res.m41 = self.m41
 */
  __pyx_t_2 = __pyx_v_self->m33;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":3204
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 *         res.m34 = self.m34             # <<<<<<<<<<<<<<
 *         res.m41 = self.m41
 *         res.m42 = self.m42
 */
  __pyx_t_2 = __pyx_v_self->m34;
  __pyx_v_res->m34 = __pyx_t_2;

  /* "cgtypes.pyx":3205
 *         res.m33 = self.m33
 *         res.m34 = self.m34
 *         res.m41 = self.m41             # <<<<<<<<<<<<<<
 *         res.m42 = self.m42
 *         res.m43 = self.m43
 */
  __pyx_t_2 = __pyx_v_self->m41;
  __pyx_v_res->m41 = __pyx_t_2;

  /* "cgtypes.pyx":3206
 *         res.m34 = self.m34
 *         res.m41 = self.m41
 *         res.m42 = self.m42             # <<<<<<<<<<<<<<
 *         res.m43 = self.m43
 *         res.m44 = self.m44
 */
  __pyx_t_2 = __pyx_v_self->m42;
  __pyx_v_res->m42 = __pyx_t_2;

  /* "cgtypes.pyx":3207
 *         res.m41 = self.m41
 *         res.m42 = self.m42
 *         res.m43 = self.m43             # <<<<<<<<<<<<<<
 *         res.m44 = self.m44
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->m43;
  __pyx_v_res->m43 = __pyx_t_2;

  /* "cgtypes.pyx":3208
 *         res.m42 = self.m42
 *         res.m43 = self.m43
 *         res.m44 = self.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->m44;
  __pyx_v_res->m44 = __pyx_t_2;

  /* "cgtypes.pyx":3209
 *         res.m43 = self.m43
 *         res.m44 = self.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __iadd__(self, mat4 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3182
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3211
 *         return res
 * 
 *     def __iadd__(self, mat4 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix addition.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_26__iadd__[] = "Inline matrix addition.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_26__iadd__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_27__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_mat4, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_26__iadd__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_26__iadd__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "cgtypes.pyx":3214
 *         """Inline matrix addition.
 *         """
 *         self.m11 = self.m11 + other.m11             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 + __pyx_v_other->m11);

  /* "cgtypes.pyx":3215
 *         """
 *         self.m11 = self.m11 + other.m11
 *         self.m12 = self.m12 + other.m12             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13 + other.m13
 *         self.m14 = self.m14 + other.m14
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 + __pyx_v_other->m12);

  /* "cgtypes.pyx":3216
 *         self.m11 = self.m11 + other.m11
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13             # <<<<<<<<<<<<<<
 *         self.m14 = self.m14 + other.m14
 *         self.m21 = self.m21 + other.m21
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 + __pyx_v_other->m13);

  /* "cgtypes.pyx":3217
 *         self.m12 = self.m12 + other.m12
 *         self.m13 = self.m13 + other.m13
 *         self.m14 = self.m14 + other.m14             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22
 */
  __pyx_v_self->m14 = (__pyx_v_self->m14 + __pyx_v_other->m14);

  /* "cgtypes.pyx":3218
 *         self.m13 = self.m13 + other.m13
 *         self.m14 = self.m14 + other.m14
 *         self.m21 = self.m21 + other.m21             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 + __pyx_v_other->m21);

  /* "cgtypes.pyx":3219
 *         self.m14 = self.m14 + other.m14
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23 + other.m23
 *         self.m24 = self.m24 + other.m24
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 + __pyx_v_other->m22);

  /* "cgtypes.pyx":3220
 *         self.m21 = self.m21 + other.m21
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23             # <<<<<<<<<<<<<<
 *         self.m24 = self.m24 + other.m24
 *         self.m31 = self.m31 + other.m31
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 + __pyx_v_other->m23);

  /* "cgtypes.pyx":3221
 *         self.m22 = self.m22 + other.m22
 *         self.m23 = self.m23 + other.m23
 *         self.m24 = self.m24 + other.m24             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32
 */
  __pyx_v_self->m24 = (__pyx_v_self->m24 + __pyx_v_other->m24);

  /* "cgtypes.pyx":3222
 *         self.m23 = self.m23 + other.m23
 *         self.m24 = self.m24 + other.m24
 *         self.m31 = self.m31 + other.m31             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 + __pyx_v_other->m31);

  /* "cgtypes.pyx":3223
 *         self.m24 = self.m24 + other.m24
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33 + other.m33
 *         self.m34 = self.m34 + other.m34
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 + __pyx_v_other->m32);

  /* "cgtypes.pyx":3224
 *         self.m31 = self.m31 + other.m31
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33             # <<<<<<<<<<<<<<
 *         self.m34 = self.m34 + other.m34
 *         self.m41 = self.m41 + other.m41
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 + __pyx_v_other->m33);

  /* "cgtypes.pyx":3225
 *         self.m32 = self.m32 + other.m32
 *         self.m33 = self.m33 + other.m33
 *         self.m34 = self.m34 + other.m34             # <<<<<<<<<<<<<<
 *         self.m41 = self.m41 + other.m41
 *         self.m42 = self.m42 + other.m42
 */
  __pyx_v_self->m34 = (__pyx_v_self->m34 + __pyx_v_other->m34);

  /* "cgtypes.pyx":3226
 *         self.m33 = self.m33 + other.m33
 *         self.m34 = self.m34 + other.m34
 *         self.m41 = self.m41 + other.m41             # <<<<<<<<<<<<<<
 *         self.m42 = self.m42 + other.m42
 *         self.m43 = self.m43 + other.m43
 */
  __pyx_v_self->m41 = (__pyx_v_self->m41 + __pyx_v_other->m41);

  /* "cgtypes.pyx":3227
 *         self.m34 = self.m34 + other.m34
 *         self.m41 = self.m41 + other.m41
 *         self.m42 = self.m42 + other.m42             # <<<<<<<<<<<<<<
 *         self.m43 = self.m43 + other.m43
 *         self.m44 = self.m44 + other.m44
 */
  __pyx_v_self->m42 = (__pyx_v_self->m42 + __pyx_v_other->m42);

  /* "cgtypes.pyx":3228
 *         self.m41 = self.m41 + other.m41
 *         self.m42 = self.m42 + other.m42
 *         self.m43 = self.m43 + other.m43             # <<<<<<<<<<<<<<
 *         self.m44 = self.m44 + other.m44
 *         return self
 */
  __pyx_v_self->m43 = (__pyx_v_self->m43 + __pyx_v_other->m43);

  /* "cgtypes.pyx":3229
 *         self.m42 = self.m42 + other.m42
 *         self.m43 = self.m43 + other.m43
 *         self.m44 = self.m44 + other.m44             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m44 = (__pyx_v_self->m44 + __pyx_v_other->m44);

  /* "cgtypes.pyx":3230
 *         self.m43 = self.m43 + other.m43
 *         self.m44 = self.m44 + other.m44
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, mat4 other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":3211
 *         return res
 * 
 *     def __iadd__(self, mat4 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix addition.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3232
 *         return self
 * 
 *     def __isub__(self, mat4 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix subtraction.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_28__isub__[] = "Inline matrix subtraction.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_28__isub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_29__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_mat4, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_28__isub__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_28__isub__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat4 *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "cgtypes.pyx":3235
 *         """Inline matrix subtraction.
 *         """
 *         self.m11 = self.m11 - other.m11             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 - __pyx_v_other->m11);

  /* "cgtypes.pyx":3236
 *         """
 *         self.m11 = self.m11 - other.m11
 *         self.m12 = self.m12 - other.m12             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13 - other.m13
 *         self.m14 = self.m14 - other.m14
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 - __pyx_v_other->m12);

  /* "cgtypes.pyx":3237
 *         self.m11 = self.m11 - other.m11
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13             # <<<<<<<<<<<<<<
 *         self.m14 = self.m14 - other.m14
 *         self.m21 = self.m21 - other.m21
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 - __pyx_v_other->m13);

  /* "cgtypes.pyx":3238
 *         self.m12 = self.m12 - other.m12
 *         self.m13 = self.m13 - other.m13
 *         self.m14 = self.m14 - other.m14             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22
 */
  __pyx_v_self->m14 = (__pyx_v_self->m14 - __pyx_v_other->m14);

  /* "cgtypes.pyx":3239
 *         self.m13 = self.m13 - other.m13
 *         self.m14 = self.m14 - other.m14
 *         self.m21 = self.m21 - other.m21             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 - __pyx_v_other->m21);

  /* "cgtypes.pyx":3240
 *         self.m14 = self.m14 - other.m14
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23 - other.m23
 *         self.m24 = self.m24 - other.m24
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 - __pyx_v_other->m22);

  /* "cgtypes.pyx":3241
 *         self.m21 = self.m21 - other.m21
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23             # <<<<<<<<<<<<<<
 *         self.m24 = self.m24 - other.m24
 *         self.m31 = self.m31 - other.m31
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 - __pyx_v_other->m23);

  /* "cgtypes.pyx":3242
 *         self.m22 = self.m22 - other.m22
 *         self.m23 = self.m23 - other.m23
 *         self.m24 = self.m24 - other.m24             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32
 */
  __pyx_v_self->m24 = (__pyx_v_self->m24 - __pyx_v_other->m24);

  /* "cgtypes.pyx":3243
 *         self.m23 = self.m23 - other.m23
 *         self.m24 = self.m24 - other.m24
 *         self.m31 = self.m31 - other.m31             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 - __pyx_v_other->m31);

  /* "cgtypes.pyx":3244
 *         self.m24 = self.m24 - other.m24
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33 - other.m33
 *         self.m34 = self.m34 - other.m34
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 - __pyx_v_other->m32);

  /* "cgtypes.pyx":3245
 *         self.m31 = self.m31 - other.m31
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33             # <<<<<<<<<<<<<<
 *         self.m34 = self.m34 - other.m34
 *         self.m41 = self.m41 - other.m41
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 - __pyx_v_other->m33);

  /* "cgtypes.pyx":3246
 *         self.m32 = self.m32 - other.m32
 *         self.m33 = self.m33 - other.m33
 *         self.m34 = self.m34 - other.m34             # <<<<<<<<<<<<<<
 *         self.m41 = self.m41 - other.m41
 *         self.m42 = self.m42 - other.m42
 */
  __pyx_v_self->m34 = (__pyx_v_self->m34 - __pyx_v_other->m34);

  /* "cgtypes.pyx":3247
 *         self.m33 = self.m33 - other.m33
 *         self.m34 = self.m34 - other.m34
 *         self.m41 = self.m41 - other.m41             # <<<<<<<<<<<<<<
 *         self.m42 = self.m42 - other.m42
 *         self.m43 = self.m43 - other.m43
 */
  __pyx_v_self->m41 = (__pyx_v_self->m41 - __pyx_v_other->m41);

  /* "cgtypes.pyx":3248
 *         self.m34 = self.m34 - other.m34
 *         self.m41 = self.m41 - other.m41
 *         self.m42 = self.m42 - other.m42             # <<<<<<<<<<<<<<
 *         self.m43 = self.m43 - other.m43
 *         self.m44 = self.m44 - other.m44
 */
  __pyx_v_self->m42 = (__pyx_v_self->m42 - __pyx_v_other->m42);

  /* "cgtypes.pyx":3249
 *         self.m41 = self.m41 - other.m41
 *         self.m42 = self.m42 - other.m42
 *         self.m43 = self.m43 - other.m43             # <<<<<<<<<<<<<<
 *         self.m44 = self.m44 - other.m44
 *         return self
 */
  __pyx_v_self->m43 = (__pyx_v_self->m43 - __pyx_v_other->m43);

  /* "cgtypes.pyx":3250
 *         self.m42 = self.m42 - other.m42
 *         self.m43 = self.m43 - other.m43
 *         self.m44 = self.m44 - other.m44             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m44 = (__pyx_v_self->m44 - __pyx_v_other->m44);

  /* "cgtypes.pyx":3251
 *         self.m43 = self.m43 - other.m43
 *         self.m44 = self.m44 - other.m44
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":3232
 *         return self
 * 
 *     def __isub__(self, mat4 other):             # <<<<<<<<<<<<<<
 *         """Inline matrix subtraction.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3253
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (scalar or matrix).
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_30__imul__[] = "Inline multiplication (scalar or matrix).\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_30__imul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_31__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_30__imul__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_30__imul__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  double __pyx_v_a;
  double __pyx_v_b;
  double __pyx_v_c;
  double __pyx_v_d;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_mb = 0;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "cgtypes.pyx":3259
 *         cdef mat4 mb
 * 
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":3260
 * 
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             self.m11 = self.m11*r
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3261
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":3262
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             self.m11 = self.m11*r             # <<<<<<<<<<<<<<
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r
 */
    __pyx_v_self->m11 = (__pyx_v_self->m11 * __pyx_v_r);

    /* "cgtypes.pyx":3263
 *             r=other
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r             # <<<<<<<<<<<<<<
 *             self.m13 = self.m13*r
 *             self.m14 = self.m14*r
 */
    __pyx_v_self->m12 = (__pyx_v_self->m12 * __pyx_v_r);

    /* "cgtypes.pyx":3264
 *             self.m11 = self.m11*r
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r             # <<<<<<<<<<<<<<
 *             self.m14 = self.m14*r
 *             self.m21 = self.m21*r
 */
    __pyx_v_self->m13 = (__pyx_v_self->m13 * __pyx_v_r);

    /* "cgtypes.pyx":3265
 *             self.m12 = self.m12*r
 *             self.m13 = self.m13*r
 *             self.m14 = self.m14*r             # <<<<<<<<<<<<<<
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r
 */
    __pyx_v_self->m14 = (__pyx_v_self->m14 * __pyx_v_r);

    /* "cgtypes.pyx":3266
 *             self.m13 = self.m13*r
 *             self.m14 = self.m14*r
 *             self.m21 = self.m21*r             # <<<<<<<<<<<<<<
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r
 */
    __pyx_v_self->m21 = (__pyx_v_self->m21 * __pyx_v_r);

    /* "cgtypes.pyx":3267
 *             self.m14 = self.m14*r
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r             # <<<<<<<<<<<<<<
 *             self.m23 = self.m23*r
 *             self.m24 = self.m24*r
 */
    __pyx_v_self->m22 = (__pyx_v_self->m22 * __pyx_v_r);

    /* "cgtypes.pyx":3268
 *             self.m21 = self.m21*r
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r             # <<<<<<<<<<<<<<
 *             self.m24 = self.m24*r
 *             self.m31 = self.m31*r
 */
    __pyx_v_self->m23 = (__pyx_v_self->m23 * __pyx_v_r);

    /* "cgtypes.pyx":3269
 *             self.m22 = self.m22*r
 *             self.m23 = self.m23*r
 *             self.m24 = self.m24*r             # <<<<<<<<<<<<<<
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r
 */
    __pyx_v_self->m24 = (__pyx_v_self->m24 * __pyx_v_r);

    /* "cgtypes.pyx":3270
 *             self.m23 = self.m23*r
 *             self.m24 = self.m24*r
 *             self.m31 = self.m31*r             # <<<<<<<<<<<<<<
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r
 */
    __pyx_v_self->m31 = (__pyx_v_self->m31 * __pyx_v_r);

    /* "cgtypes.pyx":3271
 *             self.m24 = self.m24*r
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r             # <<<<<<<<<<<<<<
 *             self.m33 = self.m33*r
 *             self.m34 = self.m34*r
 */
    __pyx_v_self->m32 = (__pyx_v_self->m32 * __pyx_v_r);

    /* "cgtypes.pyx":3272
 *             self.m31 = self.m31*r
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r             # <<<<<<<<<<<<<<
 *             self.m34 = self.m34*r
 *             self.m41 = self.m41*r
 */
    __pyx_v_self->m33 = (__pyx_v_self->m33 * __pyx_v_r);

    /* "cgtypes.pyx":3273
 *             self.m32 = self.m32*r
 *             self.m33 = self.m33*r
 *             self.m34 = self.m34*r             # <<<<<<<<<<<<<<
 *             self.m41 = self.m41*r
 *             self.m42 = self.m42*r
 */
    __pyx_v_self->m34 = (__pyx_v_self->m34 * __pyx_v_r);

    /* "cgtypes.pyx":3274
 *             self.m33 = self.m33*r
 *             self.m34 = self.m34*r
 *             self.m41 = self.m41*r             # <<<<<<<<<<<<<<
 *             self.m42 = self.m42*r
 *             self.m43 = self.m43*r
 */
    __pyx_v_self->m41 = (__pyx_v_self->m41 * __pyx_v_r);

    /* "cgtypes.pyx":3275
 *             self.m34 = self.m34*r
 *             self.m41 = self.m41*r
 *             self.m42 = self.m42*r             # <<<<<<<<<<<<<<
 *             self.m43 = self.m43*r
 *             self.m44 = self.m44*r
 */
    __pyx_v_self->m42 = (__pyx_v_self->m42 * __pyx_v_r);

    /* "cgtypes.pyx":3276
 *             self.m41 = self.m41*r
 *             self.m42 = self.m42*r
 *             self.m43 = self.m43*r             # <<<<<<<<<<<<<<
 *             self.m44 = self.m44*r
 *             return self
 */
    __pyx_v_self->m43 = (__pyx_v_self->m43 * __pyx_v_r);

    /* "cgtypes.pyx":3277
 *             self.m42 = self.m42*r
 *             self.m43 = self.m43*r
 *             self.m44 = self.m44*r             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==mat4:
 */
    __pyx_v_self->m44 = (__pyx_v_self->m44 * __pyx_v_r);

    /* "cgtypes.pyx":3278
 *             self.m43 = self.m43*r
 *             self.m44 = self.m44*r
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==mat4:
 *             mb = other
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":3279
 *             self.m44 = self.m44*r
 *             return self
 *         elif tb==mat4:             # <<<<<<<<<<<<<<
 *             mb = other
 *             a = self.m11
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3280
 *             return self
 *         elif tb==mat4:
 *             mb = other             # <<<<<<<<<<<<<<
 *             a = self.m11
 *             b = self.m12
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3281
 *         elif tb==mat4:
 *             mb = other
 *             a = self.m11             # <<<<<<<<<<<<<<
 *             b = self.m12
 *             c = self.m13
 */
    __pyx_t_4 = __pyx_v_self->m11;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":3282
 *             mb = other
 *             a = self.m11
 *             b = self.m12             # <<<<<<<<<<<<<<
 *             c = self.m13
 *             d = self.m14
 */
    __pyx_t_4 = __pyx_v_self->m12;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":3283
 *             a = self.m11
 *             b = self.m12
 *             c = self.m13             # <<<<<<<<<<<<<<
 *             d = self.m14
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 */
    __pyx_t_4 = __pyx_v_self->m13;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":3284
 *             b = self.m12
 *             c = self.m13
 *             d = self.m14             # <<<<<<<<<<<<<<
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 */
    __pyx_t_4 = __pyx_v_self->m14;
    __pyx_v_d = __pyx_t_4;

    /* "cgtypes.pyx":3285
 *             c = self.m13
 *             d = self.m14
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41             # <<<<<<<<<<<<<<
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 */
    __pyx_v_self->m11 = ((((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31)) + (__pyx_v_d * __pyx_v_mb->m41));

    /* "cgtypes.pyx":3286
 *             d = self.m14
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42             # <<<<<<<<<<<<<<
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m14 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 */
    __pyx_v_self->m12 = ((((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32)) + (__pyx_v_d * __pyx_v_mb->m42));

    /* "cgtypes.pyx":3287
 *             self.m11 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43             # <<<<<<<<<<<<<<
 *             self.m14 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m21
 */
    __pyx_v_self->m13 = ((((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33)) + (__pyx_v_d * __pyx_v_mb->m43));

    /* "cgtypes.pyx":3288
 *             self.m12 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m14 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44             # <<<<<<<<<<<<<<
 *             a = self.m21
 *             b = self.m22
 */
    __pyx_v_self->m14 = ((((__pyx_v_a * __pyx_v_mb->m14) + (__pyx_v_b * __pyx_v_mb->m24)) + (__pyx_v_c * __pyx_v_mb->m34)) + (__pyx_v_d * __pyx_v_mb->m44));

    /* "cgtypes.pyx":3289
 *             self.m13 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m14 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m21             # <<<<<<<<<<<<<<
 *             b = self.m22
 *             c = self.m23
 */
    __pyx_t_4 = __pyx_v_self->m21;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":3290
 *             self.m14 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m21
 *             b = self.m22             # <<<<<<<<<<<<<<
 *             c = self.m23
 *             d = self.m24
 */
    __pyx_t_4 = __pyx_v_self->m22;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":3291
 *             a = self.m21
 *             b = self.m22
 *             c = self.m23             # <<<<<<<<<<<<<<
 *             d = self.m24
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 */
    __pyx_t_4 = __pyx_v_self->m23;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":3292
 *             b = self.m22
 *             c = self.m23
 *             d = self.m24             # <<<<<<<<<<<<<<
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 */
    __pyx_t_4 = __pyx_v_self->m24;
    __pyx_v_d = __pyx_t_4;

    /* "cgtypes.pyx":3293
 *             c = self.m23
 *             d = self.m24
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41             # <<<<<<<<<<<<<<
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 */
    __pyx_v_self->m21 = ((((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31)) + (__pyx_v_d * __pyx_v_mb->m41));

    /* "cgtypes.pyx":3294
 *             d = self.m24
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42             # <<<<<<<<<<<<<<
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m24 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 */
    __pyx_v_self->m22 = ((((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32)) + (__pyx_v_d * __pyx_v_mb->m42));

    /* "cgtypes.pyx":3295
 *             self.m21 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43             # <<<<<<<<<<<<<<
 *             self.m24 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m31
 */
    __pyx_v_self->m23 = ((((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33)) + (__pyx_v_d * __pyx_v_mb->m43));

    /* "cgtypes.pyx":3296
 *             self.m22 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m24 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44             # <<<<<<<<<<<<<<
 *             a = self.m31
 *             b = self.m32
 */
    __pyx_v_self->m24 = ((((__pyx_v_a * __pyx_v_mb->m14) + (__pyx_v_b * __pyx_v_mb->m24)) + (__pyx_v_c * __pyx_v_mb->m34)) + (__pyx_v_d * __pyx_v_mb->m44));

    /* "cgtypes.pyx":3297
 *             self.m23 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m24 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m31             # <<<<<<<<<<<<<<
 *             b = self.m32
 *             c = self.m33
 */
    __pyx_t_4 = __pyx_v_self->m31;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":3298
 *             self.m24 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m31
 *             b = self.m32             # <<<<<<<<<<<<<<
 *             c = self.m33
 *             d = self.m34
 */
    __pyx_t_4 = __pyx_v_self->m32;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":3299
 *             a = self.m31
 *             b = self.m32
 *             c = self.m33             # <<<<<<<<<<<<<<
 *             d = self.m34
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 */
    __pyx_t_4 = __pyx_v_self->m33;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":3300
 *             b = self.m32
 *             c = self.m33
 *             d = self.m34             # <<<<<<<<<<<<<<
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 */
    __pyx_t_4 = __pyx_v_self->m34;
    __pyx_v_d = __pyx_t_4;

    /* "cgtypes.pyx":3301
 *             c = self.m33
 *             d = self.m34
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41             # <<<<<<<<<<<<<<
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 */
    __pyx_v_self->m31 = ((((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31)) + (__pyx_v_d * __pyx_v_mb->m41));

    /* "cgtypes.pyx":3302
 *             d = self.m34
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42             # <<<<<<<<<<<<<<
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m34 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 */
    __pyx_v_self->m32 = ((((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32)) + (__pyx_v_d * __pyx_v_mb->m42));

    /* "cgtypes.pyx":3303
 *             self.m31 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43             # <<<<<<<<<<<<<<
 *             self.m34 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m41
 */
    __pyx_v_self->m33 = ((((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33)) + (__pyx_v_d * __pyx_v_mb->m43));

    /* "cgtypes.pyx":3304
 *             self.m32 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m34 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44             # <<<<<<<<<<<<<<
 *             a = self.m41
 *             b = self.m42
 */
    __pyx_v_self->m34 = ((((__pyx_v_a * __pyx_v_mb->m14) + (__pyx_v_b * __pyx_v_mb->m24)) + (__pyx_v_c * __pyx_v_mb->m34)) + (__pyx_v_d * __pyx_v_mb->m44));

    /* "cgtypes.pyx":3305
 *             self.m33 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m34 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m41             # <<<<<<<<<<<<<<
 *             b = self.m42
 *             c = self.m43
 */
    __pyx_t_4 = __pyx_v_self->m41;
    __pyx_v_a = __pyx_t_4;

    /* "cgtypes.pyx":3306
 *             self.m34 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             a = self.m41
 *             b = self.m42             # <<<<<<<<<<<<<<
 *             c = self.m43
 *             d = self.m44
 */
    __pyx_t_4 = __pyx_v_self->m42;
    __pyx_v_b = __pyx_t_4;

    /* "cgtypes.pyx":3307
 *             a = self.m41
 *             b = self.m42
 *             c = self.m43             # <<<<<<<<<<<<<<
 *             d = self.m44
 *             self.m41 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 */
    __pyx_t_4 = __pyx_v_self->m43;
    __pyx_v_c = __pyx_t_4;

    /* "cgtypes.pyx":3308
 *             b = self.m42
 *             c = self.m43
 *             d = self.m44             # <<<<<<<<<<<<<<
 *             self.m41 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m42 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 */
    __pyx_t_4 = __pyx_v_self->m44;
    __pyx_v_d = __pyx_t_4;

    /* "cgtypes.pyx":3309
 *             c = self.m43
 *             d = self.m44
 *             self.m41 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41             # <<<<<<<<<<<<<<
 *             self.m42 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m43 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 */
    __pyx_v_self->m41 = ((((__pyx_v_a * __pyx_v_mb->m11) + (__pyx_v_b * __pyx_v_mb->m21)) + (__pyx_v_c * __pyx_v_mb->m31)) + (__pyx_v_d * __pyx_v_mb->m41));

    /* "cgtypes.pyx":3310
 *             d = self.m44
 *             self.m41 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m42 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42             # <<<<<<<<<<<<<<
 *             self.m43 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m44 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 */
    __pyx_v_self->m42 = ((((__pyx_v_a * __pyx_v_mb->m12) + (__pyx_v_b * __pyx_v_mb->m22)) + (__pyx_v_c * __pyx_v_mb->m32)) + (__pyx_v_d * __pyx_v_mb->m42));

    /* "cgtypes.pyx":3311
 *             self.m41 = a*mb.m11+b*mb.m21+c*mb.m31+d*mb.m41
 *             self.m42 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m43 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43             # <<<<<<<<<<<<<<
 *             self.m44 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             return self
 */
    __pyx_v_self->m43 = ((((__pyx_v_a * __pyx_v_mb->m13) + (__pyx_v_b * __pyx_v_mb->m23)) + (__pyx_v_c * __pyx_v_mb->m33)) + (__pyx_v_d * __pyx_v_mb->m43));

    /* "cgtypes.pyx":3312
 *             self.m42 = a*mb.m12+b*mb.m22+c*mb.m32+d*mb.m42
 *             self.m43 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m44 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->m44 = ((((__pyx_v_a * __pyx_v_mb->m14) + (__pyx_v_b * __pyx_v_mb->m24)) + (__pyx_v_c * __pyx_v_mb->m34)) + (__pyx_v_d * __pyx_v_mb->m44));

    /* "cgtypes.pyx":3313
 *             self.m43 = a*mb.m13+b*mb.m23+c*mb.m33+d*mb.m43
 *             self.m44 = a*mb.m14+b*mb.m24+c*mb.m34+d*mb.m44
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for *="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3315
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for *="             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_4, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3253
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication (scalar or matrix).
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3317
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4mat4_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_32__idiv__[] = "Inline division with scalar.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_32__idiv__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_33__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_32__idiv__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4mat4_32__idiv__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "cgtypes.pyx":3321
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":3322
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3323
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":3324
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 division"
 *             self.m11 = self.m11/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3325
 *             r=other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"             # <<<<<<<<<<<<<<
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3326
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 division"
 *             self.m11 = self.m11/r             # <<<<<<<<<<<<<<
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m11 = (__pyx_v_self->m11 / __pyx_v_r);

    /* "cgtypes.pyx":3327
 *                 raise ZeroDivisionError,"mat4 division"
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r             # <<<<<<<<<<<<<<
 *             self.m13 = self.m13/r
 *             self.m14 = self.m14/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m12 = (__pyx_v_self->m12 / __pyx_v_r);

    /* "cgtypes.pyx":3328
 *             self.m11 = self.m11/r
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r             # <<<<<<<<<<<<<<
 *             self.m14 = self.m14/r
 *             self.m21 = self.m21/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m13 = (__pyx_v_self->m13 / __pyx_v_r);

    /* "cgtypes.pyx":3329
 *             self.m12 = self.m12/r
 *             self.m13 = self.m13/r
 *             self.m14 = self.m14/r             # <<<<<<<<<<<<<<
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m14 = (__pyx_v_self->m14 / __pyx_v_r);

    /* "cgtypes.pyx":3330
 *             self.m13 = self.m13/r
 *             self.m14 = self.m14/r
 *             self.m21 = self.m21/r             # <<<<<<<<<<<<<<
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m21 = (__pyx_v_self->m21 / __pyx_v_r);

    /* "cgtypes.pyx":3331
 *             self.m14 = self.m14/r
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r             # <<<<<<<<<<<<<<
 *             self.m23 = self.m23/r
 *             self.m24 = self.m24/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m22 = (__pyx_v_self->m22 / __pyx_v_r);

    /* "cgtypes.pyx":3332
 *             self.m21 = self.m21/r
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r             # <<<<<<<<<<<<<<
 *             self.m24 = self.m24/r
 *             self.m31 = self.m31/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m23 = (__pyx_v_self->m23 / __pyx_v_r);

    /* "cgtypes.pyx":3333
 *             self.m22 = self.m22/r
 *             self.m23 = self.m23/r
 *             self.m24 = self.m24/r             # <<<<<<<<<<<<<<
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m24 = (__pyx_v_self->m24 / __pyx_v_r);

    /* "cgtypes.pyx":3334
 *             self.m23 = self.m23/r
 *             self.m24 = self.m24/r
 *             self.m31 = self.m31/r             # <<<<<<<<<<<<<<
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m31 = (__pyx_v_self->m31 / __pyx_v_r);

    /* "cgtypes.pyx":3335
 *             self.m24 = self.m24/r
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r             # <<<<<<<<<<<<<<
 *             self.m33 = self.m33/r
 *             self.m34 = self.m34/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m32 = (__pyx_v_self->m32 / __pyx_v_r);

    /* "cgtypes.pyx":3336
 *             self.m31 = self.m31/r
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r             # <<<<<<<<<<<<<<
 *             self.m34 = self.m34/r
 *             self.m41 = self.m41/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m33 = (__pyx_v_self->m33 / __pyx_v_r);

    /* "cgtypes.pyx":3337
 *             self.m32 = self.m32/r
 *             self.m33 = self.m33/r
 *             self.m34 = self.m34/r             # <<<<<<<<<<<<<<
 *             self.m41 = self.m41/r
 *             self.m42 = self.m42/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m34 = (__pyx_v_self->m34 / __pyx_v_r);

    /* "cgtypes.pyx":3338
 *             self.m33 = self.m33/r
 *             self.m34 = self.m34/r
 *             self.m41 = self.m41/r             # <<<<<<<<<<<<<<
 *             self.m42 = self.m42/r
 *             self.m43 = self.m43/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m41 = (__pyx_v_self->m41 / __pyx_v_r);

    /* "cgtypes.pyx":3339
 *             self.m34 = self.m34/r
 *             self.m41 = self.m41/r
 *             self.m42 = self.m42/r             # <<<<<<<<<<<<<<
 *             self.m43 = self.m43/r
 *             self.m44 = self.m44/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m42 = (__pyx_v_self->m42 / __pyx_v_r);

    /* "cgtypes.pyx":3340
 *             self.m41 = self.m41/r
 *             self.m42 = self.m42/r
 *             self.m43 = self.m43/r             # <<<<<<<<<<<<<<
 *             self.m44 = self.m44/r
 *             return self
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m43 = (__pyx_v_self->m43 / __pyx_v_r);

    /* "cgtypes.pyx":3341
 *             self.m42 = self.m42/r
 *             self.m43 = self.m43/r
 *             self.m44 = self.m44/r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->m44 = (__pyx_v_self->m44 / __pyx_v_r);

    /* "cgtypes.pyx":3342
 *             self.m43 = self.m43/r
 *             self.m44 = self.m44/r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3344
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for /="             # <<<<<<<<<<<<<<
 * 
 *     def __imod__(self, b):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_5, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3317
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":3346
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_34__imod__[] = "Inline modulo.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_34__imod__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_35__imod__(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imod__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_34__imod__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_34__imod__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_mb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imod__", 0);

  /* "cgtypes.pyx":3352
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":3354
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3355
 * 
 *         if tb==float or tb==int or tb==long:
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":3356
 *         if tb==float or tb==int or tb==long:
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, r)
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3357
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"             # <<<<<<<<<<<<<<
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3358
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, r)             # <<<<<<<<<<<<<<
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)
 */
    __pyx_v_self->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_r);

    /* "cgtypes.pyx":3359
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)             # <<<<<<<<<<<<<<
 *             self.m13 = _fmod(self.m13, r)
 *             self.m14 = _fmod(self.m14, r)
 */
    __pyx_v_self->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_r);

    /* "cgtypes.pyx":3360
 *             self.m11 = _fmod(self.m11, r)
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)             # <<<<<<<<<<<<<<
 *             self.m14 = _fmod(self.m14, r)
 *             self.m21 = _fmod(self.m21, r)
 */
    __pyx_v_self->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_r);

    /* "cgtypes.pyx":3361
 *             self.m12 = _fmod(self.m12, r)
 *             self.m13 = _fmod(self.m13, r)
 *             self.m14 = _fmod(self.m14, r)             # <<<<<<<<<<<<<<
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)
 */
    __pyx_v_self->m14 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m14, __pyx_v_r);

    /* "cgtypes.pyx":3362
 *             self.m13 = _fmod(self.m13, r)
 *             self.m14 = _fmod(self.m14, r)
 *             self.m21 = _fmod(self.m21, r)             # <<<<<<<<<<<<<<
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)
 */
    __pyx_v_self->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_r);

    /* "cgtypes.pyx":3363
 *             self.m14 = _fmod(self.m14, r)
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)             # <<<<<<<<<<<<<<
 *             self.m23 = _fmod(self.m23, r)
 *             self.m24 = _fmod(self.m24, r)
 */
    __pyx_v_self->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_r);

    /* "cgtypes.pyx":3364
 *             self.m21 = _fmod(self.m21, r)
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)             # <<<<<<<<<<<<<<
 *             self.m24 = _fmod(self.m24, r)
 *             self.m31 = _fmod(self.m31, r)
 */
    __pyx_v_self->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_r);

    /* "cgtypes.pyx":3365
 *             self.m22 = _fmod(self.m22, r)
 *             self.m23 = _fmod(self.m23, r)
 *             self.m24 = _fmod(self.m24, r)             # <<<<<<<<<<<<<<
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)
 */
    __pyx_v_self->m24 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m24, __pyx_v_r);

    /* "cgtypes.pyx":3366
 *             self.m23 = _fmod(self.m23, r)
 *             self.m24 = _fmod(self.m24, r)
 *             self.m31 = _fmod(self.m31, r)             # <<<<<<<<<<<<<<
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)
 */
    __pyx_v_self->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_r);

    /* "cgtypes.pyx":3367
 *             self.m24 = _fmod(self.m24, r)
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)             # <<<<<<<<<<<<<<
 *             self.m33 = _fmod(self.m33, r)
 *             self.m34 = _fmod(self.m34, r)
 */
    __pyx_v_self->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_r);

    /* "cgtypes.pyx":3368
 *             self.m31 = _fmod(self.m31, r)
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)             # <<<<<<<<<<<<<<
 *             self.m34 = _fmod(self.m34, r)
 *             self.m41 = _fmod(self.m41, r)
 */
    __pyx_v_self->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_r);

    /* "cgtypes.pyx":3369
 *             self.m32 = _fmod(self.m32, r)
 *             self.m33 = _fmod(self.m33, r)
 *             self.m34 = _fmod(self.m34, r)             # <<<<<<<<<<<<<<
 *             self.m41 = _fmod(self.m41, r)
 *             self.m42 = _fmod(self.m42, r)
 */
    __pyx_v_self->m34 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m34, __pyx_v_r);

    /* "cgtypes.pyx":3370
 *             self.m33 = _fmod(self.m33, r)
 *             self.m34 = _fmod(self.m34, r)
 *             self.m41 = _fmod(self.m41, r)             # <<<<<<<<<<<<<<
 *             self.m42 = _fmod(self.m42, r)
 *             self.m43 = _fmod(self.m43, r)
 */
    __pyx_v_self->m41 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m41, __pyx_v_r);

    /* "cgtypes.pyx":3371
 *             self.m34 = _fmod(self.m34, r)
 *             self.m41 = _fmod(self.m41, r)
 *             self.m42 = _fmod(self.m42, r)             # <<<<<<<<<<<<<<
 *             self.m43 = _fmod(self.m43, r)
 *             self.m44 = _fmod(self.m44, r)
 */
    __pyx_v_self->m42 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m42, __pyx_v_r);

    /* "cgtypes.pyx":3372
 *             self.m41 = _fmod(self.m41, r)
 *             self.m42 = _fmod(self.m42, r)
 *             self.m43 = _fmod(self.m43, r)             # <<<<<<<<<<<<<<
 *             self.m44 = _fmod(self.m44, r)
 *             return self
 */
    __pyx_v_self->m43 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m43, __pyx_v_r);

    /* "cgtypes.pyx":3373
 *             self.m42 = _fmod(self.m42, r)
 *             self.m43 = _fmod(self.m43, r)
 *             self.m44 = _fmod(self.m44, r)             # <<<<<<<<<<<<<<
 *             return self
 *         elif tb==mat4:
 */
    __pyx_v_self->m44 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m44, __pyx_v_r);

    /* "cgtypes.pyx":3374
 *             self.m43 = _fmod(self.m43, r)
 *             self.m44 = _fmod(self.m44, r)
 *             return self             # <<<<<<<<<<<<<<
 *         elif tb==mat4:
 *             mb = b
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":3375
 *             self.m44 = _fmod(self.m44, r)
 *             return self
 *         elif tb==mat4:             # <<<<<<<<<<<<<<
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3376
 *             return self
 *         elif tb==mat4:
 *             mb = b             # <<<<<<<<<<<<<<
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m14)<=eps or
 */
    if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_mb = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":3377
 *         elif tb==mat4:
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m11) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m12) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m13) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3378
 *             mb = b
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m14)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m14) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3379
 *             if (fabs(mb.m11)<=eps or fabs(mb.m12)<=eps or fabs(mb.m13)<=eps or
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m21) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m22) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m23) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3380
 *                 fabs(mb.m14)<=eps or
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m24) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3381
 *                 fabs(mb.m21)<=eps or fabs(mb.m22)<=eps or fabs(mb.m23)<=eps or
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m31) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m32) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m33) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3382
 *                 fabs(mb.m24)<=eps or
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m34) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3383
 *                 fabs(mb.m31)<=eps or fabs(mb.m32)<=eps or fabs(mb.m33)<=eps or
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or             # <<<<<<<<<<<<<<
 *                 fabs(mb.m44)<=eps):
 *                 raise ZeroDivisionError,"mat4 modulo"
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m41) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m42) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((fabs(__pyx_v_mb->m43) <= __pyx_v_7cgtypes_eps) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }

    /* "cgtypes.pyx":3384
 *                 fabs(mb.m34)<=eps or
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)
 */
    __pyx_t_3 = ((fabs(__pyx_v_mb->m44) <= __pyx_v_7cgtypes_eps) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3385
 *                 fabs(mb.m41)<=eps or fabs(mb.m42)<=eps or fabs(mb.m43)<=eps or
 *                 fabs(mb.m44)<=eps):
 *                 raise ZeroDivisionError,"mat4 modulo"             # <<<<<<<<<<<<<<
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_mat4_modulo, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3386
 *                 fabs(mb.m44)<=eps):
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)             # <<<<<<<<<<<<<<
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)
 */
    __pyx_v_self->m11 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m11, __pyx_v_mb->m11);

    /* "cgtypes.pyx":3387
 *                 raise ZeroDivisionError,"mat4 modulo"
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)             # <<<<<<<<<<<<<<
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m14 = _fmod(self.m14, mb.m13)
 */
    __pyx_v_self->m12 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m12, __pyx_v_mb->m12);

    /* "cgtypes.pyx":3388
 *             self.m11 = _fmod(self.m11, mb.m11)
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)             # <<<<<<<<<<<<<<
 *             self.m14 = _fmod(self.m14, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)
 */
    __pyx_v_self->m13 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m13, __pyx_v_mb->m13);

    /* "cgtypes.pyx":3389
 *             self.m12 = _fmod(self.m12, mb.m12)
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m14 = _fmod(self.m14, mb.m13)             # <<<<<<<<<<<<<<
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)
 */
    __pyx_v_self->m14 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m14, __pyx_v_mb->m13);

    /* "cgtypes.pyx":3390
 *             self.m13 = _fmod(self.m13, mb.m13)
 *             self.m14 = _fmod(self.m14, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)             # <<<<<<<<<<<<<<
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)
 */
    __pyx_v_self->m21 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m21, __pyx_v_mb->m21);

    /* "cgtypes.pyx":3391
 *             self.m14 = _fmod(self.m14, mb.m13)
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)             # <<<<<<<<<<<<<<
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m24 = _fmod(self.m24, mb.m23)
 */
    __pyx_v_self->m22 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m22, __pyx_v_mb->m22);

    /* "cgtypes.pyx":3392
 *             self.m21 = _fmod(self.m21, mb.m21)
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)             # <<<<<<<<<<<<<<
 *             self.m24 = _fmod(self.m24, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)
 */
    __pyx_v_self->m23 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m23, __pyx_v_mb->m23);

    /* "cgtypes.pyx":3393
 *             self.m22 = _fmod(self.m22, mb.m22)
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m24 = _fmod(self.m24, mb.m23)             # <<<<<<<<<<<<<<
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)
 */
    __pyx_v_self->m24 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m24, __pyx_v_mb->m23);

    /* "cgtypes.pyx":3394
 *             self.m23 = _fmod(self.m23, mb.m23)
 *             self.m24 = _fmod(self.m24, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)             # <<<<<<<<<<<<<<
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)
 */
    __pyx_v_self->m31 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m31, __pyx_v_mb->m31);

    /* "cgtypes.pyx":3395
 *             self.m24 = _fmod(self.m24, mb.m23)
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)             # <<<<<<<<<<<<<<
 *             self.m33 = _fmod(self.m33, mb.m33)
 *             self.m34 = _fmod(self.m34, mb.m33)
 */
    __pyx_v_self->m32 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m32, __pyx_v_mb->m32);

    /* "cgtypes.pyx":3396
 *             self.m31 = _fmod(self.m31, mb.m31)
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)             # <<<<<<<<<<<<<<
 *             self.m34 = _fmod(self.m34, mb.m33)
 *             self.m41 = _fmod(self.m41, mb.m41)
 */
    __pyx_v_self->m33 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m33, __pyx_v_mb->m33);

    /* "cgtypes.pyx":3397
 *             self.m32 = _fmod(self.m32, mb.m32)
 *             self.m33 = _fmod(self.m33, mb.m33)
 *             self.m34 = _fmod(self.m34, mb.m33)             # <<<<<<<<<<<<<<
 *             self.m41 = _fmod(self.m41, mb.m41)
 *             self.m42 = _fmod(self.m42, mb.m42)
 */
    __pyx_v_self->m34 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m34, __pyx_v_mb->m33);

    /* "cgtypes.pyx":3398
 *             self.m33 = _fmod(self.m33, mb.m33)
 *             self.m34 = _fmod(self.m34, mb.m33)
 *             self.m41 = _fmod(self.m41, mb.m41)             # <<<<<<<<<<<<<<
 *             self.m42 = _fmod(self.m42, mb.m42)
 *             self.m43 = _fmod(self.m43, mb.m43)
 */
    __pyx_v_self->m41 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m41, __pyx_v_mb->m41);

    /* "cgtypes.pyx":3399
 *             self.m34 = _fmod(self.m34, mb.m33)
 *             self.m41 = _fmod(self.m41, mb.m41)
 *             self.m42 = _fmod(self.m42, mb.m42)             # <<<<<<<<<<<<<<
 *             self.m43 = _fmod(self.m43, mb.m43)
 *             self.m44 = _fmod(self.m44, mb.m43)
 */
    __pyx_v_self->m42 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m42, __pyx_v_mb->m42);

    /* "cgtypes.pyx":3400
 *             self.m41 = _fmod(self.m41, mb.m41)
 *             self.m42 = _fmod(self.m42, mb.m42)
 *             self.m43 = _fmod(self.m43, mb.m43)             # <<<<<<<<<<<<<<
 *             self.m44 = _fmod(self.m44, mb.m43)
 *             return self
 */
    __pyx_v_self->m43 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m43, __pyx_v_mb->m43);

    /* "cgtypes.pyx":3401
 *             self.m42 = _fmod(self.m42, mb.m42)
 *             self.m43 = _fmod(self.m43, mb.m43)
 *             self.m44 = _fmod(self.m44, mb.m43)             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    __pyx_v_self->m44 = __pyx_f_7cgtypes__fmod(__pyx_v_self->m44, __pyx_v_mb->m43);

    /* "cgtypes.pyx":3402
 *             self.m43 = _fmod(self.m43, mb.m43)
 *             self.m44 = _fmod(self.m44, mb.m43)
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for %="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3404
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for %="             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_6, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3346
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __imod__(self, b):             # <<<<<<<<<<<<<<
 *         """Inline modulo.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__imod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_mb);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3406
 *             raise TypeError, "unsupported operand type for %="
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 4)."""
 *         return 4
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_7cgtypes_4mat4_37__len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_36__len__[] = "Length of the sequence (always 4).";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_36__len__;
#endif
static Py_ssize_t __pyx_pw_7cgtypes_4mat4_37__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_36__len__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_7cgtypes_4mat4_36__len__(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "cgtypes.pyx":3408
 *     def __len__(self):
 *         """Length of the sequence (always 4)."""
 *         return 4             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(mat4 self, key):
 */
  __pyx_r = 4;
  goto __pyx_L0;

  /* "cgtypes.pyx":3406
 *             raise TypeError, "unsupported operand type for %="
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Length of the sequence (always 4)."""
 *         return 4
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3410
 *         return 4
 * 
 *     def __getitem__(mat4 self, key):             # <<<<<<<<<<<<<<
 *         """Return a column or a single matrix element.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_39__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_38__getitem__[] = "Return a column or a single matrix element.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_38__getitem__;
#endif
static PyObject *__pyx_pw_7cgtypes_4mat4_39__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_38__getitem__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_38__getitem__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_v_i;
  int __pyx_v_j;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "cgtypes.pyx":3415
 *         cdef int i,j
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T==int or T==long:
 *             i = key
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":3416
 * 
 *         T=type(key)
 *         if T==int or T==long:             # <<<<<<<<<<<<<<
 *             i = key
 *             if i==0:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3417
 *         T=type(key)
 *         if T==int or T==long:
 *             i = key             # <<<<<<<<<<<<<<
 *             if i==0:
 *                 return vec4(self.m11, self.m21, self.m31, self.m41)
 */
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_i = __pyx_t_4;

    /* "cgtypes.pyx":3424
 *             elif i==2:
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 return vec4(self.m14, self.m24, self.m34, self.m44)
 *             else:
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":3418
 *         if T==int or T==long:
 *             i = key
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 return vec4(self.m11, self.m21, self.m31, self.m41)
 *             elif i==1:
 */
      case 0:

      /* "cgtypes.pyx":3419
 *             i = key
 *             if i==0:
 *                 return vec4(self.m11, self.m21, self.m31, self.m41)             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 return vec4(self.m12, self.m22, self.m32, self.m42)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __pyx_t_2 = 0;
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L0;
      break;

      /* "cgtypes.pyx":3420
 *             if i==0:
 *                 return vec4(self.m11, self.m21, self.m31, self.m41)
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 return vec4(self.m12, self.m22, self.m32, self.m42)
 *             elif i==2:
 */
      case 1:

      /* "cgtypes.pyx":3421
 *                 return vec4(self.m11, self.m21, self.m31, self.m41)
 *             elif i==1:
 *                 return vec4(self.m12, self.m22, self.m32, self.m42)             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_6 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      break;

      /* "cgtypes.pyx":3422
 *             elif i==1:
 *                 return vec4(self.m12, self.m22, self.m32, self.m42)
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)
 *             elif i==3:
 */
      case 2:

      /* "cgtypes.pyx":3423
 *                 return vec4(self.m12, self.m22, self.m32, self.m42)
 *             elif i==2:
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)             # <<<<<<<<<<<<<<
 *             elif i==3:
 *                 return vec4(self.m14, self.m24, self.m34, self.m44)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_5 = 0;
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      goto __pyx_L0;
      break;

      /* "cgtypes.pyx":3424
 *             elif i==2:
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 return vec4(self.m14, self.m24, self.m34, self.m44)
 *             else:
 */
      case 3:

      /* "cgtypes.pyx":3425
 *                 return vec4(self.m13, self.m23, self.m33, self.m43)
 *             elif i==3:
 *                 return vec4(self.m14, self.m24, self.m34, self.m44)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IndexError, "index out of range"
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
      break;
      default:

      /* "cgtypes.pyx":3427
 *                 return vec4(self.m14, self.m24, self.m34, self.m44)
 *             else:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 *         elif T==tuple:
 *             if len(key)!=2:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
  }

  /* "cgtypes.pyx":3428
 *             else:
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:             # <<<<<<<<<<<<<<
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyTuple_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3429
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:
 *             if len(key)!=2:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 */
    __pyx_t_9 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_9 != 2) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3430
 *         elif T==tuple:
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"             # <<<<<<<<<<<<<<
 *             i = key[0]
 *             j = key[1]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_index_tuple_must_be_a_2_tuple, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3431
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]             # <<<<<<<<<<<<<<
 *             j = key[1]
 *             if i<0 or i>3 or j<0 or j>3:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_i = __pyx_t_4;

    /* "cgtypes.pyx":3432
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 *             j = key[1]             # <<<<<<<<<<<<<<
 *             if i<0 or i>3 or j<0 or j>3:
 *                 raise IndexError, "index out of range"
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_j = __pyx_t_4;

    /* "cgtypes.pyx":3433
 *             i = key[0]
 *             j = key[1]
 *             if i<0 or i>3 or j<0 or j>3:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "index out of range"
 * 
 */
    __pyx_t_3 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_i > 3) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j > 3) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3434
 *             j = key[1]
 *             if i<0 or i>3 or j<0 or j>3:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3463
 *                 elif j==3:
 *                     return self.m34
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m41
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":3436
 *                 raise IndexError, "index out of range"
 * 
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m11
 */
      case 0:

      /* "cgtypes.pyx":3437
 * 
 *             if i==0:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m11
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3438
 *             if i==0:
 *                 if j==0:
 *                     return self.m11             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m12
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3439
 *                 if j==0:
 *                     return self.m11
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m12
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3440
 *                     return self.m11
 *                 elif j==1:
 *                     return self.m12             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m13
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3441
 *                 elif j==1:
 *                     return self.m12
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m13
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3442
 *                     return self.m12
 *                 elif j==2:
 *                     return self.m13             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     return self.m14
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3443
 *                 elif j==2:
 *                     return self.m13
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     return self.m14
 *             elif i==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3444
 *                     return self.m13
 *                 elif j==3:
 *                     return self.m14             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 if j==0:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }
      break;

      /* "cgtypes.pyx":3445
 *                 elif j==3:
 *                     return self.m14
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m21
 */
      case 1:

      /* "cgtypes.pyx":3446
 *                     return self.m14
 *             elif i==1:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m21
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3447
 *             elif i==1:
 *                 if j==0:
 *                     return self.m21             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m22
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3448
 *                 if j==0:
 *                     return self.m21
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m22
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3449
 *                     return self.m21
 *                 elif j==1:
 *                     return self.m22             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m23
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3450
 *                 elif j==1:
 *                     return self.m22
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m23
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3451
 *                     return self.m22
 *                 elif j==2:
 *                     return self.m23             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     return self.m24
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3452
 *                 elif j==2:
 *                     return self.m23
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     return self.m24
 *             elif i==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3453
 *                     return self.m23
 *                 elif j==3:
 *                     return self.m24             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 if j==0:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }
      break;

      /* "cgtypes.pyx":3454
 *                 elif j==3:
 *                     return self.m24
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m31
 */
      case 2:

      /* "cgtypes.pyx":3455
 *                     return self.m24
 *             elif i==2:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m31
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3456
 *             elif i==2:
 *                 if j==0:
 *                     return self.m31             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m32
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3457
 *                 if j==0:
 *                     return self.m31
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m32
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3458
 *                     return self.m31
 *                 elif j==1:
 *                     return self.m32             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m33
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3459
 *                 elif j==1:
 *                     return self.m32
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m33
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3460
 *                     return self.m32
 *                 elif j==2:
 *                     return self.m33             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     return self.m34
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3461
 *                 elif j==2:
 *                     return self.m33
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     return self.m34
 *             elif i==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3462
 *                     return self.m33
 *                 elif j==3:
 *                     return self.m34             # <<<<<<<<<<<<<<
 *             elif i==3:
 *                 if j==0:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }
      break;

      /* "cgtypes.pyx":3463
 *                 elif j==3:
 *                     return self.m34
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     return self.m41
 */
      case 3:

      /* "cgtypes.pyx":3464
 *                     return self.m34
 *             elif i==3:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     return self.m41
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3465
 *             elif i==3:
 *                 if j==0:
 *                     return self.m41             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     return self.m42
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3466
 *                 if j==0:
 *                     return self.m41
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     return self.m42
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3467
 *                     return self.m41
 *                 elif j==1:
 *                     return self.m42             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     return self.m43
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3468
 *                 elif j==1:
 *                     return self.m42
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     return self.m43
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3469
 *                     return self.m42
 *                 elif j==2:
 *                     return self.m43             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     return self.m44
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }

      /* "cgtypes.pyx":3470
 *                 elif j==2:
 *                     return self.m43
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     return self.m44
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3471
 *                     return self.m43
 *                 elif j==3:
 *                     return self.m44             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }
      break;
      default: break;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":3473
 *                     return self.m44
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer_or_2_tuple, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":3410
 *         return 4
 * 
 *     def __getitem__(mat4 self, key):             # <<<<<<<<<<<<<<
 *         """Return a column or a single matrix element.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cgtypes.mat4.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3475
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a column or a single matrix element.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4mat4_41__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_40__setitem__[] = "Set a column or a single matrix element.\n\n        The column must be given as a 4-sequence (this includes vec4 as well).\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4mat4_40__setitem__;
#endif
static int __pyx_pw_7cgtypes_4mat4_41__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_40__setitem__(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4mat4_40__setitem__(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  int __pyx_v_j;
  double __pyx_v_v;
  PyObject *__pyx_v_T = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "cgtypes.pyx":3483
 *         cdef double v
 * 
 *         T=type(key)             # <<<<<<<<<<<<<<
 *         if T==int or T==long:
 *             if len(value)!=4:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_key)));

  /* "cgtypes.pyx":3484
 * 
 *         T=type(key)
 *         if T==int or T==long:             # <<<<<<<<<<<<<<
 *             if len(value)!=4:
 *                 raise ValueError, "4-sequence expected"
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3485
 *         T=type(key)
 *         if T==int or T==long:
 *             if len(value)!=4:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "4-sequence expected"
 *             i = key
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_4 != 4) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3486
 *         if T==int or T==long:
 *             if len(value)!=4:
 *                 raise ValueError, "4-sequence expected"             # <<<<<<<<<<<<<<
 *             i = key
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_4_sequence_expected, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3487
 *             if len(value)!=4:
 *                 raise ValueError, "4-sequence expected"
 *             i = key             # <<<<<<<<<<<<<<
 *             if i==0:
 *                 self.m11 = value[0]
 */
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_i = __pyx_t_5;

    /* "cgtypes.pyx":3503
 *                 self.m33 = value[2]
 *                 self.m43 = value[3]
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 self.m14 = value[0]
 *                 self.m24 = value[1]
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":3488
 *                 raise ValueError, "4-sequence expected"
 *             i = key
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]
 */
      case 0:

      /* "cgtypes.pyx":3489
 *             i = key
 *             if i==0:
 *                 self.m11 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3489; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m11 = __pyx_t_6;

      /* "cgtypes.pyx":3490
 *             if i==0:
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m31 = value[2]
 *                 self.m41 = value[3]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3490; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m21 = __pyx_t_6;

      /* "cgtypes.pyx":3491
 *                 self.m11 = value[0]
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]             # <<<<<<<<<<<<<<
 *                 self.m41 = value[3]
 *             elif i==1:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3491; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m31 = __pyx_t_6;

      /* "cgtypes.pyx":3492
 *                 self.m21 = value[1]
 *                 self.m31 = value[2]
 *                 self.m41 = value[3]             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 self.m12 = value[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3492; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m41 = __pyx_t_6;
      break;

      /* "cgtypes.pyx":3493
 *                 self.m31 = value[2]
 *                 self.m41 = value[3]
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]
 */
      case 1:

      /* "cgtypes.pyx":3494
 *                 self.m41 = value[3]
 *             elif i==1:
 *                 self.m12 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3494; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m12 = __pyx_t_6;

      /* "cgtypes.pyx":3495
 *             elif i==1:
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m32 = value[2]
 *                 self.m42 = value[3]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m22 = __pyx_t_6;

      /* "cgtypes.pyx":3496
 *                 self.m12 = value[0]
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]             # <<<<<<<<<<<<<<
 *                 self.m42 = value[3]
 *             elif i==2:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m32 = __pyx_t_6;

      /* "cgtypes.pyx":3497
 *                 self.m22 = value[1]
 *                 self.m32 = value[2]
 *                 self.m42 = value[3]             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 self.m13 = value[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m42 = __pyx_t_6;
      break;

      /* "cgtypes.pyx":3498
 *                 self.m32 = value[2]
 *                 self.m42 = value[3]
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]
 */
      case 2:

      /* "cgtypes.pyx":3499
 *                 self.m42 = value[3]
 *             elif i==2:
 *                 self.m13 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m23 = value[1]
 *                 self.m33 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3499; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m13 = __pyx_t_6;

      /* "cgtypes.pyx":3500
 *             elif i==2:
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m33 = value[2]
 *                 self.m43 = value[3]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3500; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m23 = __pyx_t_6;

      /* "cgtypes.pyx":3501
 *                 self.m13 = value[0]
 *                 self.m23 = value[1]
 *                 self.m33 = value[2]             # <<<<<<<<<<<<<<
 *                 self.m43 = value[3]
 *             elif i==3:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m33 = __pyx_t_6;

      /* "cgtypes.pyx":3502
 *                 self.m23 = value[1]
 *                 self.m33 = value[2]
 *                 self.m43 = value[3]             # <<<<<<<<<<<<<<
 *             elif i==3:
 *                 self.m14 = value[0]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m43 = __pyx_t_6;
      break;

      /* "cgtypes.pyx":3503
 *                 self.m33 = value[2]
 *                 self.m43 = value[3]
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 self.m14 = value[0]
 *                 self.m24 = value[1]
 */
      case 3:

      /* "cgtypes.pyx":3504
 *                 self.m43 = value[3]
 *             elif i==3:
 *                 self.m14 = value[0]             # <<<<<<<<<<<<<<
 *                 self.m24 = value[1]
 *                 self.m34 = value[2]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m14 = __pyx_t_6;

      /* "cgtypes.pyx":3505
 *             elif i==3:
 *                 self.m14 = value[0]
 *                 self.m24 = value[1]             # <<<<<<<<<<<<<<
 *                 self.m34 = value[2]
 *                 self.m44 = value[3]
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3505; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m24 = __pyx_t_6;

      /* "cgtypes.pyx":3506
 *                 self.m14 = value[0]
 *                 self.m24 = value[1]
 *                 self.m34 = value[2]             # <<<<<<<<<<<<<<
 *                 self.m44 = value[3]
 *             else:
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m34 = __pyx_t_6;

      /* "cgtypes.pyx":3507
 *                 self.m24 = value[1]
 *                 self.m34 = value[2]
 *                 self.m44 = value[3]             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IndexError, "index out of range"
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3507; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->m44 = __pyx_t_6;
      break;
      default:

      /* "cgtypes.pyx":3509
 *                 self.m44 = value[3]
 *             else:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 *         elif T==tuple:
 *             if len(key)!=2:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      break;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":3510
 *             else:
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:             # <<<<<<<<<<<<<<
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyTuple_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3511
 *                 raise IndexError, "index out of range"
 *         elif T==tuple:
 *             if len(key)!=2:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = ((__pyx_t_4 != 2) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3512
 *         elif T==tuple:
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"             # <<<<<<<<<<<<<<
 *             i = key[0]
 *             j = key[1]
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_index_tuple_must_be_a_2_tuple, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3513
 *             if len(key)!=2:
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]             # <<<<<<<<<<<<<<
 *             j = key[1]
 *             v = value
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_i = __pyx_t_5;

    /* "cgtypes.pyx":3514
 *                 raise ValueError, "index tuple must be a 2-tuple"
 *             i = key[0]
 *             j = key[1]             # <<<<<<<<<<<<<<
 *             v = value
 *             if i<0 or i>3 or j<0 or j>3:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_key, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_j = __pyx_t_5;

    /* "cgtypes.pyx":3515
 *             i = key[0]
 *             j = key[1]
 *             v = value             # <<<<<<<<<<<<<<
 *             if i<0 or i>3 or j<0 or j>3:
 *                 raise IndexError, "index out of range"
 */
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_v = __pyx_t_6;

    /* "cgtypes.pyx":3516
 *             j = key[1]
 *             v = value
 *             if i<0 or i>3 or j<0 or j>3:             # <<<<<<<<<<<<<<
 *                 raise IndexError, "index out of range"
 * 
 */
    __pyx_t_3 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_i > 3) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_j > 3) != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cgtypes.pyx":3517
 *             v = value
 *             if i<0 or i>3 or j<0 or j>3:
 *                 raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *             if i==0:
 */
      __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":3546
 *                 elif j==3:
 *                     self.m34 = v
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m41 = v
 */
    switch (__pyx_v_i) {

      /* "cgtypes.pyx":3519
 *                 raise IndexError, "index out of range"
 * 
 *             if i==0:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m11 = v
 */
      case 0:

      /* "cgtypes.pyx":3520
 * 
 *             if i==0:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m11 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3521
 *             if i==0:
 *                 if j==0:
 *                     self.m11 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m12 = v
 */
        __pyx_v_self->m11 = __pyx_v_v;
        goto __pyx_L13;
      }

      /* "cgtypes.pyx":3522
 *                 if j==0:
 *                     self.m11 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m12 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3523
 *                     self.m11 = v
 *                 elif j==1:
 *                     self.m12 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m13 = v
 */
        __pyx_v_self->m12 = __pyx_v_v;
        goto __pyx_L13;
      }

      /* "cgtypes.pyx":3524
 *                 elif j==1:
 *                     self.m12 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m13 = v
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3525
 *                     self.m12 = v
 *                 elif j==2:
 *                     self.m13 = v             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     self.m14 = v
 */
        __pyx_v_self->m13 = __pyx_v_v;
        goto __pyx_L13;
      }

      /* "cgtypes.pyx":3526
 *                 elif j==2:
 *                     self.m13 = v
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     self.m14 = v
 *             elif i==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3527
 *                     self.m13 = v
 *                 elif j==3:
 *                     self.m14 = v             # <<<<<<<<<<<<<<
 *             elif i==1:
 *                 if j==0:
 */
        __pyx_v_self->m14 = __pyx_v_v;
        goto __pyx_L13;
      }
      __pyx_L13:;
      break;

      /* "cgtypes.pyx":3528
 *                 elif j==3:
 *                     self.m14 = v
 *             elif i==1:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m21 = v
 */
      case 1:

      /* "cgtypes.pyx":3529
 *                     self.m14 = v
 *             elif i==1:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m21 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3530
 *             elif i==1:
 *                 if j==0:
 *                     self.m21 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m22 = v
 */
        __pyx_v_self->m21 = __pyx_v_v;
        goto __pyx_L14;
      }

      /* "cgtypes.pyx":3531
 *                 if j==0:
 *                     self.m21 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m22 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3532
 *                     self.m21 = v
 *                 elif j==1:
 *                     self.m22 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m23 = v
 */
        __pyx_v_self->m22 = __pyx_v_v;
        goto __pyx_L14;
      }

      /* "cgtypes.pyx":3533
 *                 elif j==1:
 *                     self.m22 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m23 = v
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3534
 *                     self.m22 = v
 *                 elif j==2:
 *                     self.m23 = v             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     self.m24 = v
 */
        __pyx_v_self->m23 = __pyx_v_v;
        goto __pyx_L14;
      }

      /* "cgtypes.pyx":3535
 *                 elif j==2:
 *                     self.m23 = v
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     self.m24 = v
 *             elif i==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3536
 *                     self.m23 = v
 *                 elif j==3:
 *                     self.m24 = v             # <<<<<<<<<<<<<<
 *             elif i==2:
 *                 if j==0:
 */
        __pyx_v_self->m24 = __pyx_v_v;
        goto __pyx_L14;
      }
      __pyx_L14:;
      break;

      /* "cgtypes.pyx":3537
 *                 elif j==3:
 *                     self.m24 = v
 *             elif i==2:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m31 = v
 */
      case 2:

      /* "cgtypes.pyx":3538
 *                     self.m24 = v
 *             elif i==2:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m31 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3539
 *             elif i==2:
 *                 if j==0:
 *                     self.m31 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m32 = v
 */
        __pyx_v_self->m31 = __pyx_v_v;
        goto __pyx_L15;
      }

      /* "cgtypes.pyx":3540
 *                 if j==0:
 *                     self.m31 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m32 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3541
 *                     self.m31 = v
 *                 elif j==1:
 *                     self.m32 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m33 = v
 */
        __pyx_v_self->m32 = __pyx_v_v;
        goto __pyx_L15;
      }

      /* "cgtypes.pyx":3542
 *                 elif j==1:
 *                     self.m32 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m33 = v
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3543
 *                     self.m32 = v
 *                 elif j==2:
 *                     self.m33 = v             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     self.m34 = v
 */
        __pyx_v_self->m33 = __pyx_v_v;
        goto __pyx_L15;
      }

      /* "cgtypes.pyx":3544
 *                 elif j==2:
 *                     self.m33 = v
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     self.m34 = v
 *             elif i==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3545
 *                     self.m33 = v
 *                 elif j==3:
 *                     self.m34 = v             # <<<<<<<<<<<<<<
 *             elif i==3:
 *                 if j==0:
 */
        __pyx_v_self->m34 = __pyx_v_v;
        goto __pyx_L15;
      }
      __pyx_L15:;
      break;

      /* "cgtypes.pyx":3546
 *                 elif j==3:
 *                     self.m34 = v
 *             elif i==3:             # <<<<<<<<<<<<<<
 *                 if j==0:
 *                     self.m41 = v
 */
      case 3:

      /* "cgtypes.pyx":3547
 *                     self.m34 = v
 *             elif i==3:
 *                 if j==0:             # <<<<<<<<<<<<<<
 *                     self.m41 = v
 *                 elif j==1:
 */
      __pyx_t_1 = ((__pyx_v_j == 0) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3548
 *             elif i==3:
 *                 if j==0:
 *                     self.m41 = v             # <<<<<<<<<<<<<<
 *                 elif j==1:
 *                     self.m42 = v
 */
        __pyx_v_self->m41 = __pyx_v_v;
        goto __pyx_L16;
      }

      /* "cgtypes.pyx":3549
 *                 if j==0:
 *                     self.m41 = v
 *                 elif j==1:             # <<<<<<<<<<<<<<
 *                     self.m42 = v
 *                 elif j==2:
 */
      __pyx_t_1 = ((__pyx_v_j == 1) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3550
 *                     self.m41 = v
 *                 elif j==1:
 *                     self.m42 = v             # <<<<<<<<<<<<<<
 *                 elif j==2:
 *                     self.m43 = v
 */
        __pyx_v_self->m42 = __pyx_v_v;
        goto __pyx_L16;
      }

      /* "cgtypes.pyx":3551
 *                 elif j==1:
 *                     self.m42 = v
 *                 elif j==2:             # <<<<<<<<<<<<<<
 *                     self.m43 = v
 *                 elif j==3:
 */
      __pyx_t_1 = ((__pyx_v_j == 2) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3552
 *                     self.m42 = v
 *                 elif j==2:
 *                     self.m43 = v             # <<<<<<<<<<<<<<
 *                 elif j==3:
 *                     self.m44 = v
 */
        __pyx_v_self->m43 = __pyx_v_v;
        goto __pyx_L16;
      }

      /* "cgtypes.pyx":3553
 *                 elif j==2:
 *                     self.m43 = v
 *                 elif j==3:             # <<<<<<<<<<<<<<
 *                     self.m44 = v
 *         else:
 */
      __pyx_t_1 = ((__pyx_v_j == 3) != 0);
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3554
 *                     self.m43 = v
 *                 elif j==3:
 *                     self.m44 = v             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"
 */
        __pyx_v_self->m44 = __pyx_v_v;
        goto __pyx_L16;
      }
      __pyx_L16:;
      break;
      default: break;
    }
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":3556
 *                     self.m44 = v
 *         else:
 *             raise TypeError,"index must be integer or 2-tuple"             # <<<<<<<<<<<<<<
 * 
 *     def getRow(self, idx):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer_or_2_tuple, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":3475
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         """Set a column or a single matrix element.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3558
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def getRow(self, idx):             # <<<<<<<<<<<<<<
 *         """Return row (as vec4)."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_43getRow(PyObject *__pyx_v_self, PyObject *__pyx_v_idx); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_42getRow[] = "Return row (as vec4).";
static PyObject *__pyx_pw_7cgtypes_4mat4_43getRow(PyObject *__pyx_v_self, PyObject *__pyx_v_idx) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getRow (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_42getRow(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_idx));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_42getRow(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getRow", 0);

  /* "cgtypes.pyx":3562
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":3563
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3564
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3566
 *             raise TypeError,"index must be integer"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             return vec4(self.m11, self.m12, self.m13, self.m14)
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_4;

  /* "cgtypes.pyx":3573
 *         elif i==2:
 *             return vec4(self.m31, self.m32, self.m33, self.m34)
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             return vec4(self.m41, self.m42, self.m43, self.m44)
 *         else:
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":3567
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             return vec4(self.m11, self.m12, self.m13, self.m14)
 *         elif i==1:
 */
    case 0:

    /* "cgtypes.pyx":3568
 *         i = idx
 *         if i==0:
 *             return vec4(self.m11, self.m12, self.m13, self.m14)             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             return vec4(self.m21, self.m22, self.m23, self.m24)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3569
 *         if i==0:
 *             return vec4(self.m11, self.m12, self.m13, self.m14)
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             return vec4(self.m21, self.m22, self.m23, self.m24)
 *         elif i==2:
 */
    case 1:

    /* "cgtypes.pyx":3570
 *             return vec4(self.m11, self.m12, self.m13, self.m14)
 *         elif i==1:
 *             return vec4(self.m21, self.m22, self.m23, self.m24)             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             return vec4(self.m31, self.m32, self.m33, self.m34)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3571
 *         elif i==1:
 *             return vec4(self.m21, self.m22, self.m23, self.m24)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec4(self.m31, self.m32, self.m33, self.m34)
 *         elif i==3:
 */
    case 2:

    /* "cgtypes.pyx":3572
 *             return vec4(self.m21, self.m22, self.m23, self.m24)
 *         elif i==2:
 *             return vec4(self.m31, self.m32, self.m33, self.m34)             # <<<<<<<<<<<<<<
 *         elif i==3:
 *             return vec4(self.m41, self.m42, self.m43, self.m44)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3573
 *         elif i==2:
 *             return vec4(self.m31, self.m32, self.m33, self.m34)
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             return vec4(self.m41, self.m42, self.m43, self.m44)
 *         else:
 */
    case 3:

    /* "cgtypes.pyx":3574
 *             return vec4(self.m31, self.m32, self.m33, self.m34)
 *         elif i==3:
 *             return vec4(self.m41, self.m42, self.m43, self.m44)             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":3576
 *             return vec4(self.m41, self.m42, self.m43, self.m44)
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def setRow(self, idx, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":3558
 *             raise TypeError,"index must be integer or 2-tuple"
 * 
 *     def getRow(self, idx):             # <<<<<<<<<<<<<<
 *         """Return row (as vec4)."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cgtypes.mat4.getRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3578
 *             raise IndexError, "index out of range"
 * 
 *     def setRow(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set row."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_45setRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_44setRow[] = "Set row.";
static PyObject *__pyx_pw_7cgtypes_4mat4_45setRow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setRow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setRow", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setRow") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_idx = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setRow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.setRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_44setRow(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_44setRow(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setRow", 0);

  /* "cgtypes.pyx":3582
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":3583
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3584
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         if len(value)!=4:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3586
 *             raise TypeError,"index must be integer"
 * 
 *         if len(value)!=4:             # <<<<<<<<<<<<<<
 *             raise ValueError, "4-sequence expected"
 * 
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((__pyx_t_4 != 4) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3587
 * 
 *         if len(value)!=4:
 *             raise ValueError, "4-sequence expected"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_4_sequence_expected, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3589
 *             raise ValueError, "4-sequence expected"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             self.m11 = value[0]
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_5;

  /* "cgtypes.pyx":3605
 *             self.m33 = value[2]
 *             self.m34 = value[3]
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             self.m41 = value[0]
 *             self.m42 = value[1]
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":3590
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             self.m11 = value[0]
 *             self.m12 = value[1]
 */
    case 0:

    /* "cgtypes.pyx":3591
 *         i = idx
 *         if i==0:
 *             self.m11 = value[0]             # <<<<<<<<<<<<<<
 *             self.m12 = value[1]
 *             self.m13 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3591; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_6;

    /* "cgtypes.pyx":3592
 *         if i==0:
 *             self.m11 = value[0]
 *             self.m12 = value[1]             # <<<<<<<<<<<<<<
 *             self.m13 = value[2]
 *             self.m14 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3592; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_6;

    /* "cgtypes.pyx":3593
 *             self.m11 = value[0]
 *             self.m12 = value[1]
 *             self.m13 = value[2]             # <<<<<<<<<<<<<<
 *             self.m14 = value[3]
 *         elif i==1:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_6;

    /* "cgtypes.pyx":3594
 *             self.m12 = value[1]
 *             self.m13 = value[2]
 *             self.m14 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             self.m21 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3594; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m14 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3595
 *             self.m13 = value[2]
 *             self.m14 = value[3]
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             self.m21 = value[0]
 *             self.m22 = value[1]
 */
    case 1:

    /* "cgtypes.pyx":3596
 *             self.m14 = value[3]
 *         elif i==1:
 *             self.m21 = value[0]             # <<<<<<<<<<<<<<
 *             self.m22 = value[1]
 *             self.m23 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3596; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_6;

    /* "cgtypes.pyx":3597
 *         elif i==1:
 *             self.m21 = value[0]
 *             self.m22 = value[1]             # <<<<<<<<<<<<<<
 *             self.m23 = value[2]
 *             self.m24 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3597; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_6;

    /* "cgtypes.pyx":3598
 *             self.m21 = value[0]
 *             self.m22 = value[1]
 *             self.m23 = value[2]             # <<<<<<<<<<<<<<
 *             self.m24 = value[3]
 *         elif i==2:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3598; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_6;

    /* "cgtypes.pyx":3599
 *             self.m22 = value[1]
 *             self.m23 = value[2]
 *             self.m24 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             self.m31 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m24 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3600
 *             self.m23 = value[2]
 *             self.m24 = value[3]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m31 = value[0]
 *             self.m32 = value[1]
 */
    case 2:

    /* "cgtypes.pyx":3601
 *             self.m24 = value[3]
 *         elif i==2:
 *             self.m31 = value[0]             # <<<<<<<<<<<<<<
 *             self.m32 = value[1]
 *             self.m33 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3601; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_6;

    /* "cgtypes.pyx":3602
 *         elif i==2:
 *             self.m31 = value[0]
 *             self.m32 = value[1]             # <<<<<<<<<<<<<<
 *             self.m33 = value[2]
 *             self.m34 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3602; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_6;

    /* "cgtypes.pyx":3603
 *             self.m31 = value[0]
 *             self.m32 = value[1]
 *             self.m33 = value[2]             # <<<<<<<<<<<<<<
 *             self.m34 = value[3]
 *         elif i==3:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3603; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_6;

    /* "cgtypes.pyx":3604
 *             self.m32 = value[1]
 *             self.m33 = value[2]
 *             self.m34 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==3:
 *             self.m41 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3604; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m34 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3605
 *             self.m33 = value[2]
 *             self.m34 = value[3]
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             self.m41 = value[0]
 *             self.m42 = value[1]
 */
    case 3:

    /* "cgtypes.pyx":3606
 *             self.m34 = value[3]
 *         elif i==3:
 *             self.m41 = value[0]             # <<<<<<<<<<<<<<
 *             self.m42 = value[1]
 *             self.m43 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3606; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m41 = __pyx_t_6;

    /* "cgtypes.pyx":3607
 *         elif i==3:
 *             self.m41 = value[0]
 *             self.m42 = value[1]             # <<<<<<<<<<<<<<
 *             self.m43 = value[2]
 *             self.m44 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3607; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m42 = __pyx_t_6;

    /* "cgtypes.pyx":3608
 *             self.m41 = value[0]
 *             self.m42 = value[1]
 *             self.m43 = value[2]             # <<<<<<<<<<<<<<
 *             self.m44 = value[3]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3608; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m43 = __pyx_t_6;

    /* "cgtypes.pyx":3609
 *             self.m42 = value[1]
 *             self.m43 = value[2]
 *             self.m44 = value[3]             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3609; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m44 = __pyx_t_6;
    break;
    default:

    /* "cgtypes.pyx":3611
 *             self.m44 = value[3]
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def getColumn(self, idx):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":3578
 *             raise IndexError, "index out of range"
 * 
 *     def setRow(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set row."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.setRow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3613
 *             raise IndexError, "index out of range"
 * 
 *     def getColumn(self, idx):             # <<<<<<<<<<<<<<
 *         """Return column (as vec4)."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_47getColumn(PyObject *__pyx_v_self, PyObject *__pyx_v_idx); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_46getColumn[] = "Return column (as vec4).";
static PyObject *__pyx_pw_7cgtypes_4mat4_47getColumn(PyObject *__pyx_v_self, PyObject *__pyx_v_idx) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getColumn (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_46getColumn(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_idx));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_46getColumn(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getColumn", 0);

  /* "cgtypes.pyx":3617
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":3618
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3619
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3621
 *             raise TypeError,"index must be integer"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             return vec4(self.m11, self.m21, self.m31, self.m41)
 */
  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_4;

  /* "cgtypes.pyx":3628
 *         elif i==2:
 *             return vec4(self.m13, self.m23, self.m33, self.m43)
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             return vec4(self.m14, self.m24, self.m34, self.m44)
 *         else:
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":3622
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             return vec4(self.m11, self.m21, self.m31, self.m41)
 *         elif i==1:
 */
    case 0:

    /* "cgtypes.pyx":3623
 *         i = idx
 *         if i==0:
 *             return vec4(self.m11, self.m21, self.m31, self.m41)             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             return vec4(self.m12, self.m22, self.m32, self.m42)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3624
 *         if i==0:
 *             return vec4(self.m11, self.m21, self.m31, self.m41)
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             return vec4(self.m12, self.m22, self.m32, self.m42)
 *         elif i==2:
 */
    case 1:

    /* "cgtypes.pyx":3625
 *             return vec4(self.m11, self.m21, self.m31, self.m41)
 *         elif i==1:
 *             return vec4(self.m12, self.m22, self.m32, self.m42)             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             return vec4(self.m13, self.m23, self.m33, self.m43)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3626
 *         elif i==1:
 *             return vec4(self.m12, self.m22, self.m32, self.m42)
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             return vec4(self.m13, self.m23, self.m33, self.m43)
 *         elif i==3:
 */
    case 2:

    /* "cgtypes.pyx":3627
 *             return vec4(self.m12, self.m22, self.m32, self.m42)
 *         elif i==2:
 *             return vec4(self.m13, self.m23, self.m33, self.m43)             # <<<<<<<<<<<<<<
 *         elif i==3:
 *             return vec4(self.m14, self.m24, self.m34, self.m44)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":3628
 *         elif i==2:
 *             return vec4(self.m13, self.m23, self.m33, self.m43)
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             return vec4(self.m14, self.m24, self.m34, self.m44)
 *         else:
 */
    case 3:

    /* "cgtypes.pyx":3629
 *             return vec4(self.m13, self.m23, self.m33, self.m43)
 *         elif i==3:
 *             return vec4(self.m14, self.m24, self.m34, self.m44)             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":3631
 *             return vec4(self.m14, self.m24, self.m34, self.m44)
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 *     def setColumn(self, idx, value):
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":3613
 *             raise IndexError, "index out of range"
 * 
 *     def getColumn(self, idx):             # <<<<<<<<<<<<<<
 *         """Return column (as vec4)."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cgtypes.mat4.getColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3633
 *             raise IndexError, "index out of range"
 * 
 *     def setColumn(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set column."""
 *         cdef int i
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_49setColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_48setColumn[] = "Set column.";
static PyObject *__pyx_pw_7cgtypes_4mat4_49setColumn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setColumn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_idx,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setColumn", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setColumn") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_idx = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setColumn", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.setColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_48setColumn(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_idx, __pyx_v_value);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_48setColumn(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_idx, PyObject *__pyx_v_value) {
  int __pyx_v_i;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("setColumn", 0);

  /* "cgtypes.pyx":3637
 *         cdef int i
 * 
 *         T=type(idx)             # <<<<<<<<<<<<<<
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_idx)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_idx)));

  /* "cgtypes.pyx":3638
 * 
 *         T=type(idx)
 *         if T!=int and T!=long:             # <<<<<<<<<<<<<<
 *             raise TypeError,"index must be integer"
 * 
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3639
 *         T=type(idx)
 *         if T!=int and T!=long:
 *             raise TypeError,"index must be integer"             # <<<<<<<<<<<<<<
 * 
 *         if len(value)!=4:
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_index_must_be_integer, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3641
 *             raise TypeError,"index must be integer"
 * 
 *         if len(value)!=4:             # <<<<<<<<<<<<<<
 *             raise ValueError, "4-sequence expected"
 * 
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((__pyx_t_4 != 4) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3642
 * 
 *         if len(value)!=4:
 *             raise ValueError, "4-sequence expected"             # <<<<<<<<<<<<<<
 * 
 *         i = idx
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_4_sequence_expected, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3644
 *             raise ValueError, "4-sequence expected"
 * 
 *         i = idx             # <<<<<<<<<<<<<<
 *         if i==0:
 *             self.m11 = value[0]
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_idx); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = __pyx_t_5;

  /* "cgtypes.pyx":3660
 *             self.m33 = value[2]
 *             self.m43 = value[3]
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             self.m14 = value[0]
 *             self.m24 = value[1]
 */
  switch (__pyx_v_i) {

    /* "cgtypes.pyx":3645
 * 
 *         i = idx
 *         if i==0:             # <<<<<<<<<<<<<<
 *             self.m11 = value[0]
 *             self.m21 = value[1]
 */
    case 0:

    /* "cgtypes.pyx":3646
 *         i = idx
 *         if i==0:
 *             self.m11 = value[0]             # <<<<<<<<<<<<<<
 *             self.m21 = value[1]
 *             self.m31 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3646; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m11 = __pyx_t_6;

    /* "cgtypes.pyx":3647
 *         if i==0:
 *             self.m11 = value[0]
 *             self.m21 = value[1]             # <<<<<<<<<<<<<<
 *             self.m31 = value[2]
 *             self.m41 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3647; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m21 = __pyx_t_6;

    /* "cgtypes.pyx":3648
 *             self.m11 = value[0]
 *             self.m21 = value[1]
 *             self.m31 = value[2]             # <<<<<<<<<<<<<<
 *             self.m41 = value[3]
 *         elif i==1:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3648; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m31 = __pyx_t_6;

    /* "cgtypes.pyx":3649
 *             self.m21 = value[1]
 *             self.m31 = value[2]
 *             self.m41 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==1:
 *             self.m12 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3649; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m41 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3650
 *             self.m31 = value[2]
 *             self.m41 = value[3]
 *         elif i==1:             # <<<<<<<<<<<<<<
 *             self.m12 = value[0]
 *             self.m22 = value[1]
 */
    case 1:

    /* "cgtypes.pyx":3651
 *             self.m41 = value[3]
 *         elif i==1:
 *             self.m12 = value[0]             # <<<<<<<<<<<<<<
 *             self.m22 = value[1]
 *             self.m32 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3651; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m12 = __pyx_t_6;

    /* "cgtypes.pyx":3652
 *         elif i==1:
 *             self.m12 = value[0]
 *             self.m22 = value[1]             # <<<<<<<<<<<<<<
 *             self.m32 = value[2]
 *             self.m42 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3652; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m22 = __pyx_t_6;

    /* "cgtypes.pyx":3653
 *             self.m12 = value[0]
 *             self.m22 = value[1]
 *             self.m32 = value[2]             # <<<<<<<<<<<<<<
 *             self.m42 = value[3]
 *         elif i==2:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3653; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m32 = __pyx_t_6;

    /* "cgtypes.pyx":3654
 *             self.m22 = value[1]
 *             self.m32 = value[2]
 *             self.m42 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==2:
 *             self.m13 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m42 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3655
 *             self.m32 = value[2]
 *             self.m42 = value[3]
 *         elif i==2:             # <<<<<<<<<<<<<<
 *             self.m13 = value[0]
 *             self.m23 = value[1]
 */
    case 2:

    /* "cgtypes.pyx":3656
 *             self.m42 = value[3]
 *         elif i==2:
 *             self.m13 = value[0]             # <<<<<<<<<<<<<<
 *             self.m23 = value[1]
 *             self.m33 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m13 = __pyx_t_6;

    /* "cgtypes.pyx":3657
 *         elif i==2:
 *             self.m13 = value[0]
 *             self.m23 = value[1]             # <<<<<<<<<<<<<<
 *             self.m33 = value[2]
 *             self.m43 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m23 = __pyx_t_6;

    /* "cgtypes.pyx":3658
 *             self.m13 = value[0]
 *             self.m23 = value[1]
 *             self.m33 = value[2]             # <<<<<<<<<<<<<<
 *             self.m43 = value[3]
 *         elif i==3:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3658; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m33 = __pyx_t_6;

    /* "cgtypes.pyx":3659
 *             self.m23 = value[1]
 *             self.m33 = value[2]
 *             self.m43 = value[3]             # <<<<<<<<<<<<<<
 *         elif i==3:
 *             self.m14 = value[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3659; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m43 = __pyx_t_6;
    break;

    /* "cgtypes.pyx":3660
 *             self.m33 = value[2]
 *             self.m43 = value[3]
 *         elif i==3:             # <<<<<<<<<<<<<<
 *             self.m14 = value[0]
 *             self.m24 = value[1]
 */
    case 3:

    /* "cgtypes.pyx":3661
 *             self.m43 = value[3]
 *         elif i==3:
 *             self.m14 = value[0]             # <<<<<<<<<<<<<<
 *             self.m24 = value[1]
 *             self.m34 = value[2]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3661; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m14 = __pyx_t_6;

    /* "cgtypes.pyx":3662
 *         elif i==3:
 *             self.m14 = value[0]
 *             self.m24 = value[1]             # <<<<<<<<<<<<<<
 *             self.m34 = value[2]
 *             self.m44 = value[3]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3662; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m24 = __pyx_t_6;

    /* "cgtypes.pyx":3663
 *             self.m14 = value[0]
 *             self.m24 = value[1]
 *             self.m34 = value[2]             # <<<<<<<<<<<<<<
 *             self.m44 = value[3]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m34 = __pyx_t_6;

    /* "cgtypes.pyx":3664
 *             self.m24 = value[1]
 *             self.m34 = value[2]
 *             self.m44 = value[3]             # <<<<<<<<<<<<<<
 *         else:
 *             raise IndexError, "index out of range"
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_value, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_self->m44 = __pyx_t_6;
    break;
    default:

    /* "cgtypes.pyx":3666
 *             self.m44 = value[3]
 *         else:
 *             raise IndexError, "index out of range"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_Raise(__pyx_builtin_IndexError, __pyx_kp_s_index_out_of_range, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":3633
 *             raise IndexError, "index out of range"
 * 
 *     def setColumn(self, idx, value):             # <<<<<<<<<<<<<<
 *         """Set column."""
 *         cdef int i
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.setColumn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3669
 * 
 * 
 *     def toList(self, rowmajor=0):             # <<<<<<<<<<<<<<
 *         """Return a list containing the matrix elements.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_51toList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_50toList[] = "Return a list containing the matrix elements.\n\n        By default the list is in column-major order (which can directly be\n        used in OpenGL or RenderMan). If you set the optional argument\n        rowmajor to 1, you'll get the list in row-major order.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M.toList()\n        [1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]\n        >>> print M.toList(rowmajor=1)\n        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_51toList(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rowmajor = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toList (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rowmajor,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rowmajor);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "toList") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rowmajor = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("toList", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3669; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.toList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_50toList(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_rowmajor);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_50toList(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_rowmajor) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toList", 0);

  /* "cgtypes.pyx":3682
 *         [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
 *         """
 *         if rowmajor:             # <<<<<<<<<<<<<<
 *             return [self.m11, self.m12, self.m13, self.m14,
 *                     self.m21, self.m22, self.m23, self.m24,
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_rowmajor); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":3683
 *         """
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13, self.m14,             # <<<<<<<<<<<<<<
 *                     self.m21, self.m22, self.m23, self.m24,
 *                     self.m31, self.m32, self.m33, self.m34,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "cgtypes.pyx":3684
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13, self.m14,
 *                     self.m21, self.m22, self.m23, self.m24,             # <<<<<<<<<<<<<<
 *                     self.m31, self.m32, self.m33, self.m34,
 *                     self.m41, self.m42, self.m43, self.m44]
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);

    /* "cgtypes.pyx":3685
 *             return [self.m11, self.m12, self.m13, self.m14,
 *                     self.m21, self.m22, self.m23, self.m24,
 *                     self.m31, self.m32, self.m33, self.m34,             # <<<<<<<<<<<<<<
 *                     self.m41, self.m42, self.m43, self.m44]
 *         else:
 */
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);

    /* "cgtypes.pyx":3686
 *                     self.m21, self.m22, self.m23, self.m24,
 *                     self.m31, self.m32, self.m33, self.m34,
 *                     self.m41, self.m42, self.m43, self.m44]             # <<<<<<<<<<<<<<
 *         else:
 *             return [self.m11, self.m21, self.m31, self.m41,
 */
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);

    /* "cgtypes.pyx":3683
 *         """
 *         if rowmajor:
 *             return [self.m11, self.m12, self.m13, self.m14,             # <<<<<<<<<<<<<<
 *                     self.m21, self.m22, self.m23, self.m24,
 *                     self.m31, self.m32, self.m33, self.m34,
 */
    __pyx_t_18 = PyList_New(16); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3683; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_18);
    PyList_SET_ITEM(__pyx_t_18, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_18, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_18, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_18, 3, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_18, 4, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_18, 5, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_18, 6, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_18, 7, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_18, 8, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_18, 9, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    PyList_SET_ITEM(__pyx_t_18, 10, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    PyList_SET_ITEM(__pyx_t_18, 11, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    PyList_SET_ITEM(__pyx_t_18, 12, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    PyList_SET_ITEM(__pyx_t_18, 13, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_15);
    PyList_SET_ITEM(__pyx_t_18, 14, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_16);
    PyList_SET_ITEM(__pyx_t_18, 15, __pyx_t_17);
    __Pyx_GIVEREF(__pyx_t_17);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_t_14 = 0;
    __pyx_t_15 = 0;
    __pyx_t_16 = 0;
    __pyx_t_17 = 0;
    __pyx_r = __pyx_t_18;
    __pyx_t_18 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":3688
 *                     self.m41, self.m42, self.m43, self.m44]
 *         else:
 *             return [self.m11, self.m21, self.m31, self.m41,             # <<<<<<<<<<<<<<
 *                     self.m12, self.m22, self.m32, self.m42,
 *                     self.m13, self.m23, self.m33, self.m43,
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_18 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_17 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_16 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->m41); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);

    /* "cgtypes.pyx":3689
 *         else:
 *             return [self.m11, self.m21, self.m31, self.m41,
 *                     self.m12, self.m22, self.m32, self.m42,             # <<<<<<<<<<<<<<
 *                     self.m13, self.m23, self.m33, self.m43,
 *                     self.m14, self.m24, self.m34, self.m44]
 */
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->m42); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);

    /* "cgtypes.pyx":3690
 *             return [self.m11, self.m21, self.m31, self.m41,
 *                     self.m12, self.m22, self.m32, self.m42,
 *                     self.m13, self.m23, self.m33, self.m43,             # <<<<<<<<<<<<<<
 *                     self.m14, self.m24, self.m34, self.m44]
 * 
 */
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m43); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "cgtypes.pyx":3691
 *                     self.m12, self.m22, self.m32, self.m42,
 *                     self.m13, self.m23, self.m33, self.m43,
 *                     self.m14, self.m24, self.m34, self.m44]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m44); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "cgtypes.pyx":3688
 *                     self.m41, self.m42, self.m43, self.m44]
 *         else:
 *             return [self.m11, self.m21, self.m31, self.m41,             # <<<<<<<<<<<<<<
 *                     self.m12, self.m22, self.m32, self.m42,
 *                     self.m13, self.m23, self.m33, self.m43,
 */
    __pyx_t_2 = PyList_New(16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
    __Pyx_GIVEREF(__pyx_t_18);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_17);
    __Pyx_GIVEREF(__pyx_t_17);
    PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_16);
    __Pyx_GIVEREF(__pyx_t_16);
    PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_15);
    PyList_SET_ITEM(__pyx_t_2, 4, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_14);
    PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    PyList_SET_ITEM(__pyx_t_2, 7, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_11);
    PyList_SET_ITEM(__pyx_t_2, 8, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    PyList_SET_ITEM(__pyx_t_2, 9, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_2, 10, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_2, 11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyList_SET_ITEM(__pyx_t_2, 12, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_2, 13, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_2, 14, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_2, 15, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_18 = 0;
    __pyx_t_17 = 0;
    __pyx_t_16 = 0;
    __pyx_t_15 = 0;
    __pyx_t_14 = 0;
    __pyx_t_13 = 0;
    __pyx_t_12 = 0;
    __pyx_t_11 = 0;
    __pyx_t_10 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":3669
 * 
 * 
 *     def toList(self, rowmajor=0):             # <<<<<<<<<<<<<<
 *         """Return a list containing the matrix elements.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("cgtypes.mat4.toList", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3694
 * 
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         """Return identity matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_53identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_52identity[] = "Return identity matrix.\n\n        >>> print mat4().identity()\n        [   1.0000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    1.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    1.0000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    1.0000]\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_53identity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("identity (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_52identity(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_52identity(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("identity", 0);

  /* "cgtypes.pyx":3704
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3705
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = 1.0             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  __pyx_v_res->m11 = 1.0;

  /* "cgtypes.pyx":3706
 *         res = mat4()
 *         res.m11 = 1.0
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m14 = 0.0
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":3707
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":3708
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m14 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 */
  __pyx_v_res->m14 = 0.0;

  /* "cgtypes.pyx":3709
 *         res.m13 = 0.0
 *         res.m14 = 0.0
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":3710
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 *         res.m22 = 1.0             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m24 = 0.0
 */
  __pyx_v_res->m22 = 1.0;

  /* "cgtypes.pyx":3711
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":3712
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 *         res.m24 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_v_res->m24 = 0.0;

  /* "cgtypes.pyx":3713
 *         res.m23 = 0.0
 *         res.m24 = 0.0
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":3714
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = 1.0
 *         res.m34 = 0.0
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":3715
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = 1.0             # <<<<<<<<<<<<<<
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 */
  __pyx_v_res->m33 = 1.0;

  /* "cgtypes.pyx":3716
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 *         res.m34 = 0.0             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_v_res->m34 = 0.0;

  /* "cgtypes.pyx":3717
 *         res.m33 = 1.0
 *         res.m34 = 0.0
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":3718
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":3719
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":3720
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":3721
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def transpose(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3694
 * 
 * 
 *     def identity(self):             # <<<<<<<<<<<<<<
 *         """Return identity matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.identity", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3723
 *         return res
 * 
 *     def transpose(self):             # <<<<<<<<<<<<<<
 *         """Return transpose matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_55transpose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_54transpose[] = "Return transpose matrix.\n\n        >>> M=mat4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)\n        >>> print M.transpose()\n        [   1.0000,    5.0000,    9.0000,   13.0000]\n        [   2.0000,    6.0000,   10.0000,   14.0000]\n        [   3.0000,    7.0000,   11.0000,   15.0000]\n        [   4.0000,    8.0000,   12.0000,   16.0000]\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_55transpose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transpose (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_54transpose(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_54transpose(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("transpose", 0);

  /* "cgtypes.pyx":3734
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = self.m11
 *         res.m12 = self.m21
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3735
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = self.m21
 *         res.m13 = self.m31
 */
  __pyx_t_2 = __pyx_v_self->m11;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":3736
 *         res = mat4()
 *         res.m11 = self.m11
 *         res.m12 = self.m21             # <<<<<<<<<<<<<<
 *         res.m13 = self.m31
 *         res.m14 = self.m41
 */
  __pyx_t_2 = __pyx_v_self->m21;
  __pyx_v_res->m12 = __pyx_t_2;

  /* "cgtypes.pyx":3737
 *         res.m11 = self.m11
 *         res.m12 = self.m21
 *         res.m13 = self.m31             # <<<<<<<<<<<<<<
 *         res.m14 = self.m41
 *         res.m21 = self.m12
 */
  __pyx_t_2 = __pyx_v_self->m31;
  __pyx_v_res->m13 = __pyx_t_2;

  /* "cgtypes.pyx":3738
 *         res.m12 = self.m21
 *         res.m13 = self.m31
 *         res.m14 = self.m41             # <<<<<<<<<<<<<<
 *         res.m21 = self.m12
 *         res.m22 = self.m22
 */
  __pyx_t_2 = __pyx_v_self->m41;
  __pyx_v_res->m14 = __pyx_t_2;

  /* "cgtypes.pyx":3739
 *         res.m13 = self.m31
 *         res.m14 = self.m41
 *         res.m21 = self.m12             # <<<<<<<<<<<<<<
 *         res.m22 = self.m22
 *         res.m23 = self.m32
 */
  __pyx_t_2 = __pyx_v_self->m12;
  __pyx_v_res->m21 = __pyx_t_2;

  /* "cgtypes.pyx":3740
 *         res.m14 = self.m41
 *         res.m21 = self.m12
 *         res.m22 = self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = self.m32
 *         res.m24 = self.m42
 */
  __pyx_t_2 = __pyx_v_self->m22;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":3741
 *         res.m21 = self.m12
 *         res.m22 = self.m22
 *         res.m23 = self.m32             # <<<<<<<<<<<<<<
 *         res.m24 = self.m42
 *         res.m31 = self.m13
 */
  __pyx_t_2 = __pyx_v_self->m32;
  __pyx_v_res->m23 = __pyx_t_2;

  /* "cgtypes.pyx":3742
 *         res.m22 = self.m22
 *         res.m23 = self.m32
 *         res.m24 = self.m42             # <<<<<<<<<<<<<<
 *         res.m31 = self.m13
 *         res.m32 = self.m23
 */
  __pyx_t_2 = __pyx_v_self->m42;
  __pyx_v_res->m24 = __pyx_t_2;

  /* "cgtypes.pyx":3743
 *         res.m23 = self.m32
 *         res.m24 = self.m42
 *         res.m31 = self.m13             # <<<<<<<<<<<<<<
 *         res.m32 = self.m23
 *         res.m33 = self.m33
 */
  __pyx_t_2 = __pyx_v_self->m13;
  __pyx_v_res->m31 = __pyx_t_2;

  /* "cgtypes.pyx":3744
 *         res.m24 = self.m42
 *         res.m31 = self.m13
 *         res.m32 = self.m23             # <<<<<<<<<<<<<<
 *         res.m33 = self.m33
 *         res.m34 = self.m43
 */
  __pyx_t_2 = __pyx_v_self->m23;
  __pyx_v_res->m32 = __pyx_t_2;

  /* "cgtypes.pyx":3745
 *         res.m31 = self.m13
 *         res.m32 = self.m23
 *         res.m33 = self.m33             # <<<<<<<<<<<<<<
 *         res.m34 = self.m43
 *         res.m41 = self.m14
 */
  __pyx_t_2 = __pyx_v_self->m33;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":3746
 *         res.m32 = self.m23
 *         res.m33 = self.m33
 *         res.m34 = self.m43             # <<<<<<<<<<<<<<
 *         res.m41 = self.m14
 *         res.m42 = self.m24
 */
  __pyx_t_2 = __pyx_v_self->m43;
  __pyx_v_res->m34 = __pyx_t_2;

  /* "cgtypes.pyx":3747
 *         res.m33 = self.m33
 *         res.m34 = self.m43
 *         res.m41 = self.m14             # <<<<<<<<<<<<<<
 *         res.m42 = self.m24
 *         res.m43 = self.m34
 */
  __pyx_t_2 = __pyx_v_self->m14;
  __pyx_v_res->m41 = __pyx_t_2;

  /* "cgtypes.pyx":3748
 *         res.m34 = self.m43
 *         res.m41 = self.m14
 *         res.m42 = self.m24             # <<<<<<<<<<<<<<
 *         res.m43 = self.m34
 *         res.m44 = self.m44
 */
  __pyx_t_2 = __pyx_v_self->m24;
  __pyx_v_res->m42 = __pyx_t_2;

  /* "cgtypes.pyx":3749
 *         res.m41 = self.m14
 *         res.m42 = self.m24
 *         res.m43 = self.m34             # <<<<<<<<<<<<<<
 *         res.m44 = self.m44
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->m34;
  __pyx_v_res->m43 = __pyx_t_2;

  /* "cgtypes.pyx":3750
 *         res.m42 = self.m24
 *         res.m43 = self.m34
 *         res.m44 = self.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->m44;
  __pyx_v_res->m44 = __pyx_t_2;

  /* "cgtypes.pyx":3751
 *         res.m43 = self.m34
 *         res.m44 = self.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def determinant(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3723
 *         return res
 * 
 *     def transpose(self):             # <<<<<<<<<<<<<<
 *         """Return transpose matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.transpose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3753
 *         return res
 * 
 *     def determinant(self):             # <<<<<<<<<<<<<<
 *         """Return determinant.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_57determinant(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_56determinant[] = "Return determinant.\n\n        >>> M=mat4(2.0,0,0,0, 0,2.0,0,0, 0,0,2.0,0, 0,0,0,2.0)\n        >>> print M.determinant()\n        16.0\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_57determinant(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("determinant (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_56determinant(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_56determinant(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("determinant", 0);

  /* "cgtypes.pyx":3760
 *         16.0
 *         """
 *         return self.m11*self.m22*self.m33*self.m44 \             # <<<<<<<<<<<<<<
 *                -self.m11*self.m22*self.m34*self.m43 \
 *                +self.m11*self.m23*self.m34*self.m42 \
 */
  __Pyx_XDECREF(__pyx_r);

  /* "cgtypes.pyx":3783
 *                +self.m14*self.m22*self.m31*self.m43 \
 *                -self.m14*self.m23*self.m31*self.m42 \
 *                +self.m14*self.m23*self.m32*self.m41             # <<<<<<<<<<<<<<
 * 
 *     def _submat(self, mat3 M3, i,j):
 */
  __pyx_t_1 = PyFloat_FromDouble(((((((((((((((((((((((((((__pyx_v_self->m11 * __pyx_v_self->m22) * __pyx_v_self->m33) * __pyx_v_self->m44) - (((__pyx_v_self->m11 * __pyx_v_self->m22) * __pyx_v_self->m34) * __pyx_v_self->m43)) + (((__pyx_v_self->m11 * __pyx_v_self->m23) * __pyx_v_self->m34) * __pyx_v_self->m42)) - (((__pyx_v_self->m11 * __pyx_v_self->m23) * __pyx_v_self->m32) * __pyx_v_self->m44)) + (((__pyx_v_self->m11 * __pyx_v_self->m24) * __pyx_v_self->m32) * __pyx_v_self->m43)) - (((__pyx_v_self->m11 * __pyx_v_self->m24) * __pyx_v_self->m33) * __pyx_v_self->m42)) - (((__pyx_v_self->m12 * __pyx_v_self->m23) * __pyx_v_self->m34) * __pyx_v_self->m41)) + (((__pyx_v_self->m12 * __pyx_v_self->m23) * __pyx_v_self->m31) * __pyx_v_self->m44)) - (((__pyx_v_self->m12 * __pyx_v_self->m24) * __pyx_v_self->m31) * __pyx_v_self->m43)) + (((__pyx_v_self->m12 * __pyx_v_self->m24) * __pyx_v_self->m33) * __pyx_v_self->m41)) - (((__pyx_v_self->m12 * __pyx_v_self->m21) * __pyx_v_self->m33) * __pyx_v_self->m44)) + (((__pyx_v_self->m12 * __pyx_v_self->m21) * __pyx_v_self->m34) * __pyx_v_self->m43)) + (((__pyx_v_self->m13 * __pyx_v_self->m24) * __pyx_v_self->m31) * __pyx_v_self->m42)) - (((__pyx_v_self->m13 * __pyx_v_self->m24) * __pyx_v_self->m32) * __pyx_v_self->m41)) + (((__pyx_v_self->m13 * __pyx_v_self->m21) * __pyx_v_self->m32) * __pyx_v_self->m44)) - (((__pyx_v_self->m13 * __pyx_v_self->m21) * __pyx_v_self->m34) * __pyx_v_self->m42)) + (((__pyx_v_self->m13 * __pyx_v_self->m22) * __pyx_v_self->m34) * __pyx_v_self->m41)) - (((__pyx_v_self->m13 * __pyx_v_self->m22) * __pyx_v_self->m31) * __pyx_v_self->m44)) - (((__pyx_v_self->m14 * __pyx_v_self->m21) * __pyx_v_self->m32) * __pyx_v_self->m43)) + (((__pyx_v_self->m14 * __pyx_v_self->m21) * __pyx_v_self->m33) * __pyx_v_self->m42)) - (((__pyx_v_self->m14 * __pyx_v_self->m22) * __pyx_v_self->m33) * __pyx_v_self->m41)) + (((__pyx_v_self->m14 * __pyx_v_self->m22) * __pyx_v_self->m31) * __pyx_v_self->m43)) - (((__pyx_v_self->m14 * __pyx_v_self->m23) * __pyx_v_self->m31) * __pyx_v_self->m42)) + (((__pyx_v_self->m14 * __pyx_v_self->m23) * __pyx_v_self->m32) * __pyx_v_self->m41))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":3753
 *         return res
 * 
 *     def determinant(self):             # <<<<<<<<<<<<<<
 *         """Return determinant.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.determinant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3785
 *                +self.m14*self.m23*self.m32*self.m41
 * 
 *     def _submat(self, mat3 M3, i,j):             # <<<<<<<<<<<<<<
 *         cdef int k,l
 *         cdef double v
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_59_submat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4mat4_59_submat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_M3 = 0;
  PyObject *__pyx_v_i = 0;
  PyObject *__pyx_v_j = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_submat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M3,&__pyx_n_s_i,&__pyx_n_s_j,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_M3)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_submat", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_submat", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_submat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_M3 = ((struct __pyx_obj_7cgtypes_mat3 *)values[0]);
    __pyx_v_i = values[1];
    __pyx_v_j = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_submat", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4._submat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_M3), __pyx_ptype_7cgtypes_mat3, 1, "M3", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_58_submat(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_M3, __pyx_v_i, __pyx_v_j);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_58_submat(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_M3, PyObject *__pyx_v_i, PyObject *__pyx_v_j) {
  int __pyx_v_k;
  int __pyx_v_l;
  double __pyx_v_v;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_submat", 0);

  /* "cgtypes.pyx":3790
 * 
 * #        M=mat3()
 *         k=0             # <<<<<<<<<<<<<<
 *         while k<3:
 *             l=0
 */
  __pyx_v_k = 0;

  /* "cgtypes.pyx":3791
 * #        M=mat3()
 *         k=0
 *         while k<3:             # <<<<<<<<<<<<<<
 *             l=0
 *             while l<3:
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_k < 3) != 0);
    if (!__pyx_t_1) break;

    /* "cgtypes.pyx":3792
 *         k=0
 *         while k<3:
 *             l=0             # <<<<<<<<<<<<<<
 *             while l<3:
 *                 t=(k,l)
 */
    __pyx_v_l = 0;

    /* "cgtypes.pyx":3793
 *         while k<3:
 *             l=0
 *             while l<3:             # <<<<<<<<<<<<<<
 *                 t=(k,l)
 *                 if k>=i:
 */
    while (1) {
      __pyx_t_1 = ((__pyx_v_l < 3) != 0);
      if (!__pyx_t_1) break;

      /* "cgtypes.pyx":3794
 *             l=0
 *             while l<3:
 *                 t=(k,l)             # <<<<<<<<<<<<<<
 *                 if k>=i:
 *                     t=(k+1,t[1])
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "cgtypes.pyx":3795
 *             while l<3:
 *                 t=(k,l)
 *                 if k>=i:             # <<<<<<<<<<<<<<
 *                     t=(k+1,t[1])
 *                 if l>=j:
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_v_i, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3796
 *                 t=(k,l)
 *                 if k>=i:
 *                     t=(k+1,t[1])             # <<<<<<<<<<<<<<
 *                 if l>=j:
 *                     t=(t[0],l+1)
 */
        __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_t, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "cgtypes.pyx":3797
 *                 if k>=i:
 *                     t=(k+1,t[1])
 *                 if l>=j:             # <<<<<<<<<<<<<<
 *                     t=(t[0],l+1)
 * 
 */
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_v_j, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3798
 *                     t=(k+1,t[1])
 *                 if l>=j:
 *                     t=(t[0],l+1)             # <<<<<<<<<<<<<<
 * 
 * #                M3[k,l] = self[t]
 */
        __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_t, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3798; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_l + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_4 = 0;
        __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_3));
        __pyx_t_3 = 0;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "cgtypes.pyx":3801
 * 
 * #                M3[k,l] = self[t]
 *                 v = self[t]             # <<<<<<<<<<<<<<
 *                 if k==0 and l==0:
 *                     M3.m11 = v
 */
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_t); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3801; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_v = __pyx_t_5;

      /* "cgtypes.pyx":3802
 * #                M3[k,l] = self[t]
 *                 v = self[t]
 *                 if k==0 and l==0:             # <<<<<<<<<<<<<<
 *                     M3.m11 = v
 *                 if k==0 and l==1:
 */
      __pyx_t_6 = ((__pyx_v_k == 0) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 0) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3803
 *                 v = self[t]
 *                 if k==0 and l==0:
 *                     M3.m11 = v             # <<<<<<<<<<<<<<
 *                 if k==0 and l==1:
 *                     M3.m12 = v
 */
        __pyx_v_M3->m11 = __pyx_v_v;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":3804
 *                 if k==0 and l==0:
 *                     M3.m11 = v
 *                 if k==0 and l==1:             # <<<<<<<<<<<<<<
 *                     M3.m12 = v
 *                 if k==0 and l==2:
 */
      __pyx_t_6 = ((__pyx_v_k == 0) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 1) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3805
 *                     M3.m11 = v
 *                 if k==0 and l==1:
 *                     M3.m12 = v             # <<<<<<<<<<<<<<
 *                 if k==0 and l==2:
 *                     M3.m13 = v
 */
        __pyx_v_M3->m12 = __pyx_v_v;
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "cgtypes.pyx":3806
 *                 if k==0 and l==1:
 *                     M3.m12 = v
 *                 if k==0 and l==2:             # <<<<<<<<<<<<<<
 *                     M3.m13 = v
 *                 if k==1 and l==0:
 */
      __pyx_t_6 = ((__pyx_v_k == 0) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L16_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 2) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L16_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3807
 *                     M3.m12 = v
 *                 if k==0 and l==2:
 *                     M3.m13 = v             # <<<<<<<<<<<<<<
 *                 if k==1 and l==0:
 *                     M3.m21 = v
 */
        __pyx_v_M3->m13 = __pyx_v_v;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "cgtypes.pyx":3808
 *                 if k==0 and l==2:
 *                     M3.m13 = v
 *                 if k==1 and l==0:             # <<<<<<<<<<<<<<
 *                     M3.m21 = v
 *                 if k==1 and l==1:
 */
      __pyx_t_6 = ((__pyx_v_k == 1) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L19_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 0) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L19_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3809
 *                     M3.m13 = v
 *                 if k==1 and l==0:
 *                     M3.m21 = v             # <<<<<<<<<<<<<<
 *                 if k==1 and l==1:
 *                     M3.m22 = v
 */
        __pyx_v_M3->m21 = __pyx_v_v;
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "cgtypes.pyx":3810
 *                 if k==1 and l==0:
 *                     M3.m21 = v
 *                 if k==1 and l==1:             # <<<<<<<<<<<<<<
 *                     M3.m22 = v
 *                 if k==1 and l==2:
 */
      __pyx_t_6 = ((__pyx_v_k == 1) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 1) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L22_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3811
 *                     M3.m21 = v
 *                 if k==1 and l==1:
 *                     M3.m22 = v             # <<<<<<<<<<<<<<
 *                 if k==1 and l==2:
 *                     M3.m23 = v
 */
        __pyx_v_M3->m22 = __pyx_v_v;
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "cgtypes.pyx":3812
 *                 if k==1 and l==1:
 *                     M3.m22 = v
 *                 if k==1 and l==2:             # <<<<<<<<<<<<<<
 *                     M3.m23 = v
 *                 if k==2 and l==0:
 */
      __pyx_t_6 = ((__pyx_v_k == 1) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 2) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L25_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3813
 *                     M3.m22 = v
 *                 if k==1 and l==2:
 *                     M3.m23 = v             # <<<<<<<<<<<<<<
 *                 if k==2 and l==0:
 *                     M3.m31 = v
 */
        __pyx_v_M3->m23 = __pyx_v_v;
        goto __pyx_L24;
      }
      __pyx_L24:;

      /* "cgtypes.pyx":3814
 *                 if k==1 and l==2:
 *                     M3.m23 = v
 *                 if k==2 and l==0:             # <<<<<<<<<<<<<<
 *                     M3.m31 = v
 *                 if k==2 and l==1:
 */
      __pyx_t_6 = ((__pyx_v_k == 2) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 0) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3815
 *                     M3.m23 = v
 *                 if k==2 and l==0:
 *                     M3.m31 = v             # <<<<<<<<<<<<<<
 *                 if k==2 and l==1:
 *                     M3.m32 = v
 */
        __pyx_v_M3->m31 = __pyx_v_v;
        goto __pyx_L27;
      }
      __pyx_L27:;

      /* "cgtypes.pyx":3816
 *                 if k==2 and l==0:
 *                     M3.m31 = v
 *                 if k==2 and l==1:             # <<<<<<<<<<<<<<
 *                     M3.m32 = v
 *                 if k==2 and l==2:
 */
      __pyx_t_6 = ((__pyx_v_k == 2) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L31_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 1) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L31_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3817
 *                     M3.m31 = v
 *                 if k==2 and l==1:
 *                     M3.m32 = v             # <<<<<<<<<<<<<<
 *                 if k==2 and l==2:
 *                     M3.m33 = v
 */
        __pyx_v_M3->m32 = __pyx_v_v;
        goto __pyx_L30;
      }
      __pyx_L30:;

      /* "cgtypes.pyx":3818
 *                 if k==2 and l==1:
 *                     M3.m32 = v
 *                 if k==2 and l==2:             # <<<<<<<<<<<<<<
 *                     M3.m33 = v
 * 
 */
      __pyx_t_6 = ((__pyx_v_k == 2) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_v_l == 2) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L34_bool_binop_done:;
      if (__pyx_t_1) {

        /* "cgtypes.pyx":3819
 *                     M3.m32 = v
 *                 if k==2 and l==2:
 *                     M3.m33 = v             # <<<<<<<<<<<<<<
 * 
 *                 l=l+1
 */
        __pyx_v_M3->m33 = __pyx_v_v;
        goto __pyx_L33;
      }
      __pyx_L33:;

      /* "cgtypes.pyx":3821
 *                     M3.m33 = v
 * 
 *                 l=l+1             # <<<<<<<<<<<<<<
 *             k=k+1
 *         return M3
 */
      __pyx_v_l = (__pyx_v_l + 1);
    }

    /* "cgtypes.pyx":3822
 * 
 *                 l=l+1
 *             k=k+1             # <<<<<<<<<<<<<<
 *         return M3
 * 
 */
    __pyx_v_k = (__pyx_v_k + 1);
  }

  /* "cgtypes.pyx":3823
 *                 l=l+1
 *             k=k+1
 *         return M3             # <<<<<<<<<<<<<<
 * 
 *     def inverse(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_M3));
  __pyx_r = ((PyObject *)__pyx_v_M3);
  goto __pyx_L0;

  /* "cgtypes.pyx":3785
 *                +self.m14*self.m23*self.m32*self.m41
 * 
 *     def _submat(self, mat3 M3, i,j):             # <<<<<<<<<<<<<<
 *         cdef int k,l
 *         cdef double v
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.mat4._submat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3825
 *         return M3
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_61inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_60inverse[] = "Return inverse matrix.\n\n        >>> M=mat4(0,-2.0,0,0, 2.0,0,0,0, 0,0,2,0, 0,0,0,2)\n        >>> print M.inverse()\n        [   0.0000,    0.5000,    0.0000,    0.0000]\n        [  -0.5000,    0.0000,    0.0000,    0.0000]\n        [   0.0000,    0.0000,    0.5000,    0.0000]\n        [   0.0000,    0.0000,    0.0000,    0.5000]\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_61inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inverse (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_60inverse(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_60inverse(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  short __pyx_v_i;
  short __pyx_v_j;
  short __pyx_v_sign;
  double __pyx_v_m4[16];
  double __pyx_v_m4_res[16];
  double __pyx_v_det;
  double __pyx_v_d;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inverse", 0);

  /* "cgtypes.pyx":3841
 *         cdef double det, d
 * 
 *         m4[0] = self.m11             # <<<<<<<<<<<<<<
 *         m4[1] = self.m12
 *         m4[2] = self.m13
 */
  __pyx_t_1 = __pyx_v_self->m11;
  (__pyx_v_m4[0]) = __pyx_t_1;

  /* "cgtypes.pyx":3842
 * 
 *         m4[0] = self.m11
 *         m4[1] = self.m12             # <<<<<<<<<<<<<<
 *         m4[2] = self.m13
 *         m4[3] = self.m14
 */
  __pyx_t_1 = __pyx_v_self->m12;
  (__pyx_v_m4[1]) = __pyx_t_1;

  /* "cgtypes.pyx":3843
 *         m4[0] = self.m11
 *         m4[1] = self.m12
 *         m4[2] = self.m13             # <<<<<<<<<<<<<<
 *         m4[3] = self.m14
 *         m4[4] = self.m21
 */
  __pyx_t_1 = __pyx_v_self->m13;
  (__pyx_v_m4[2]) = __pyx_t_1;

  /* "cgtypes.pyx":3844
 *         m4[1] = self.m12
 *         m4[2] = self.m13
 *         m4[3] = self.m14             # <<<<<<<<<<<<<<
 *         m4[4] = self.m21
 *         m4[5] = self.m22
 */
  __pyx_t_1 = __pyx_v_self->m14;
  (__pyx_v_m4[3]) = __pyx_t_1;

  /* "cgtypes.pyx":3845
 *         m4[2] = self.m13
 *         m4[3] = self.m14
 *         m4[4] = self.m21             # <<<<<<<<<<<<<<
 *         m4[5] = self.m22
 *         m4[6] = self.m23
 */
  __pyx_t_1 = __pyx_v_self->m21;
  (__pyx_v_m4[4]) = __pyx_t_1;

  /* "cgtypes.pyx":3846
 *         m4[3] = self.m14
 *         m4[4] = self.m21
 *         m4[5] = self.m22             # <<<<<<<<<<<<<<
 *         m4[6] = self.m23
 *         m4[7] = self.m24
 */
  __pyx_t_1 = __pyx_v_self->m22;
  (__pyx_v_m4[5]) = __pyx_t_1;

  /* "cgtypes.pyx":3847
 *         m4[4] = self.m21
 *         m4[5] = self.m22
 *         m4[6] = self.m23             # <<<<<<<<<<<<<<
 *         m4[7] = self.m24
 *         m4[8] = self.m31
 */
  __pyx_t_1 = __pyx_v_self->m23;
  (__pyx_v_m4[6]) = __pyx_t_1;

  /* "cgtypes.pyx":3848
 *         m4[5] = self.m22
 *         m4[6] = self.m23
 *         m4[7] = self.m24             # <<<<<<<<<<<<<<
 *         m4[8] = self.m31
 *         m4[9] = self.m32
 */
  __pyx_t_1 = __pyx_v_self->m24;
  (__pyx_v_m4[7]) = __pyx_t_1;

  /* "cgtypes.pyx":3849
 *         m4[6] = self.m23
 *         m4[7] = self.m24
 *         m4[8] = self.m31             # <<<<<<<<<<<<<<
 *         m4[9] = self.m32
 *         m4[10] = self.m33
 */
  __pyx_t_1 = __pyx_v_self->m31;
  (__pyx_v_m4[8]) = __pyx_t_1;

  /* "cgtypes.pyx":3850
 *         m4[7] = self.m24
 *         m4[8] = self.m31
 *         m4[9] = self.m32             # <<<<<<<<<<<<<<
 *         m4[10] = self.m33
 *         m4[11] = self.m34
 */
  __pyx_t_1 = __pyx_v_self->m32;
  (__pyx_v_m4[9]) = __pyx_t_1;

  /* "cgtypes.pyx":3851
 *         m4[8] = self.m31
 *         m4[9] = self.m32
 *         m4[10] = self.m33             # <<<<<<<<<<<<<<
 *         m4[11] = self.m34
 *         m4[12] = self.m41
 */
  __pyx_t_1 = __pyx_v_self->m33;
  (__pyx_v_m4[10]) = __pyx_t_1;

  /* "cgtypes.pyx":3852
 *         m4[9] = self.m32
 *         m4[10] = self.m33
 *         m4[11] = self.m34             # <<<<<<<<<<<<<<
 *         m4[12] = self.m41
 *         m4[13] = self.m42
 */
  __pyx_t_1 = __pyx_v_self->m34;
  (__pyx_v_m4[11]) = __pyx_t_1;

  /* "cgtypes.pyx":3853
 *         m4[10] = self.m33
 *         m4[11] = self.m34
 *         m4[12] = self.m41             # <<<<<<<<<<<<<<
 *         m4[13] = self.m42
 *         m4[14] = self.m43
 */
  __pyx_t_1 = __pyx_v_self->m41;
  (__pyx_v_m4[12]) = __pyx_t_1;

  /* "cgtypes.pyx":3854
 *         m4[11] = self.m34
 *         m4[12] = self.m41
 *         m4[13] = self.m42             # <<<<<<<<<<<<<<
 *         m4[14] = self.m43
 *         m4[15] = self.m44
 */
  __pyx_t_1 = __pyx_v_self->m42;
  (__pyx_v_m4[13]) = __pyx_t_1;

  /* "cgtypes.pyx":3855
 *         m4[12] = self.m41
 *         m4[13] = self.m42
 *         m4[14] = self.m43             # <<<<<<<<<<<<<<
 *         m4[15] = self.m44
 * 
 */
  __pyx_t_1 = __pyx_v_self->m43;
  (__pyx_v_m4[14]) = __pyx_t_1;

  /* "cgtypes.pyx":3856
 *         m4[13] = self.m42
 *         m4[14] = self.m43
 *         m4[15] = self.m44             # <<<<<<<<<<<<<<
 * 
 *         det=self.determinant()
 */
  __pyx_t_1 = __pyx_v_self->m44;
  (__pyx_v_m4[15]) = __pyx_t_1;

  /* "cgtypes.pyx":3858
 *         m4[15] = self.m44
 * 
 *         det=self.determinant()             # <<<<<<<<<<<<<<
 *         if fabs(det)<=eps:
 *             raise ZeroDivisionError,"matrix not invertible"
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_determinant); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_det = __pyx_t_1;

  /* "cgtypes.pyx":3859
 * 
 *         det=self.determinant()
 *         if fabs(det)<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"matrix not invertible"
 * 
 */
  __pyx_t_5 = ((fabs(__pyx_v_det) <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_5) {

    /* "cgtypes.pyx":3860
 *         det=self.determinant()
 *         if fabs(det)<=eps:
 *             raise ZeroDivisionError,"matrix not invertible"             # <<<<<<<<<<<<<<
 * 
 *         i=0
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_matrix_not_invertible, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":3862
 *             raise ZeroDivisionError,"matrix not invertible"
 * 
 *         i=0             # <<<<<<<<<<<<<<
 *         while i<4:
 *             j=0
 */
  __pyx_v_i = 0;

  /* "cgtypes.pyx":3863
 * 
 *         i=0
 *         while i<4:             # <<<<<<<<<<<<<<
 *             j=0
 *             while j<4:
 */
  while (1) {
    __pyx_t_5 = ((__pyx_v_i < 4) != 0);
    if (!__pyx_t_5) break;

    /* "cgtypes.pyx":3864
 *         i=0
 *         while i<4:
 *             j=0             # <<<<<<<<<<<<<<
 *             while j<4:
 *                 sign=1-((i+j)%2)*2
 */
    __pyx_v_j = 0;

    /* "cgtypes.pyx":3865
 *         while i<4:
 *             j=0
 *             while j<4:             # <<<<<<<<<<<<<<
 *                 sign=1-((i+j)%2)*2
 *                 d = _subdet(m4,i,j)
 */
    while (1) {
      __pyx_t_5 = ((__pyx_v_j < 4) != 0);
      if (!__pyx_t_5) break;

      /* "cgtypes.pyx":3866
 *             j=0
 *             while j<4:
 *                 sign=1-((i+j)%2)*2             # <<<<<<<<<<<<<<
 *                 d = _subdet(m4,i,j)
 *                 m4_res[j*4+i]=sign*d/det
 */
      __pyx_v_sign = (1 - (__Pyx_mod_long((__pyx_v_i + __pyx_v_j), 2) * 2));

      /* "cgtypes.pyx":3867
 *             while j<4:
 *                 sign=1-((i+j)%2)*2
 *                 d = _subdet(m4,i,j)             # <<<<<<<<<<<<<<
 *                 m4_res[j*4+i]=sign*d/det
 *                 j=j+1
 */
      __pyx_v_d = __pyx_f_7cgtypes__subdet(__pyx_v_m4, __pyx_v_i, __pyx_v_j);

      /* "cgtypes.pyx":3868
 *                 sign=1-((i+j)%2)*2
 *                 d = _subdet(m4,i,j)
 *                 m4_res[j*4+i]=sign*d/det             # <<<<<<<<<<<<<<
 *                 j=j+1
 *             i=i+1
 */
      __pyx_t_1 = (__pyx_v_sign * __pyx_v_d);
      if (unlikely(__pyx_v_det == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      (__pyx_v_m4_res[((__pyx_v_j * 4) + __pyx_v_i)]) = (__pyx_t_1 / __pyx_v_det);

      /* "cgtypes.pyx":3869
 *                 d = _subdet(m4,i,j)
 *                 m4_res[j*4+i]=sign*d/det
 *                 j=j+1             # <<<<<<<<<<<<<<
 *             i=i+1
 * 
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "cgtypes.pyx":3870
 *                 m4_res[j*4+i]=sign*d/det
 *                 j=j+1
 *             i=i+1             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "cgtypes.pyx":3872
 *             i=i+1
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = m4_res[0]
 *         res.m12 = m4_res[1]
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":3873
 * 
 *         res = mat4()
 *         res.m11 = m4_res[0]             # <<<<<<<<<<<<<<
 *         res.m12 = m4_res[1]
 *         res.m13 = m4_res[2]
 */
  __pyx_v_res->m11 = (__pyx_v_m4_res[0]);

  /* "cgtypes.pyx":3874
 *         res = mat4()
 *         res.m11 = m4_res[0]
 *         res.m12 = m4_res[1]             # <<<<<<<<<<<<<<
 *         res.m13 = m4_res[2]
 *         res.m14 = m4_res[3]
 */
  __pyx_v_res->m12 = (__pyx_v_m4_res[1]);

  /* "cgtypes.pyx":3875
 *         res.m11 = m4_res[0]
 *         res.m12 = m4_res[1]
 *         res.m13 = m4_res[2]             # <<<<<<<<<<<<<<
 *         res.m14 = m4_res[3]
 *         res.m21 = m4_res[4]
 */
  __pyx_v_res->m13 = (__pyx_v_m4_res[2]);

  /* "cgtypes.pyx":3876
 *         res.m12 = m4_res[1]
 *         res.m13 = m4_res[2]
 *         res.m14 = m4_res[3]             # <<<<<<<<<<<<<<
 *         res.m21 = m4_res[4]
 *         res.m22 = m4_res[5]
 */
  __pyx_v_res->m14 = (__pyx_v_m4_res[3]);

  /* "cgtypes.pyx":3877
 *         res.m13 = m4_res[2]
 *         res.m14 = m4_res[3]
 *         res.m21 = m4_res[4]             # <<<<<<<<<<<<<<
 *         res.m22 = m4_res[5]
 *         res.m23 = m4_res[6]
 */
  __pyx_v_res->m21 = (__pyx_v_m4_res[4]);

  /* "cgtypes.pyx":3878
 *         res.m14 = m4_res[3]
 *         res.m21 = m4_res[4]
 *         res.m22 = m4_res[5]             # <<<<<<<<<<<<<<
 *         res.m23 = m4_res[6]
 *         res.m24 = m4_res[7]
 */
  __pyx_v_res->m22 = (__pyx_v_m4_res[5]);

  /* "cgtypes.pyx":3879
 *         res.m21 = m4_res[4]
 *         res.m22 = m4_res[5]
 *         res.m23 = m4_res[6]             # <<<<<<<<<<<<<<
 *         res.m24 = m4_res[7]
 *         res.m31 = m4_res[8]
 */
  __pyx_v_res->m23 = (__pyx_v_m4_res[6]);

  /* "cgtypes.pyx":3880
 *         res.m22 = m4_res[5]
 *         res.m23 = m4_res[6]
 *         res.m24 = m4_res[7]             # <<<<<<<<<<<<<<
 *         res.m31 = m4_res[8]
 *         res.m32 = m4_res[9]
 */
  __pyx_v_res->m24 = (__pyx_v_m4_res[7]);

  /* "cgtypes.pyx":3881
 *         res.m23 = m4_res[6]
 *         res.m24 = m4_res[7]
 *         res.m31 = m4_res[8]             # <<<<<<<<<<<<<<
 *         res.m32 = m4_res[9]
 *         res.m33 = m4_res[10]
 */
  __pyx_v_res->m31 = (__pyx_v_m4_res[8]);

  /* "cgtypes.pyx":3882
 *         res.m24 = m4_res[7]
 *         res.m31 = m4_res[8]
 *         res.m32 = m4_res[9]             # <<<<<<<<<<<<<<
 *         res.m33 = m4_res[10]
 *         res.m34 = m4_res[11]
 */
  __pyx_v_res->m32 = (__pyx_v_m4_res[9]);

  /* "cgtypes.pyx":3883
 *         res.m31 = m4_res[8]
 *         res.m32 = m4_res[9]
 *         res.m33 = m4_res[10]             # <<<<<<<<<<<<<<
 *         res.m34 = m4_res[11]
 *         res.m41 = m4_res[12]
 */
  __pyx_v_res->m33 = (__pyx_v_m4_res[10]);

  /* "cgtypes.pyx":3884
 *         res.m32 = m4_res[9]
 *         res.m33 = m4_res[10]
 *         res.m34 = m4_res[11]             # <<<<<<<<<<<<<<
 *         res.m41 = m4_res[12]
 *         res.m42 = m4_res[13]
 */
  __pyx_v_res->m34 = (__pyx_v_m4_res[11]);

  /* "cgtypes.pyx":3885
 *         res.m33 = m4_res[10]
 *         res.m34 = m4_res[11]
 *         res.m41 = m4_res[12]             # <<<<<<<<<<<<<<
 *         res.m42 = m4_res[13]
 *         res.m43 = m4_res[14]
 */
  __pyx_v_res->m41 = (__pyx_v_m4_res[12]);

  /* "cgtypes.pyx":3886
 *         res.m34 = m4_res[11]
 *         res.m41 = m4_res[12]
 *         res.m42 = m4_res[13]             # <<<<<<<<<<<<<<
 *         res.m43 = m4_res[14]
 *         res.m44 = m4_res[15]
 */
  __pyx_v_res->m42 = (__pyx_v_m4_res[13]);

  /* "cgtypes.pyx":3887
 *         res.m41 = m4_res[12]
 *         res.m42 = m4_res[13]
 *         res.m43 = m4_res[14]             # <<<<<<<<<<<<<<
 *         res.m44 = m4_res[15]
 *         return res
 */
  __pyx_v_res->m43 = (__pyx_v_m4_res[14]);

  /* "cgtypes.pyx":3888
 *         res.m42 = m4_res[13]
 *         res.m43 = m4_res[14]
 *         res.m44 = m4_res[15]             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = (__pyx_v_m4_res[15]);

  /* "cgtypes.pyx":3889
 *         res.m43 = m4_res[14]
 *         res.m44 = m4_res[15]
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3825
 *         return M3
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.mat4.inverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3892
 * 
 * 
 *     def translation(self, t):             # <<<<<<<<<<<<<<
 *         """Return translation matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_63translation(PyObject *__pyx_v_self, PyObject *__pyx_v_t); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_62translation[] = "Return translation matrix.\n\n        t must be a 3-sequence (e.g. a vec3).\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_63translation(PyObject *__pyx_v_self, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("translation (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_62translation(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_t));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_62translation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_t) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("translation", 0);

  /* "cgtypes.pyx":3898
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3899
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = 1.0             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  __pyx_v_res->m11 = 1.0;

  /* "cgtypes.pyx":3900
 *         res = mat4()
 *         res.m11 = 1.0
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m14 = t[0]
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":3901
 *         res.m11 = 1.0
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m14 = t[0]
 *         res.m21 = 0.0
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":3902
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m14 = t[0]             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3902; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m14 = __pyx_t_2;

  /* "cgtypes.pyx":3903
 *         res.m13 = 0.0
 *         res.m14 = t[0]
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":3904
 *         res.m14 = t[0]
 *         res.m21 = 0.0
 *         res.m22 = 1.0             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m24 = t[1]
 */
  __pyx_v_res->m22 = 1.0;

  /* "cgtypes.pyx":3905
 *         res.m21 = 0.0
 *         res.m22 = 1.0
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m24 = t[1]
 *         res.m31 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":3906
 *         res.m22 = 1.0
 *         res.m23 = 0.0
 *         res.m24 = t[1]             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3906; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m24 = __pyx_t_2;

  /* "cgtypes.pyx":3907
 *         res.m23 = 0.0
 *         res.m24 = t[1]
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":3908
 *         res.m24 = t[1]
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = 1.0
 *         res.m34 = t[2]
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":3909
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = 1.0             # <<<<<<<<<<<<<<
 *         res.m34 = t[2]
 *         res.m41 = 0.0
 */
  __pyx_v_res->m33 = 1.0;

  /* "cgtypes.pyx":3910
 *         res.m32 = 0.0
 *         res.m33 = 1.0
 *         res.m34 = t[2]             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3910; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m34 = __pyx_t_2;

  /* "cgtypes.pyx":3911
 *         res.m33 = 1.0
 *         res.m34 = t[2]
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":3912
 *         res.m34 = t[2]
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":3913
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":3914
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":3915
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def scaling(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3892
 * 
 * 
 *     def translation(self, t):             # <<<<<<<<<<<<<<
 *         """Return translation matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.translation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3917
 *         return res
 * 
 *     def scaling(self, s):             # <<<<<<<<<<<<<<
 *         """Return scaling matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_65scaling(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_64scaling[] = "Return scaling matrix.\n\n        s must be a 3-sequence (e.g. a vec3).\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_65scaling(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scaling (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_64scaling(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_64scaling(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_s) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("scaling", 0);

  /* "cgtypes.pyx":3923
 *         """
 *         cdef mat4 res
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = s[0]
 *         res.m12 = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":3924
 *         cdef mat4 res
 *         res = mat4()
 *         res.m11 = s[0]             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3924; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":3925
 *         res = mat4()
 *         res.m11 = s[0]
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m14 = 0.0
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":3926
 *         res.m11 = s[0]
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":3927
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m14 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = s[1]
 */
  __pyx_v_res->m14 = 0.0;

  /* "cgtypes.pyx":3928
 *         res.m13 = 0.0
 *         res.m14 = 0.0
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = s[1]
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":3929
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 *         res.m22 = s[1]             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m24 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3929; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":3930
 *         res.m21 = 0.0
 *         res.m22 = s[1]
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":3931
 *         res.m22 = s[1]
 *         res.m23 = 0.0
 *         res.m24 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_v_res->m24 = 0.0;

  /* "cgtypes.pyx":3932
 *         res.m23 = 0.0
 *         res.m24 = 0.0
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = s[2]
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":3933
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = s[2]
 *         res.m34 = 0.0
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":3934
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = s[2]             # <<<<<<<<<<<<<<
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3934; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":3935
 *         res.m32 = 0.0
 *         res.m33 = s[2]
 *         res.m34 = 0.0             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_v_res->m34 = 0.0;

  /* "cgtypes.pyx":3936
 *         res.m33 = s[2]
 *         res.m34 = 0.0
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":3937
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":3938
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":3939
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":3940
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def rotation(self, angle, axis):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3917
 *         return res
 * 
 *     def scaling(self, s):             # <<<<<<<<<<<<<<
 *         """Return scaling matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.scaling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3942
 *         return res
 * 
 *     def rotation(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_67rotation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_66rotation[] = "Return rotation matrix.\n\n        angle must be given in radians. axis must be a 3-sequence.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_67rotation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_axis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rotation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle,&__pyx_n_s_axis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_angle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rotation", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3942; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3942; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_angle = values[0];
    __pyx_v_axis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rotation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3942; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_66rotation(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_angle, __pyx_v_axis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_66rotation(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis) {
  double __pyx_v_cangle;
  double __pyx_v_ax;
  double __pyx_v_ay;
  double __pyx_v_az;
  double __pyx_v_sqr_a;
  double __pyx_v_sqr_b;
  double __pyx_v_sqr_c;
  double __pyx_v_len2;
  double __pyx_v_k1;
  double __pyx_v_k2;
  double __pyx_v_k3;
  double __pyx_v_k1ab;
  double __pyx_v_k1ac;
  double __pyx_v_k1bc;
  double __pyx_v_k3a;
  double __pyx_v_k3b;
  double __pyx_v_k3c;
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rotation", 0);

  /* "cgtypes.pyx":3952
 *         cdef mat4 res
 * 
 *         cangle   = angle             # <<<<<<<<<<<<<<
 *         ax    = axis[0]
 *         ay    = axis[1]
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_angle); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cangle = __pyx_t_1;

  /* "cgtypes.pyx":3953
 * 
 *         cangle   = angle
 *         ax    = axis[0]             # <<<<<<<<<<<<<<
 *         ay    = axis[1]
 *         az    = axis[2]
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3953; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3953; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ax = __pyx_t_1;

  /* "cgtypes.pyx":3954
 *         cangle   = angle
 *         ax    = axis[0]
 *         ay    = axis[1]             # <<<<<<<<<<<<<<
 *         az    = axis[2]
 *         sqr_a = ax*ax
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3954; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_ay = __pyx_t_1;

  /* "cgtypes.pyx":3955
 *         ax    = axis[0]
 *         ay    = axis[1]
 *         az    = axis[2]             # <<<<<<<<<<<<<<
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay
 */
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_axis, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3955; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_az = __pyx_t_1;

  /* "cgtypes.pyx":3956
 *         ay    = axis[1]
 *         az    = axis[2]
 *         sqr_a = ax*ax             # <<<<<<<<<<<<<<
 *         sqr_b = ay*ay
 *         sqr_c = az*az
 */
  __pyx_v_sqr_a = (__pyx_v_ax * __pyx_v_ax);

  /* "cgtypes.pyx":3957
 *         az    = axis[2]
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay             # <<<<<<<<<<<<<<
 *         sqr_c = az*az
 *         len2  = sqr_a+sqr_b+sqr_c
 */
  __pyx_v_sqr_b = (__pyx_v_ay * __pyx_v_ay);

  /* "cgtypes.pyx":3958
 *         sqr_a = ax*ax
 *         sqr_b = ay*ay
 *         sqr_c = az*az             # <<<<<<<<<<<<<<
 *         len2  = sqr_a+sqr_b+sqr_c
 * 
 */
  __pyx_v_sqr_c = (__pyx_v_az * __pyx_v_az);

  /* "cgtypes.pyx":3959
 *         sqr_b = ay*ay
 *         sqr_c = az*az
 *         len2  = sqr_a+sqr_b+sqr_c             # <<<<<<<<<<<<<<
 * 
 *         k2    = cos(cangle)
 */
  __pyx_v_len2 = ((__pyx_v_sqr_a + __pyx_v_sqr_b) + __pyx_v_sqr_c);

  /* "cgtypes.pyx":3961
 *         len2  = sqr_a+sqr_b+sqr_c
 * 
 *         k2    = cos(cangle)             # <<<<<<<<<<<<<<
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)
 */
  __pyx_v_k2 = cos(__pyx_v_cangle);

  /* "cgtypes.pyx":3962
 * 
 *         k2    = cos(cangle)
 *         k1    = (1.0-k2)/len2             # <<<<<<<<<<<<<<
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay
 */
  __pyx_t_1 = (1.0 - __pyx_v_k2);
  if (unlikely(__pyx_v_len2 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_k1 = (__pyx_t_1 / __pyx_v_len2);

  /* "cgtypes.pyx":3963
 *         k2    = cos(cangle)
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)             # <<<<<<<<<<<<<<
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az
 */
  __pyx_t_1 = sin(__pyx_v_cangle);
  __pyx_t_3 = sqrt(__pyx_v_len2);
  if (unlikely(__pyx_t_3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_k3 = (__pyx_t_1 / __pyx_t_3);

  /* "cgtypes.pyx":3964
 *         k1    = (1.0-k2)/len2
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay             # <<<<<<<<<<<<<<
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az
 */
  __pyx_v_k1ab = ((__pyx_v_k1 * __pyx_v_ax) * __pyx_v_ay);

  /* "cgtypes.pyx":3965
 *         k3    = sin(cangle)/sqrt(len2)
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az             # <<<<<<<<<<<<<<
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax
 */
  __pyx_v_k1ac = ((__pyx_v_k1 * __pyx_v_ax) * __pyx_v_az);

  /* "cgtypes.pyx":3966
 *         k1ab  = k1*ax*ay
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az             # <<<<<<<<<<<<<<
 *         k3a   = k3*ax
 *         k3b   = k3*ay
 */
  __pyx_v_k1bc = ((__pyx_v_k1 * __pyx_v_ay) * __pyx_v_az);

  /* "cgtypes.pyx":3967
 *         k1ac  = k1*ax*az
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax             # <<<<<<<<<<<<<<
 *         k3b   = k3*ay
 *         k3c   = k3*az
 */
  __pyx_v_k3a = (__pyx_v_k3 * __pyx_v_ax);

  /* "cgtypes.pyx":3968
 *         k1bc  = k1*ay*az
 *         k3a   = k3*ax
 *         k3b   = k3*ay             # <<<<<<<<<<<<<<
 *         k3c   = k3*az
 * 
 */
  __pyx_v_k3b = (__pyx_v_k3 * __pyx_v_ay);

  /* "cgtypes.pyx":3969
 *         k3a   = k3*ax
 *         k3b   = k3*ay
 *         k3c   = k3*az             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
  __pyx_v_k3c = (__pyx_v_k3 * __pyx_v_az);

  /* "cgtypes.pyx":3971
 *         k3c   = k3*az
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":3972
 * 
 *         res = mat4()
 *         res.m11 = k1*sqr_a+k2             # <<<<<<<<<<<<<<
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b
 */
  __pyx_v_res->m11 = ((__pyx_v_k1 * __pyx_v_sqr_a) + __pyx_v_k2);

  /* "cgtypes.pyx":3973
 *         res = mat4()
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c             # <<<<<<<<<<<<<<
 *         res.m13 = k1ac+k3b
 *         res.m14 = 0.0
 */
  __pyx_v_res->m12 = (__pyx_v_k1ab - __pyx_v_k3c);

  /* "cgtypes.pyx":3974
 *         res.m11 = k1*sqr_a+k2
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b             # <<<<<<<<<<<<<<
 *         res.m14 = 0.0
 *         res.m21 = k1ab+k3c
 */
  __pyx_v_res->m13 = (__pyx_v_k1ac + __pyx_v_k3b);

  /* "cgtypes.pyx":3975
 *         res.m12 = k1ab-k3c
 *         res.m13 = k1ac+k3b
 *         res.m14 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2
 */
  __pyx_v_res->m14 = 0.0;

  /* "cgtypes.pyx":3976
 *         res.m13 = k1ac+k3b
 *         res.m14 = 0.0
 *         res.m21 = k1ab+k3c             # <<<<<<<<<<<<<<
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a
 */
  __pyx_v_res->m21 = (__pyx_v_k1ab + __pyx_v_k3c);

  /* "cgtypes.pyx":3977
 *         res.m14 = 0.0
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2             # <<<<<<<<<<<<<<
 *         res.m23 = k1bc-k3a
 *         res.m24 = 0.0
 */
  __pyx_v_res->m22 = ((__pyx_v_k1 * __pyx_v_sqr_b) + __pyx_v_k2);

  /* "cgtypes.pyx":3978
 *         res.m21 = k1ab+k3c
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a             # <<<<<<<<<<<<<<
 *         res.m24 = 0.0
 *         res.m31 = k1ac-k3b
 */
  __pyx_v_res->m23 = (__pyx_v_k1bc - __pyx_v_k3a);

  /* "cgtypes.pyx":3979
 *         res.m22 = k1*sqr_b+k2
 *         res.m23 = k1bc-k3a
 *         res.m24 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a
 */
  __pyx_v_res->m24 = 0.0;

  /* "cgtypes.pyx":3980
 *         res.m23 = k1bc-k3a
 *         res.m24 = 0.0
 *         res.m31 = k1ac-k3b             # <<<<<<<<<<<<<<
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2
 */
  __pyx_v_res->m31 = (__pyx_v_k1ac - __pyx_v_k3b);

  /* "cgtypes.pyx":3981
 *         res.m24 = 0.0
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a             # <<<<<<<<<<<<<<
 *         res.m33 = k1*sqr_c+k2
 *         res.m34 = 0.0
 */
  __pyx_v_res->m32 = (__pyx_v_k1bc + __pyx_v_k3a);

  /* "cgtypes.pyx":3982
 *         res.m31 = k1ac-k3b
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2             # <<<<<<<<<<<<<<
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 */
  __pyx_v_res->m33 = ((__pyx_v_k1 * __pyx_v_sqr_c) + __pyx_v_k2);

  /* "cgtypes.pyx":3983
 *         res.m32 = k1bc+k3a
 *         res.m33 = k1*sqr_c+k2
 *         res.m34 = 0.0             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_v_res->m34 = 0.0;

  /* "cgtypes.pyx":3984
 *         res.m33 = k1*sqr_c+k2
 *         res.m34 = 0.0
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":3985
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":3986
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":3987
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":3988
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":3942
 *         return res
 * 
 *     def rotation(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.mat4.rotation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":3991
 * 
 * 
 *     def translate(self, t):             # <<<<<<<<<<<<<<
 *         """Concatenate a translation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_69translate(PyObject *__pyx_v_self, PyObject *__pyx_v_t); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_68translate[] = "Concatenate a translation.\n\n        t must be a 3-sequence (e.g. a vec3).\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_69translate(PyObject *__pyx_v_self, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("translate (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_68translate(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_t));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_68translate(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_t) {
  double __pyx_v_tx;
  double __pyx_v_ty;
  double __pyx_v_tz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("translate", 0);

  /* "cgtypes.pyx":3997
 *         """
 *         cdef double tx, ty, tz
 *         tx = t[0]             # <<<<<<<<<<<<<<
 *         ty = t[1]
 *         tz = t[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3997; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tx = __pyx_t_2;

  /* "cgtypes.pyx":3998
 *         cdef double tx, ty, tz
 *         tx = t[0]
 *         ty = t[1]             # <<<<<<<<<<<<<<
 *         tz = t[2]
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_ty = __pyx_t_2;

  /* "cgtypes.pyx":3999
 *         tx = t[0]
 *         ty = t[1]
 *         tz = t[2]             # <<<<<<<<<<<<<<
 * 
 *         self.m14 = self.m11*tx + self.m12*ty + self.m13*tz + self.m14
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_t, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_tz = __pyx_t_2;

  /* "cgtypes.pyx":4001
 *         tz = t[2]
 * 
 *         self.m14 = self.m11*tx + self.m12*ty + self.m13*tz + self.m14             # <<<<<<<<<<<<<<
 *         self.m24 = self.m21*tx + self.m22*ty + self.m23*tz + self.m24
 *         self.m34 = self.m31*tx + self.m32*ty + self.m33*tz + self.m34
 */
  __pyx_v_self->m14 = ((((__pyx_v_self->m11 * __pyx_v_tx) + (__pyx_v_self->m12 * __pyx_v_ty)) + (__pyx_v_self->m13 * __pyx_v_tz)) + __pyx_v_self->m14);

  /* "cgtypes.pyx":4002
 * 
 *         self.m14 = self.m11*tx + self.m12*ty + self.m13*tz + self.m14
 *         self.m24 = self.m21*tx + self.m22*ty + self.m23*tz + self.m24             # <<<<<<<<<<<<<<
 *         self.m34 = self.m31*tx + self.m32*ty + self.m33*tz + self.m34
 *         self.m44 = self.m41*tx + self.m42*ty + self.m43*tz + self.m44
 */
  __pyx_v_self->m24 = ((((__pyx_v_self->m21 * __pyx_v_tx) + (__pyx_v_self->m22 * __pyx_v_ty)) + (__pyx_v_self->m23 * __pyx_v_tz)) + __pyx_v_self->m24);

  /* "cgtypes.pyx":4003
 *         self.m14 = self.m11*tx + self.m12*ty + self.m13*tz + self.m14
 *         self.m24 = self.m21*tx + self.m22*ty + self.m23*tz + self.m24
 *         self.m34 = self.m31*tx + self.m32*ty + self.m33*tz + self.m34             # <<<<<<<<<<<<<<
 *         self.m44 = self.m41*tx + self.m42*ty + self.m43*tz + self.m44
 *         return self
 */
  __pyx_v_self->m34 = ((((__pyx_v_self->m31 * __pyx_v_tx) + (__pyx_v_self->m32 * __pyx_v_ty)) + (__pyx_v_self->m33 * __pyx_v_tz)) + __pyx_v_self->m34);

  /* "cgtypes.pyx":4004
 *         self.m24 = self.m21*tx + self.m22*ty + self.m23*tz + self.m24
 *         self.m34 = self.m31*tx + self.m32*ty + self.m33*tz + self.m34
 *         self.m44 = self.m41*tx + self.m42*ty + self.m43*tz + self.m44             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m44 = ((((__pyx_v_self->m41 * __pyx_v_tx) + (__pyx_v_self->m42 * __pyx_v_ty)) + (__pyx_v_self->m43 * __pyx_v_tz)) + __pyx_v_self->m44);

  /* "cgtypes.pyx":4005
 *         self.m34 = self.m31*tx + self.m32*ty + self.m33*tz + self.m34
 *         self.m44 = self.m41*tx + self.m42*ty + self.m43*tz + self.m44
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def scale(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":3991
 * 
 * 
 *     def translate(self, t):             # <<<<<<<<<<<<<<
 *         """Concatenate a translation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4007
 *         return self
 * 
 *     def scale(self, s):             # <<<<<<<<<<<<<<
 *         """Concatenate a scaling.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_71scale(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_70scale[] = "Concatenate a scaling.\n\n        s must be a 3-sequence (e.g. a vec3).\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_71scale(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("scale (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_70scale(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_70scale(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_s) {
  double __pyx_v_sx;
  double __pyx_v_sy;
  double __pyx_v_sz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("scale", 0);

  /* "cgtypes.pyx":4013
 *         """
 *         cdef double sx, sy, sz
 *         sx = s[0]             # <<<<<<<<<<<<<<
 *         sy = s[1]
 *         sz = s[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4013; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sx = __pyx_t_2;

  /* "cgtypes.pyx":4014
 *         cdef double sx, sy, sz
 *         sx = s[0]
 *         sy = s[1]             # <<<<<<<<<<<<<<
 *         sz = s[2]
 *         self.m11 = self.m11*sx
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4014; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sy = __pyx_t_2;

  /* "cgtypes.pyx":4015
 *         sx = s[0]
 *         sy = s[1]
 *         sz = s[2]             # <<<<<<<<<<<<<<
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_s, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sz = __pyx_t_2;

  /* "cgtypes.pyx":4016
 *         sy = s[1]
 *         sz = s[2]
 *         self.m11 = self.m11*sx             # <<<<<<<<<<<<<<
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz
 */
  __pyx_v_self->m11 = (__pyx_v_self->m11 * __pyx_v_sx);

  /* "cgtypes.pyx":4017
 *         sz = s[2]
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy             # <<<<<<<<<<<<<<
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx
 */
  __pyx_v_self->m12 = (__pyx_v_self->m12 * __pyx_v_sy);

  /* "cgtypes.pyx":4018
 *         self.m11 = self.m11*sx
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz             # <<<<<<<<<<<<<<
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy
 */
  __pyx_v_self->m13 = (__pyx_v_self->m13 * __pyx_v_sz);

  /* "cgtypes.pyx":4019
 *         self.m12 = self.m12*sy
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx             # <<<<<<<<<<<<<<
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz
 */
  __pyx_v_self->m21 = (__pyx_v_self->m21 * __pyx_v_sx);

  /* "cgtypes.pyx":4020
 *         self.m13 = self.m13*sz
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy             # <<<<<<<<<<<<<<
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx
 */
  __pyx_v_self->m22 = (__pyx_v_self->m22 * __pyx_v_sy);

  /* "cgtypes.pyx":4021
 *         self.m21 = self.m21*sx
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz             # <<<<<<<<<<<<<<
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy
 */
  __pyx_v_self->m23 = (__pyx_v_self->m23 * __pyx_v_sz);

  /* "cgtypes.pyx":4022
 *         self.m22 = self.m22*sy
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx             # <<<<<<<<<<<<<<
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz
 */
  __pyx_v_self->m31 = (__pyx_v_self->m31 * __pyx_v_sx);

  /* "cgtypes.pyx":4023
 *         self.m23 = self.m23*sz
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy             # <<<<<<<<<<<<<<
 *         self.m33 = self.m33*sz
 *         self.m41 = self.m41*sx
 */
  __pyx_v_self->m32 = (__pyx_v_self->m32 * __pyx_v_sy);

  /* "cgtypes.pyx":4024
 *         self.m31 = self.m31*sx
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz             # <<<<<<<<<<<<<<
 *         self.m41 = self.m41*sx
 *         self.m42 = self.m42*sy
 */
  __pyx_v_self->m33 = (__pyx_v_self->m33 * __pyx_v_sz);

  /* "cgtypes.pyx":4025
 *         self.m32 = self.m32*sy
 *         self.m33 = self.m33*sz
 *         self.m41 = self.m41*sx             # <<<<<<<<<<<<<<
 *         self.m42 = self.m42*sy
 *         self.m43 = self.m43*sz
 */
  __pyx_v_self->m41 = (__pyx_v_self->m41 * __pyx_v_sx);

  /* "cgtypes.pyx":4026
 *         self.m33 = self.m33*sz
 *         self.m41 = self.m41*sx
 *         self.m42 = self.m42*sy             # <<<<<<<<<<<<<<
 *         self.m43 = self.m43*sz
 *         return self
 */
  __pyx_v_self->m42 = (__pyx_v_self->m42 * __pyx_v_sy);

  /* "cgtypes.pyx":4027
 *         self.m41 = self.m41*sx
 *         self.m42 = self.m42*sy
 *         self.m43 = self.m43*sz             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->m43 = (__pyx_v_self->m43 * __pyx_v_sz);

  /* "cgtypes.pyx":4028
 *         self.m42 = self.m42*sy
 *         self.m43 = self.m43*sz
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def rotate(self, angle, axis):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4007
 *         return self
 * 
 *     def scale(self, s):             # <<<<<<<<<<<<<<
 *         """Concatenate a scaling.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.scale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4030
 *         return self
 * 
 *     def rotate(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Concatenate a rotation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_73rotate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_72rotate[] = "Concatenate a rotation.\n\n        angle must be given in radians. axis must be a 3-sequence.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_73rotate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_axis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rotate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle,&__pyx_n_s_axis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_angle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rotate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_angle = values[0];
    __pyx_v_axis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rotate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4030; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_72rotate(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_angle, __pyx_v_axis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_72rotate(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_R = 0;
  double __pyx_v_c1;
  double __pyx_v_c2;
  double __pyx_v_c3;
  double __pyx_v_c4;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rotate", 0);

  /* "cgtypes.pyx":4037
 *         cdef mat4 R
 *         cdef double c1, c2, c3, c4
 *         R=self.rotation(angle, axis)             # <<<<<<<<<<<<<<
 * 
 *         # self*R  (in-place)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rotation); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_angle);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_angle);
  __Pyx_GIVEREF(__pyx_v_angle);
  __Pyx_INCREF(__pyx_v_axis);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_axis);
  __Pyx_GIVEREF(__pyx_v_axis);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_R = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4040
 * 
 *         # self*R  (in-place)
 *         c1 = self.m11             # <<<<<<<<<<<<<<
 *         c2 = self.m12
 *         c3 = self.m13
 */
  __pyx_t_6 = __pyx_v_self->m11;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":4041
 *         # self*R  (in-place)
 *         c1 = self.m11
 *         c2 = self.m12             # <<<<<<<<<<<<<<
 *         c3 = self.m13
 *         c4 = self.m14
 */
  __pyx_t_6 = __pyx_v_self->m12;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":4042
 *         c1 = self.m11
 *         c2 = self.m12
 *         c3 = self.m13             # <<<<<<<<<<<<<<
 *         c4 = self.m14
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 */
  __pyx_t_6 = __pyx_v_self->m13;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":4043
 *         c2 = self.m12
 *         c3 = self.m13
 *         c4 = self.m14             # <<<<<<<<<<<<<<
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 */
  __pyx_t_6 = __pyx_v_self->m14;
  __pyx_v_c4 = __pyx_t_6;

  /* "cgtypes.pyx":4044
 *         c3 = self.m13
 *         c4 = self.m14
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41             # <<<<<<<<<<<<<<
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 */
  __pyx_v_self->m11 = ((((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31)) + (__pyx_v_c4 * __pyx_v_R->m41));

  /* "cgtypes.pyx":4045
 *         c4 = self.m14
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42             # <<<<<<<<<<<<<<
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m14 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 */
  __pyx_v_self->m12 = ((((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32)) + (__pyx_v_c4 * __pyx_v_R->m42));

  /* "cgtypes.pyx":4046
 *         self.m11 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43             # <<<<<<<<<<<<<<
 *         self.m14 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 */
  __pyx_v_self->m13 = ((((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33)) + (__pyx_v_c4 * __pyx_v_R->m43));

  /* "cgtypes.pyx":4047
 *         self.m12 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m13 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m14 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44             # <<<<<<<<<<<<<<
 * 
 *         c1 = self.m21
 */
  __pyx_v_self->m14 = ((((__pyx_v_c1 * __pyx_v_R->m14) + (__pyx_v_c2 * __pyx_v_R->m24)) + (__pyx_v_c3 * __pyx_v_R->m34)) + (__pyx_v_c4 * __pyx_v_R->m44));

  /* "cgtypes.pyx":4049
 *         self.m14 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 *         c1 = self.m21             # <<<<<<<<<<<<<<
 *         c2 = self.m22
 *         c3 = self.m23
 */
  __pyx_t_6 = __pyx_v_self->m21;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":4050
 * 
 *         c1 = self.m21
 *         c2 = self.m22             # <<<<<<<<<<<<<<
 *         c3 = self.m23
 *         c4 = self.m24
 */
  __pyx_t_6 = __pyx_v_self->m22;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":4051
 *         c1 = self.m21
 *         c2 = self.m22
 *         c3 = self.m23             # <<<<<<<<<<<<<<
 *         c4 = self.m24
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 */
  __pyx_t_6 = __pyx_v_self->m23;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":4052
 *         c2 = self.m22
 *         c3 = self.m23
 *         c4 = self.m24             # <<<<<<<<<<<<<<
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 */
  __pyx_t_6 = __pyx_v_self->m24;
  __pyx_v_c4 = __pyx_t_6;

  /* "cgtypes.pyx":4053
 *         c3 = self.m23
 *         c4 = self.m24
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41             # <<<<<<<<<<<<<<
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 */
  __pyx_v_self->m21 = ((((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31)) + (__pyx_v_c4 * __pyx_v_R->m41));

  /* "cgtypes.pyx":4054
 *         c4 = self.m24
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42             # <<<<<<<<<<<<<<
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m24 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 */
  __pyx_v_self->m22 = ((((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32)) + (__pyx_v_c4 * __pyx_v_R->m42));

  /* "cgtypes.pyx":4055
 *         self.m21 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43             # <<<<<<<<<<<<<<
 *         self.m24 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 */
  __pyx_v_self->m23 = ((((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33)) + (__pyx_v_c4 * __pyx_v_R->m43));

  /* "cgtypes.pyx":4056
 *         self.m22 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m23 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m24 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44             # <<<<<<<<<<<<<<
 * 
 *         c1 = self.m31
 */
  __pyx_v_self->m24 = ((((__pyx_v_c1 * __pyx_v_R->m14) + (__pyx_v_c2 * __pyx_v_R->m24)) + (__pyx_v_c3 * __pyx_v_R->m34)) + (__pyx_v_c4 * __pyx_v_R->m44));

  /* "cgtypes.pyx":4058
 *         self.m24 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 *         c1 = self.m31             # <<<<<<<<<<<<<<
 *         c2 = self.m32
 *         c3 = self.m33
 */
  __pyx_t_6 = __pyx_v_self->m31;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":4059
 * 
 *         c1 = self.m31
 *         c2 = self.m32             # <<<<<<<<<<<<<<
 *         c3 = self.m33
 *         c4 = self.m34
 */
  __pyx_t_6 = __pyx_v_self->m32;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":4060
 *         c1 = self.m31
 *         c2 = self.m32
 *         c3 = self.m33             # <<<<<<<<<<<<<<
 *         c4 = self.m34
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 */
  __pyx_t_6 = __pyx_v_self->m33;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":4061
 *         c2 = self.m32
 *         c3 = self.m33
 *         c4 = self.m34             # <<<<<<<<<<<<<<
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 */
  __pyx_t_6 = __pyx_v_self->m34;
  __pyx_v_c4 = __pyx_t_6;

  /* "cgtypes.pyx":4062
 *         c3 = self.m33
 *         c4 = self.m34
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41             # <<<<<<<<<<<<<<
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 */
  __pyx_v_self->m31 = ((((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31)) + (__pyx_v_c4 * __pyx_v_R->m41));

  /* "cgtypes.pyx":4063
 *         c4 = self.m34
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42             # <<<<<<<<<<<<<<
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m34 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 */
  __pyx_v_self->m32 = ((((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32)) + (__pyx_v_c4 * __pyx_v_R->m42));

  /* "cgtypes.pyx":4064
 *         self.m31 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43             # <<<<<<<<<<<<<<
 *         self.m34 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 */
  __pyx_v_self->m33 = ((((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33)) + (__pyx_v_c4 * __pyx_v_R->m43));

  /* "cgtypes.pyx":4065
 *         self.m32 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m33 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m34 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44             # <<<<<<<<<<<<<<
 * 
 *         c1 = self.m41
 */
  __pyx_v_self->m34 = ((((__pyx_v_c1 * __pyx_v_R->m14) + (__pyx_v_c2 * __pyx_v_R->m24)) + (__pyx_v_c3 * __pyx_v_R->m34)) + (__pyx_v_c4 * __pyx_v_R->m44));

  /* "cgtypes.pyx":4067
 *         self.m34 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 *         c1 = self.m41             # <<<<<<<<<<<<<<
 *         c2 = self.m42
 *         c3 = self.m43
 */
  __pyx_t_6 = __pyx_v_self->m41;
  __pyx_v_c1 = __pyx_t_6;

  /* "cgtypes.pyx":4068
 * 
 *         c1 = self.m41
 *         c2 = self.m42             # <<<<<<<<<<<<<<
 *         c3 = self.m43
 *         c4 = self.m44
 */
  __pyx_t_6 = __pyx_v_self->m42;
  __pyx_v_c2 = __pyx_t_6;

  /* "cgtypes.pyx":4069
 *         c1 = self.m41
 *         c2 = self.m42
 *         c3 = self.m43             # <<<<<<<<<<<<<<
 *         c4 = self.m44
 *         self.m41 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 */
  __pyx_t_6 = __pyx_v_self->m43;
  __pyx_v_c3 = __pyx_t_6;

  /* "cgtypes.pyx":4070
 *         c2 = self.m42
 *         c3 = self.m43
 *         c4 = self.m44             # <<<<<<<<<<<<<<
 *         self.m41 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m42 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 */
  __pyx_t_6 = __pyx_v_self->m44;
  __pyx_v_c4 = __pyx_t_6;

  /* "cgtypes.pyx":4071
 *         c3 = self.m43
 *         c4 = self.m44
 *         self.m41 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41             # <<<<<<<<<<<<<<
 *         self.m42 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m43 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 */
  __pyx_v_self->m41 = ((((__pyx_v_c1 * __pyx_v_R->m11) + (__pyx_v_c2 * __pyx_v_R->m21)) + (__pyx_v_c3 * __pyx_v_R->m31)) + (__pyx_v_c4 * __pyx_v_R->m41));

  /* "cgtypes.pyx":4072
 *         c4 = self.m44
 *         self.m41 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m42 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42             # <<<<<<<<<<<<<<
 *         self.m43 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m44 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 */
  __pyx_v_self->m42 = ((((__pyx_v_c1 * __pyx_v_R->m12) + (__pyx_v_c2 * __pyx_v_R->m22)) + (__pyx_v_c3 * __pyx_v_R->m32)) + (__pyx_v_c4 * __pyx_v_R->m42));

  /* "cgtypes.pyx":4073
 *         self.m41 = c1*R.m11+c2*R.m21+c3*R.m31+c4*R.m41
 *         self.m42 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m43 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43             # <<<<<<<<<<<<<<
 *         self.m44 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 */
  __pyx_v_self->m43 = ((((__pyx_v_c1 * __pyx_v_R->m13) + (__pyx_v_c2 * __pyx_v_R->m23)) + (__pyx_v_c3 * __pyx_v_R->m33)) + (__pyx_v_c4 * __pyx_v_R->m43));

  /* "cgtypes.pyx":4074
 *         self.m42 = c1*R.m12+c2*R.m22+c3*R.m32+c4*R.m42
 *         self.m43 = c1*R.m13+c2*R.m23+c3*R.m33+c4*R.m43
 *         self.m44 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44             # <<<<<<<<<<<<<<
 * 
 *         return self
 */
  __pyx_v_self->m44 = ((((__pyx_v_c1 * __pyx_v_R->m14) + (__pyx_v_c2 * __pyx_v_R->m24)) + (__pyx_v_c3 * __pyx_v_R->m34)) + (__pyx_v_c4 * __pyx_v_R->m44));

  /* "cgtypes.pyx":4076
 *         self.m44 = c1*R.m14+c2*R.m24+c3*R.m34+c4*R.m44
 * 
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def orthographic(self, left, right, bottom, top, near, far):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4030
 *         return self
 * 
 *     def rotate(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Concatenate a rotation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.mat4.rotate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_R);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4078
 *         return self
 * 
 *     def orthographic(self, left, right, bottom, top, near, far):             # <<<<<<<<<<<<<<
 *         """equivalent to the OpenGL command glOrtho()"""
 *         cdef mat4 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_75orthographic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_74orthographic[] = "equivalent to the OpenGL command glOrtho()";
static PyObject *__pyx_pw_7cgtypes_4mat4_75orthographic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_left = 0;
  PyObject *__pyx_v_right = 0;
  PyObject *__pyx_v_bottom = 0;
  PyObject *__pyx_v_top = 0;
  PyObject *__pyx_v_near = 0;
  PyObject *__pyx_v_far = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("orthographic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,&__pyx_n_s_bottom,&__pyx_n_s_top,&__pyx_n_s_near,&__pyx_n_s_far,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_near)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_far)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "orthographic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_left = values[0];
    __pyx_v_right = values[1];
    __pyx_v_bottom = values[2];
    __pyx_v_top = values[3];
    __pyx_v_near = values[4];
    __pyx_v_far = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("orthographic", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.orthographic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_74orthographic(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_left, __pyx_v_right, __pyx_v_bottom, __pyx_v_top, __pyx_v_near, __pyx_v_far);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_74orthographic(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_bottom, PyObject *__pyx_v_top, PyObject *__pyx_v_near, PyObject *__pyx_v_far) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  double __pyx_v_l;
  double __pyx_v_r;
  double __pyx_v_b;
  double __pyx_v_t;
  double __pyx_v_n;
  double __pyx_v_f;
  double __pyx_v_r_l;
  double __pyx_v_t_b;
  double __pyx_v_f_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("orthographic", 0);

  /* "cgtypes.pyx":4083
 *         cdef double l,r,b,t,n,f, r_l, t_b, f_n
 * 
 *         l = left             # <<<<<<<<<<<<<<
 *         r = right
 *         b = bottom
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_left); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_l = __pyx_t_1;

  /* "cgtypes.pyx":4084
 * 
 *         l = left
 *         r = right             # <<<<<<<<<<<<<<
 *         b = bottom
 *         t = top
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_right); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_r = __pyx_t_1;

  /* "cgtypes.pyx":4085
 *         l = left
 *         r = right
 *         b = bottom             # <<<<<<<<<<<<<<
 *         t = top
 *         n = near
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_b = __pyx_t_1;

  /* "cgtypes.pyx":4086
 *         r = right
 *         b = bottom
 *         t = top             # <<<<<<<<<<<<<<
 *         n = near
 *         f = far
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_top); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = __pyx_t_1;

  /* "cgtypes.pyx":4087
 *         b = bottom
 *         t = top
 *         n = near             # <<<<<<<<<<<<<<
 *         f = far
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_near); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "cgtypes.pyx":4088
 *         t = top
 *         n = near
 *         f = far             # <<<<<<<<<<<<<<
 * 
 *         r_l = r-l
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_far); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = __pyx_t_1;

  /* "cgtypes.pyx":4090
 *         f = far
 * 
 *         r_l = r-l             # <<<<<<<<<<<<<<
 *         t_b = t-b
 *         f_n = f-n
 */
  __pyx_v_r_l = (__pyx_v_r - __pyx_v_l);

  /* "cgtypes.pyx":4091
 * 
 *         r_l = r-l
 *         t_b = t-b             # <<<<<<<<<<<<<<
 *         f_n = f-n
 * 
 */
  __pyx_v_t_b = (__pyx_v_t - __pyx_v_b);

  /* "cgtypes.pyx":4092
 *         r_l = r-l
 *         t_b = t-b
 *         f_n = f-n             # <<<<<<<<<<<<<<
 * 
 *         if r_l<=eps:
 */
  __pyx_v_f_n = (__pyx_v_f - __pyx_v_n);

  /* "cgtypes.pyx":4094
 *         f_n = f-n
 * 
 *         if r_l<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:
 */
  __pyx_t_2 = ((__pyx_v_r_l <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4095
 * 
 *         if r_l<=eps:
 *             raise ValueError, "right-value must be greater than left-value"             # <<<<<<<<<<<<<<
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_right_value_must_be_greater_than, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4096
 *         if r_l<=eps:
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:
 */
  __pyx_t_2 = ((__pyx_v_t_b <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4097
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"             # <<<<<<<<<<<<<<
 *         if f_n<=eps:
 *             raise ValueError, "far-value must be greater than near-value"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_top_value_must_be_greater_than_b, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4098
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "far-value must be greater than near-value"
 * 
 */
  __pyx_t_2 = ((__pyx_v_f_n <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4099
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:
 *             raise ValueError, "far-value must be greater than near-value"             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_far_value_must_be_greater_than_n, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4101
 *             raise ValueError, "far-value must be greater than near-value"
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 * 
 *         res.m11 = 2.0/r_l
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4103
 *         res = mat4()
 * 
 *         res.m11 = 2.0/r_l             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 */
  if (unlikely(__pyx_v_r_l == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m11 = (2.0 / __pyx_v_r_l);

  /* "cgtypes.pyx":4104
 * 
 *         res.m11 = 2.0/r_l
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = 0.0
 *         res.m14 = -(r+l)/r_l
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":4105
 *         res.m11 = 2.0/r_l
 *         res.m12 = 0.0
 *         res.m13 = 0.0             # <<<<<<<<<<<<<<
 *         res.m14 = -(r+l)/r_l
 *         res.m21 = 0.0
 */
  __pyx_v_res->m13 = 0.0;

  /* "cgtypes.pyx":4106
 *         res.m12 = 0.0
 *         res.m13 = 0.0
 *         res.m14 = -(r+l)/r_l             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = 2.0/t_b
 */
  __pyx_t_1 = (-(__pyx_v_r + __pyx_v_l));
  if (unlikely(__pyx_v_r_l == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m14 = (__pyx_t_1 / __pyx_v_r_l);

  /* "cgtypes.pyx":4107
 *         res.m13 = 0.0
 *         res.m14 = -(r+l)/r_l
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = 2.0/t_b
 *         res.m23 = 0.0
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":4108
 *         res.m14 = -(r+l)/r_l
 *         res.m21 = 0.0
 *         res.m22 = 2.0/t_b             # <<<<<<<<<<<<<<
 *         res.m23 = 0.0
 *         res.m24 = -(t+b)/t_b
 */
  if (unlikely(__pyx_v_t_b == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m22 = (2.0 / __pyx_v_t_b);

  /* "cgtypes.pyx":4109
 *         res.m21 = 0.0
 *         res.m22 = 2.0/t_b
 *         res.m23 = 0.0             # <<<<<<<<<<<<<<
 *         res.m24 = -(t+b)/t_b
 *         res.m31 = 0.0
 */
  __pyx_v_res->m23 = 0.0;

  /* "cgtypes.pyx":4110
 *         res.m22 = 2.0/t_b
 *         res.m23 = 0.0
 *         res.m24 = -(t+b)/t_b             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_t_1 = (-(__pyx_v_t + __pyx_v_b));
  if (unlikely(__pyx_v_t_b == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m24 = (__pyx_t_1 / __pyx_v_t_b);

  /* "cgtypes.pyx":4111
 *         res.m23 = 0.0
 *         res.m24 = -(t+b)/t_b
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = -2.0/f_n
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":4112
 *         res.m24 = -(t+b)/t_b
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = -2.0/f_n
 *         res.m34 = -(f+n)/f_n
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":4113
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = -2.0/f_n             # <<<<<<<<<<<<<<
 *         res.m34 = -(f+n)/f_n
 *         res.m41 = 0.0
 */
  if (unlikely(__pyx_v_f_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m33 = (-2.0 / __pyx_v_f_n);

  /* "cgtypes.pyx":4114
 *         res.m32 = 0.0
 *         res.m33 = -2.0/f_n
 *         res.m34 = -(f+n)/f_n             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_t_1 = (-(__pyx_v_f + __pyx_v_n));
  if (unlikely(__pyx_v_f_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m34 = (__pyx_t_1 / __pyx_v_f_n);

  /* "cgtypes.pyx":4115
 *         res.m33 = -2.0/f_n
 *         res.m34 = -(f+n)/f_n
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":4116
 *         res.m34 = -(f+n)/f_n
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":4117
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":4118
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":4119
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def frustum(self, left, right, bottom, top, near, far):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4078
 *         return self
 * 
 *     def orthographic(self, left, right, bottom, top, near, far):             # <<<<<<<<<<<<<<
 *         """equivalent to the OpenGL command glOrtho()"""
 *         cdef mat4 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.mat4.orthographic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4121
 *         return res
 * 
 *     def frustum(self, left, right, bottom, top, near, far):             # <<<<<<<<<<<<<<
 *         """equivalent to the OpenGL command glFrustum()"""
 *         cdef mat4 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_77frustum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_76frustum[] = "equivalent to the OpenGL command glFrustum()";
static PyObject *__pyx_pw_7cgtypes_4mat4_77frustum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_left = 0;
  PyObject *__pyx_v_right = 0;
  PyObject *__pyx_v_bottom = 0;
  PyObject *__pyx_v_top = 0;
  PyObject *__pyx_v_near = 0;
  PyObject *__pyx_v_far = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frustum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left,&__pyx_n_s_right,&__pyx_n_s_bottom,&__pyx_n_s_top,&__pyx_n_s_near,&__pyx_n_s_far,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bottom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_top)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_near)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_far)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frustum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_left = values[0];
    __pyx_v_right = values[1];
    __pyx_v_bottom = values[2];
    __pyx_v_top = values[3];
    __pyx_v_near = values[4];
    __pyx_v_far = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("frustum", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_76frustum(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_left, __pyx_v_right, __pyx_v_bottom, __pyx_v_top, __pyx_v_near, __pyx_v_far);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_76frustum(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_bottom, PyObject *__pyx_v_top, PyObject *__pyx_v_near, PyObject *__pyx_v_far) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  double __pyx_v_l;
  double __pyx_v_r;
  double __pyx_v_b;
  double __pyx_v_t;
  double __pyx_v_n;
  double __pyx_v_f;
  double __pyx_v_r_l;
  double __pyx_v_t_b;
  double __pyx_v_f_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("frustum", 0);

  /* "cgtypes.pyx":4126
 *         cdef double l,r,b,t,n,f, r_l, t_b, f_n
 * 
 *         l = left             # <<<<<<<<<<<<<<
 *         r = right
 *         b = bottom
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_left); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_l = __pyx_t_1;

  /* "cgtypes.pyx":4127
 * 
 *         l = left
 *         r = right             # <<<<<<<<<<<<<<
 *         b = bottom
 *         t = top
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_right); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_r = __pyx_t_1;

  /* "cgtypes.pyx":4128
 *         l = left
 *         r = right
 *         b = bottom             # <<<<<<<<<<<<<<
 *         t = top
 *         n = near
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_bottom); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_b = __pyx_t_1;

  /* "cgtypes.pyx":4129
 *         r = right
 *         b = bottom
 *         t = top             # <<<<<<<<<<<<<<
 *         n = near
 *         f = far
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_top); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_t = __pyx_t_1;

  /* "cgtypes.pyx":4130
 *         b = bottom
 *         t = top
 *         n = near             # <<<<<<<<<<<<<<
 *         f = far
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_near); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "cgtypes.pyx":4131
 *         t = top
 *         n = near
 *         f = far             # <<<<<<<<<<<<<<
 * 
 *         r_l = r-l
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_far); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = __pyx_t_1;

  /* "cgtypes.pyx":4133
 *         f = far
 * 
 *         r_l = r-l             # <<<<<<<<<<<<<<
 *         t_b = t-b
 *         f_n = f-n
 */
  __pyx_v_r_l = (__pyx_v_r - __pyx_v_l);

  /* "cgtypes.pyx":4134
 * 
 *         r_l = r-l
 *         t_b = t-b             # <<<<<<<<<<<<<<
 *         f_n = f-n
 * 
 */
  __pyx_v_t_b = (__pyx_v_t - __pyx_v_b);

  /* "cgtypes.pyx":4135
 *         r_l = r-l
 *         t_b = t-b
 *         f_n = f-n             # <<<<<<<<<<<<<<
 * 
 *         if r_l<=eps:
 */
  __pyx_v_f_n = (__pyx_v_f - __pyx_v_n);

  /* "cgtypes.pyx":4137
 *         f_n = f-n
 * 
 *         if r_l<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:
 */
  __pyx_t_2 = ((__pyx_v_r_l <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4138
 * 
 *         if r_l<=eps:
 *             raise ValueError, "right-value must be greater than left-value"             # <<<<<<<<<<<<<<
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_right_value_must_be_greater_than, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4139
 *         if r_l<=eps:
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:
 */
  __pyx_t_2 = ((__pyx_v_t_b <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4140
 *             raise ValueError, "right-value must be greater than left-value"
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"             # <<<<<<<<<<<<<<
 *         if f_n<=eps:
 *             raise ValueError, "far-value must be greater than near-value"
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_top_value_must_be_greater_than_b, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4141
 *         if t_b<=eps:
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError, "far-value must be greater than near-value"
 * 
 */
  __pyx_t_2 = ((__pyx_v_f_n <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4142
 *             raise ValueError, "top-value must be greater than bottom-value"
 *         if f_n<=eps:
 *             raise ValueError, "far-value must be greater than near-value"             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_far_value_must_be_greater_than_n, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4144
 *             raise ValueError, "far-value must be greater than near-value"
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 * 
 *         res.m11 = (2.0*n)/r_l
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4146
 *         res = mat4()
 * 
 *         res.m11 = (2.0*n)/r_l             # <<<<<<<<<<<<<<
 *         res.m12 = 0.0
 *         res.m13 = (r+l)/r_l
 */
  __pyx_t_1 = (2.0 * __pyx_v_n);
  if (unlikely(__pyx_v_r_l == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m11 = (__pyx_t_1 / __pyx_v_r_l);

  /* "cgtypes.pyx":4147
 * 
 *         res.m11 = (2.0*n)/r_l
 *         res.m12 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = (r+l)/r_l
 *         res.m14 = 0.0
 */
  __pyx_v_res->m12 = 0.0;

  /* "cgtypes.pyx":4148
 *         res.m11 = (2.0*n)/r_l
 *         res.m12 = 0.0
 *         res.m13 = (r+l)/r_l             # <<<<<<<<<<<<<<
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 */
  __pyx_t_1 = (__pyx_v_r + __pyx_v_l);
  if (unlikely(__pyx_v_r_l == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m13 = (__pyx_t_1 / __pyx_v_r_l);

  /* "cgtypes.pyx":4149
 *         res.m12 = 0.0
 *         res.m13 = (r+l)/r_l
 *         res.m14 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = 0.0
 *         res.m22 = (2.0*n)/t_b
 */
  __pyx_v_res->m14 = 0.0;

  /* "cgtypes.pyx":4150
 *         res.m13 = (r+l)/r_l
 *         res.m14 = 0.0
 *         res.m21 = 0.0             # <<<<<<<<<<<<<<
 *         res.m22 = (2.0*n)/t_b
 *         res.m23 = (t+b)/t_b
 */
  __pyx_v_res->m21 = 0.0;

  /* "cgtypes.pyx":4151
 *         res.m14 = 0.0
 *         res.m21 = 0.0
 *         res.m22 = (2.0*n)/t_b             # <<<<<<<<<<<<<<
 *         res.m23 = (t+b)/t_b
 *         res.m24 = 0.0
 */
  __pyx_t_1 = (2.0 * __pyx_v_n);
  if (unlikely(__pyx_v_t_b == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m22 = (__pyx_t_1 / __pyx_v_t_b);

  /* "cgtypes.pyx":4152
 *         res.m21 = 0.0
 *         res.m22 = (2.0*n)/t_b
 *         res.m23 = (t+b)/t_b             # <<<<<<<<<<<<<<
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 */
  __pyx_t_1 = (__pyx_v_t + __pyx_v_b);
  if (unlikely(__pyx_v_t_b == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m23 = (__pyx_t_1 / __pyx_v_t_b);

  /* "cgtypes.pyx":4153
 *         res.m22 = (2.0*n)/t_b
 *         res.m23 = (t+b)/t_b
 *         res.m24 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 */
  __pyx_v_res->m24 = 0.0;

  /* "cgtypes.pyx":4154
 *         res.m23 = (t+b)/t_b
 *         res.m24 = 0.0
 *         res.m31 = 0.0             # <<<<<<<<<<<<<<
 *         res.m32 = 0.0
 *         res.m33 = -(f+n)/f_n
 */
  __pyx_v_res->m31 = 0.0;

  /* "cgtypes.pyx":4155
 *         res.m24 = 0.0
 *         res.m31 = 0.0
 *         res.m32 = 0.0             # <<<<<<<<<<<<<<
 *         res.m33 = -(f+n)/f_n
 *         res.m34 = (-2.0*f*n)/f_n
 */
  __pyx_v_res->m32 = 0.0;

  /* "cgtypes.pyx":4156
 *         res.m31 = 0.0
 *         res.m32 = 0.0
 *         res.m33 = -(f+n)/f_n             # <<<<<<<<<<<<<<
 *         res.m34 = (-2.0*f*n)/f_n
 *         res.m41 = 0.0
 */
  __pyx_t_1 = (-(__pyx_v_f + __pyx_v_n));
  if (unlikely(__pyx_v_f_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m33 = (__pyx_t_1 / __pyx_v_f_n);

  /* "cgtypes.pyx":4157
 *         res.m32 = 0.0
 *         res.m33 = -(f+n)/f_n
 *         res.m34 = (-2.0*f*n)/f_n             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_t_1 = ((-2.0 * __pyx_v_f) * __pyx_v_n);
  if (unlikely(__pyx_v_f_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_res->m34 = (__pyx_t_1 / __pyx_v_f_n);

  /* "cgtypes.pyx":4158
 *         res.m33 = -(f+n)/f_n
 *         res.m34 = (-2.0*f*n)/f_n
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = -1.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":4159
 *         res.m34 = (-2.0*f*n)/f_n
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = -1.0
 *         res.m44 = 0.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":4160
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = -1.0             # <<<<<<<<<<<<<<
 *         res.m44 = 0.0
 *         return res
 */
  __pyx_v_res->m43 = -1.0;

  /* "cgtypes.pyx":4161
 *         res.m42 = 0.0
 *         res.m43 = -1.0
 *         res.m44 = 0.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 0.0;

  /* "cgtypes.pyx":4162
 *         res.m43 = -1.0
 *         res.m44 = 0.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def perspective(self, fovy, aspect, near, far):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4121
 *         return res
 * 
 *     def frustum(self, left, right, bottom, top, near, far):             # <<<<<<<<<<<<<<
 *         """equivalent to the OpenGL command glFrustum()"""
 *         cdef mat4 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.mat4.frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4164
 *         return res
 * 
 *     def perspective(self, fovy, aspect, near, far):             # <<<<<<<<<<<<<<
 *         """von Mesa bernommen (glu.c)"""
 *         cdef double f, a
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_79perspective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_78perspective[] = "von Mesa \303\274bernommen (glu.c)";
static PyObject *__pyx_pw_7cgtypes_4mat4_79perspective(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fovy = 0;
  PyObject *__pyx_v_aspect = 0;
  PyObject *__pyx_v_near = 0;
  PyObject *__pyx_v_far = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("perspective (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fovy,&__pyx_n_s_aspect,&__pyx_n_s_near,&__pyx_n_s_far,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fovy)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_aspect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("perspective", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_near)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("perspective", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_far)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("perspective", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "perspective") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_fovy = values[0];
    __pyx_v_aspect = values[1];
    __pyx_v_near = values[2];
    __pyx_v_far = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("perspective", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4164; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.perspective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_78perspective(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_fovy, __pyx_v_aspect, __pyx_v_near, __pyx_v_far);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_78perspective(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_fovy, PyObject *__pyx_v_aspect, PyObject *__pyx_v_near, PyObject *__pyx_v_far) {
  double __pyx_v_f;
  double __pyx_v_a;
  double __pyx_v_top;
  double __pyx_v_bottom;
  double __pyx_v_left;
  double __pyx_v_right;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("perspective", 0);

  /* "cgtypes.pyx":4169
 *         cdef double top, bottom, left, right
 * 
 *         f = fovy             # <<<<<<<<<<<<<<
 *         a = aspect
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_fovy); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_f = __pyx_t_1;

  /* "cgtypes.pyx":4170
 * 
 *         f = fovy
 *         a = aspect             # <<<<<<<<<<<<<<
 * 
 *         top    = near * tan(f * 3.1415926535897931 / 360.0)
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_aspect); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_a = __pyx_t_1;

  /* "cgtypes.pyx":4172
 *         a = aspect
 * 
 *         top    = near * tan(f * 3.1415926535897931 / 360.0)             # <<<<<<<<<<<<<<
 *         bottom = -top
 *         left   = bottom * a
 */
  __pyx_t_2 = PyFloat_FromDouble(tan(((__pyx_v_f * 3.1415926535897931) / 360.0))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_near, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_top = __pyx_t_1;

  /* "cgtypes.pyx":4173
 * 
 *         top    = near * tan(f * 3.1415926535897931 / 360.0)
 *         bottom = -top             # <<<<<<<<<<<<<<
 *         left   = bottom * a
 *         right  = top * a
 */
  __pyx_v_bottom = (-__pyx_v_top);

  /* "cgtypes.pyx":4174
 *         top    = near * tan(f * 3.1415926535897931 / 360.0)
 *         bottom = -top
 *         left   = bottom * a             # <<<<<<<<<<<<<<
 *         right  = top * a
 * 
 */
  __pyx_v_left = (__pyx_v_bottom * __pyx_v_a);

  /* "cgtypes.pyx":4175
 *         bottom = -top
 *         left   = bottom * a
 *         right  = top * a             # <<<<<<<<<<<<<<
 * 
 *         return self.frustum(left, right, bottom, top, near, far)
 */
  __pyx_v_right = (__pyx_v_top * __pyx_v_a);

  /* "cgtypes.pyx":4177
 *         right  = top * a
 * 
 *         return self.frustum(left, right, bottom, top, near, far)             # <<<<<<<<<<<<<<
 * 
 *     def lookAt(self, pos, target, up=(0,0,1)):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_frustum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_left); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_right); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_bottom); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_top); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_9 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_8) {
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_9, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_near);
  PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_9, __pyx_v_near);
  __Pyx_GIVEREF(__pyx_v_near);
  __Pyx_INCREF(__pyx_v_far);
  PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_9, __pyx_v_far);
  __Pyx_GIVEREF(__pyx_v_far);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4164
 *         return res
 * 
 *     def perspective(self, fovy, aspect, near, far):             # <<<<<<<<<<<<<<
 *         """von Mesa bernommen (glu.c)"""
 *         cdef double f, a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cgtypes.mat4.perspective", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4179
 *         return self.frustum(left, right, bottom, top, near, far)
 * 
 *     def lookAt(self, pos, target, up=(0,0,1)):             # <<<<<<<<<<<<<<
 *         """Look from pos to target.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_81lookAt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_80lookAt[] = "Look from pos to target.\n\n        The resulting transformation moves the origin to pos and\n        rotates so that The z-axis points to target. The y-axis is\n        as close as possible to the up vector.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_81lookAt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_target = 0;
  PyObject *__pyx_v_up = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lookAt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_target,&__pyx_n_s_up,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)__pyx_tuple__18);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lookAt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_up);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lookAt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pos = values[0];
    __pyx_v_target = values[1];
    __pyx_v_up = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lookAt", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.mat4.lookAt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4mat4_80lookAt(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), __pyx_v_pos, __pyx_v_target, __pyx_v_up);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_80lookAt(CYTHON_UNUSED struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, PyObject *__pyx_v_pos, PyObject *__pyx_v_target, PyObject *__pyx_v_up) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_right = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_vup = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_dir = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  double __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lookAt", 0);
  __Pyx_INCREF(__pyx_v_pos);
  __Pyx_INCREF(__pyx_v_target);

  /* "cgtypes.pyx":4189
 *         cdef vec3 right,vup,dir
 * 
 *         pos    = vec3(pos)             # <<<<<<<<<<<<<<
 *         target = vec3(target)
 *         vup    = vec3(up)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_pos);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pos);
  __Pyx_GIVEREF(__pyx_v_pos);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pos, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4190
 * 
 *         pos    = vec3(pos)
 *         target = vec3(target)             # <<<<<<<<<<<<<<
 *         vup    = vec3(up)
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_target);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_target);
  __Pyx_GIVEREF(__pyx_v_target);
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_target, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4191
 *         pos    = vec3(pos)
 *         target = vec3(target)
 *         vup    = vec3(up)             # <<<<<<<<<<<<<<
 * 
 *         dir = (target - pos).normalize()
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_up);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_up);
  __Pyx_GIVEREF(__pyx_v_up);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_vup = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4193
 *         vup    = vec3(up)
 * 
 *         dir = (target - pos).normalize()             # <<<<<<<<<<<<<<
 *         vup = vup.normalize()
 *         vup = vup - (vup * dir) * dir
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_target, __pyx_v_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_normalize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_dir = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4194
 * 
 *         dir = (target - pos).normalize()
 *         vup = vup.normalize()             # <<<<<<<<<<<<<<
 *         vup = vup - (vup * dir) * dir
 *         try:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vup), __pyx_n_s_normalize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_vup, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4195
 *         dir = (target - pos).normalize()
 *         vup = vup.normalize()
 *         vup = vup - (vup * dir) * dir             # <<<<<<<<<<<<<<
 *         try:
 *             vup  = vup.normalize()
 */
  __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_v_vup), ((PyObject *)__pyx_v_dir)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, ((PyObject *)__pyx_v_dir)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_vup), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_vup, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4196
 *         vup = vup.normalize()
 *         vup = vup - (vup * dir) * dir
 *         try:             # <<<<<<<<<<<<<<
 *             vup  = vup.normalize()
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "cgtypes.pyx":4197
 *         vup = vup - (vup * dir) * dir
 *         try:
 *             vup  = vup.normalize()             # <<<<<<<<<<<<<<
 *         except:
 *             # We're looking along the up direction, so choose
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vup), __pyx_n_s_normalize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_1) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF_SET(__pyx_v_vup, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2));
      __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":4198
 *         try:
 *             vup  = vup.normalize()
 *         except:             # <<<<<<<<<<<<<<
 *             # We're looking along the up direction, so choose
 *             # an arbitrary direction that is perpendicular to dir
 */
    /*except:*/ {
      __Pyx_AddTraceback("cgtypes.mat4.lookAt", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4198; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);

      /* "cgtypes.pyx":4202
 *             # an arbitrary direction that is perpendicular to dir
 *             # as new up.
 *             vup = dir.ortho()             # <<<<<<<<<<<<<<
 * 
 *         right = vup.cross(dir).normalize()
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dir), __pyx_n_s_ortho); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4202; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4202; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4202; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4202; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_DECREF_SET(__pyx_v_vup, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_7));
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    __pyx_L10_try_end:;
  }

  /* "cgtypes.pyx":4204
 *             vup = dir.ortho()
 * 
 *         right = vup.cross(dir).normalize()             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_vup), __pyx_n_s_cross); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_dir)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(((PyObject *)__pyx_v_dir));
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_dir));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_dir));
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_normalize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_right = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4206
 *         right = vup.cross(dir).normalize()
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = right.x
 *         res.m21 = right.y
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4207
 * 
 *         res = mat4()
 *         res.m11 = right.x             # <<<<<<<<<<<<<<
 *         res.m21 = right.y
 *         res.m31 = right.z
 */
  __pyx_t_10 = __pyx_v_right->x;
  __pyx_v_res->m11 = __pyx_t_10;

  /* "cgtypes.pyx":4208
 *         res = mat4()
 *         res.m11 = right.x
 *         res.m21 = right.y             # <<<<<<<<<<<<<<
 *         res.m31 = right.z
 *         res.m41 = 0.0
 */
  __pyx_t_10 = __pyx_v_right->y;
  __pyx_v_res->m21 = __pyx_t_10;

  /* "cgtypes.pyx":4209
 *         res.m11 = right.x
 *         res.m21 = right.y
 *         res.m31 = right.z             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m12 = vup.x
 */
  __pyx_t_10 = __pyx_v_right->z;
  __pyx_v_res->m31 = __pyx_t_10;

  /* "cgtypes.pyx":4210
 *         res.m21 = right.y
 *         res.m31 = right.z
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m12 = vup.x
 *         res.m22 = vup.y
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":4211
 *         res.m31 = right.z
 *         res.m41 = 0.0
 *         res.m12 = vup.x             # <<<<<<<<<<<<<<
 *         res.m22 = vup.y
 *         res.m32 = vup.z
 */
  __pyx_t_10 = __pyx_v_vup->x;
  __pyx_v_res->m12 = __pyx_t_10;

  /* "cgtypes.pyx":4212
 *         res.m41 = 0.0
 *         res.m12 = vup.x
 *         res.m22 = vup.y             # <<<<<<<<<<<<<<
 *         res.m32 = vup.z
 *         res.m42 = 0.0
 */
  __pyx_t_10 = __pyx_v_vup->y;
  __pyx_v_res->m22 = __pyx_t_10;

  /* "cgtypes.pyx":4213
 *         res.m12 = vup.x
 *         res.m22 = vup.y
 *         res.m32 = vup.z             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m13 = dir.x
 */
  __pyx_t_10 = __pyx_v_vup->z;
  __pyx_v_res->m32 = __pyx_t_10;

  /* "cgtypes.pyx":4214
 *         res.m22 = vup.y
 *         res.m32 = vup.z
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m13 = dir.x
 *         res.m23 = dir.y
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":4215
 *         res.m32 = vup.z
 *         res.m42 = 0.0
 *         res.m13 = dir.x             # <<<<<<<<<<<<<<
 *         res.m23 = dir.y
 *         res.m33 = dir.z
 */
  __pyx_t_10 = __pyx_v_dir->x;
  __pyx_v_res->m13 = __pyx_t_10;

  /* "cgtypes.pyx":4216
 *         res.m42 = 0.0
 *         res.m13 = dir.x
 *         res.m23 = dir.y             # <<<<<<<<<<<<<<
 *         res.m33 = dir.z
 *         res.m43 = 0.0
 */
  __pyx_t_10 = __pyx_v_dir->y;
  __pyx_v_res->m23 = __pyx_t_10;

  /* "cgtypes.pyx":4217
 *         res.m13 = dir.x
 *         res.m23 = dir.y
 *         res.m33 = dir.z             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m14 = pos.x
 */
  __pyx_t_10 = __pyx_v_dir->z;
  __pyx_v_res->m33 = __pyx_t_10;

  /* "cgtypes.pyx":4218
 *         res.m23 = dir.y
 *         res.m33 = dir.z
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m14 = pos.x
 *         res.m24 = pos.y
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":4219
 *         res.m33 = dir.z
 *         res.m43 = 0.0
 *         res.m14 = pos.x             # <<<<<<<<<<<<<<
 *         res.m24 = pos.y
 *         res.m34 = pos.z
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos, __pyx_n_s_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m14 = __pyx_t_10;

  /* "cgtypes.pyx":4220
 *         res.m43 = 0.0
 *         res.m14 = pos.x
 *         res.m24 = pos.y             # <<<<<<<<<<<<<<
 *         res.m34 = pos.z
 *         res.m44 = 1.0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos, __pyx_n_s_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m24 = __pyx_t_10;

  /* "cgtypes.pyx":4221
 *         res.m14 = pos.x
 *         res.m24 = pos.y
 *         res.m34 = pos.z             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pos, __pyx_n_s_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m34 = __pyx_t_10;

  /* "cgtypes.pyx":4222
 *         res.m24 = pos.y
 *         res.m34 = pos.z
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":4223
 *         res.m34 = pos.z
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def ortho(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4179
 *         return self.frustum(left, right, bottom, top, near, far)
 * 
 *     def lookAt(self, pos, target, up=(0,0,1)):             # <<<<<<<<<<<<<<
 *         """Look from pos to target.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cgtypes.mat4.lookAt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_right);
  __Pyx_XDECREF((PyObject *)__pyx_v_vup);
  __Pyx_XDECREF((PyObject *)__pyx_v_dir);
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_target);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4225
 *         return res
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Return a matrix with orthogonal base vectors.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_83ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_82ortho[] = "Return a matrix with orthogonal base vectors.\n\n        Makes the x-, y- and z-axis orthogonal.\n        The fourth column and row remain untouched.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_83ortho(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_82ortho(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_82ortho(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_x = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_y = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_z = 0;
  PyObject *__pyx_v_xl = NULL;
  PyObject *__pyx_v_yl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ortho", 0);

  /* "cgtypes.pyx":4234
 *         cdef vec3 x,y,z
 * 
 *         x = vec3(self.m11, self.m21, self.m31)             # <<<<<<<<<<<<<<
 *         y = vec3(self.m12, self.m22, self.m32)
 *         z = vec3(self.m13, self.m23, self.m33)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m31); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_x = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4235
 * 
 *         x = vec3(self.m11, self.m21, self.m31)
 *         y = vec3(self.m12, self.m22, self.m32)             # <<<<<<<<<<<<<<
 *         z = vec3(self.m13, self.m23, self.m33)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m22); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_y = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4236
 *         x = vec3(self.m11, self.m21, self.m31)
 *         y = vec3(self.m12, self.m22, self.m32)
 *         z = vec3(self.m13, self.m23, self.m33)             # <<<<<<<<<<<<<<
 * 
 *         xl = x.length()
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->m23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->m33); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_z = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4238
 *         z = vec3(self.m13, self.m23, self.m33)
 * 
 *         xl = x.length()             # <<<<<<<<<<<<<<
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_x), __pyx_n_s_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_xl = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4239
 * 
 *         xl = x.length()
 *         xl = xl*xl             # <<<<<<<<<<<<<<
 *         y = y - ((x*y)/xl)*x
 *         z = z - ((x*z)/xl)*x
 */
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_xl, __pyx_v_xl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_xl, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4240
 *         xl = x.length()
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x             # <<<<<<<<<<<<<<
 *         z = z - ((x*z)/xl)*x
 * 
 */
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_xl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_y, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4241
 *         xl = xl*xl
 *         y = y - ((x*y)/xl)*x
 *         z = z - ((x*z)/xl)*x             # <<<<<<<<<<<<<<
 * 
 *         yl = y.length()
 */
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_z)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_xl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, ((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Subtract(((PyObject *)__pyx_v_z), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4243
 *         z = z - ((x*z)/xl)*x
 * 
 *         yl = y.length()             # <<<<<<<<<<<<<<
 *         yl = yl*yl
 *         z = z - ((y*z)/yl)*y
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_yl = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4244
 * 
 *         yl = y.length()
 *         yl = yl*yl             # <<<<<<<<<<<<<<
 *         z = z - ((y*z)/yl)*y
 * 
 */
  __pyx_t_4 = PyNumber_Multiply(__pyx_v_yl, __pyx_v_yl); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_yl, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cgtypes.pyx":4245
 *         yl = y.length()
 *         yl = yl*yl
 *         z = z - ((y*z)/yl)*y             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_z)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_yl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_y)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_z), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cgtypes_vec3))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF_SET(__pyx_v_z, ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3));
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4247
 *         z = z - ((y*z)/yl)*y
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 *         res.m11 = x.x
 *         res.m12 = y.x
 */
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4248
 * 
 *         res = mat4()
 *         res.m11 = x.x             # <<<<<<<<<<<<<<
 *         res.m12 = y.x
 *         res.m13 = z.x
 */
  __pyx_t_5 = __pyx_v_x->x;
  __pyx_v_res->m11 = __pyx_t_5;

  /* "cgtypes.pyx":4249
 *         res = mat4()
 *         res.m11 = x.x
 *         res.m12 = y.x             # <<<<<<<<<<<<<<
 *         res.m13 = z.x
 *         res.m14 = self.m14
 */
  __pyx_t_5 = __pyx_v_y->x;
  __pyx_v_res->m12 = __pyx_t_5;

  /* "cgtypes.pyx":4250
 *         res.m11 = x.x
 *         res.m12 = y.x
 *         res.m13 = z.x             # <<<<<<<<<<<<<<
 *         res.m14 = self.m14
 *         res.m21 = x.y
 */
  __pyx_t_5 = __pyx_v_z->x;
  __pyx_v_res->m13 = __pyx_t_5;

  /* "cgtypes.pyx":4251
 *         res.m12 = y.x
 *         res.m13 = z.x
 *         res.m14 = self.m14             # <<<<<<<<<<<<<<
 *         res.m21 = x.y
 *         res.m22 = y.y
 */
  __pyx_t_5 = __pyx_v_self->m14;
  __pyx_v_res->m14 = __pyx_t_5;

  /* "cgtypes.pyx":4252
 *         res.m13 = z.x
 *         res.m14 = self.m14
 *         res.m21 = x.y             # <<<<<<<<<<<<<<
 *         res.m22 = y.y
 *         res.m23 = z.y
 */
  __pyx_t_5 = __pyx_v_x->y;
  __pyx_v_res->m21 = __pyx_t_5;

  /* "cgtypes.pyx":4253
 *         res.m14 = self.m14
 *         res.m21 = x.y
 *         res.m22 = y.y             # <<<<<<<<<<<<<<
 *         res.m23 = z.y
 *         res.m24 = self.m24
 */
  __pyx_t_5 = __pyx_v_y->y;
  __pyx_v_res->m22 = __pyx_t_5;

  /* "cgtypes.pyx":4254
 *         res.m21 = x.y
 *         res.m22 = y.y
 *         res.m23 = z.y             # <<<<<<<<<<<<<<
 *         res.m24 = self.m24
 *         res.m31 = x.z
 */
  __pyx_t_5 = __pyx_v_z->y;
  __pyx_v_res->m23 = __pyx_t_5;

  /* "cgtypes.pyx":4255
 *         res.m22 = y.y
 *         res.m23 = z.y
 *         res.m24 = self.m24             # <<<<<<<<<<<<<<
 *         res.m31 = x.z
 *         res.m32 = y.z
 */
  __pyx_t_5 = __pyx_v_self->m24;
  __pyx_v_res->m24 = __pyx_t_5;

  /* "cgtypes.pyx":4256
 *         res.m23 = z.y
 *         res.m24 = self.m24
 *         res.m31 = x.z             # <<<<<<<<<<<<<<
 *         res.m32 = y.z
 *         res.m33 = z.z
 */
  __pyx_t_5 = __pyx_v_x->z;
  __pyx_v_res->m31 = __pyx_t_5;

  /* "cgtypes.pyx":4257
 *         res.m24 = self.m24
 *         res.m31 = x.z
 *         res.m32 = y.z             # <<<<<<<<<<<<<<
 *         res.m33 = z.z
 *         res.m34 = self.m34
 */
  __pyx_t_5 = __pyx_v_y->z;
  __pyx_v_res->m32 = __pyx_t_5;

  /* "cgtypes.pyx":4258
 *         res.m31 = x.z
 *         res.m32 = y.z
 *         res.m33 = z.z             # <<<<<<<<<<<<<<
 *         res.m34 = self.m34
 *         res.m41 = self.m41
 */
  __pyx_t_5 = __pyx_v_z->z;
  __pyx_v_res->m33 = __pyx_t_5;

  /* "cgtypes.pyx":4259
 *         res.m32 = y.z
 *         res.m33 = z.z
 *         res.m34 = self.m34             # <<<<<<<<<<<<<<
 *         res.m41 = self.m41
 *         res.m42 = self.m42
 */
  __pyx_t_5 = __pyx_v_self->m34;
  __pyx_v_res->m34 = __pyx_t_5;

  /* "cgtypes.pyx":4260
 *         res.m33 = z.z
 *         res.m34 = self.m34
 *         res.m41 = self.m41             # <<<<<<<<<<<<<<
 *         res.m42 = self.m42
 *         res.m43 = self.m43
 */
  __pyx_t_5 = __pyx_v_self->m41;
  __pyx_v_res->m41 = __pyx_t_5;

  /* "cgtypes.pyx":4261
 *         res.m34 = self.m34
 *         res.m41 = self.m41
 *         res.m42 = self.m42             # <<<<<<<<<<<<<<
 *         res.m43 = self.m43
 *         res.m44 = self.m44
 */
  __pyx_t_5 = __pyx_v_self->m42;
  __pyx_v_res->m42 = __pyx_t_5;

  /* "cgtypes.pyx":4262
 *         res.m41 = self.m41
 *         res.m42 = self.m42
 *         res.m43 = self.m43             # <<<<<<<<<<<<<<
 *         res.m44 = self.m44
 *         return res
 */
  __pyx_t_5 = __pyx_v_self->m43;
  __pyx_v_res->m43 = __pyx_t_5;

  /* "cgtypes.pyx":4263
 *         res.m42 = self.m42
 *         res.m43 = self.m43
 *         res.m44 = self.m44             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_5 = __pyx_v_self->m44;
  __pyx_v_res->m44 = __pyx_t_5;

  /* "cgtypes.pyx":4264
 *         res.m43 = self.m43
 *         res.m44 = self.m44
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def decompose(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4225
 *         return res
 * 
 *     def ortho(self):             # <<<<<<<<<<<<<<
 *         """Return a matrix with orthogonal base vectors.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.mat4.ortho", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XDECREF((PyObject *)__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_xl);
  __Pyx_XDECREF(__pyx_v_yl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4266
 *         return res
 * 
 *     def decompose(self):             # <<<<<<<<<<<<<<
 *         """Decomposes the matrix into a translation, rotation and scaling part.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_85decompose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_84decompose[] = "Decomposes the matrix into a translation, rotation and scaling part.\n\n        Returns a tuple (translation, rotation, scaling). The\n        translation and scaling parts are given as vec3's, the rotation\n        is still given as a mat4.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_85decompose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decompose (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_84decompose(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_84decompose(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_m = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_a = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_b = 0;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_c = 0;
  double __pyx_v_al;
  double __pyx_v_bl;
  double __pyx_v_cl;
  struct __pyx_obj_7cgtypes_vec3 *__pyx_v_scale = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decompose", 0);

  /* "cgtypes.pyx":4277
 *         cdef double al, bl, cl
 * 
 *         m = self.ortho()             # <<<<<<<<<<<<<<
 *         m.m14 = 0.0
 *         m.m24 = 0.0
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ortho); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_mat4))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_m = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4278
 * 
 *         m = self.ortho()
 *         m.m14 = 0.0             # <<<<<<<<<<<<<<
 *         m.m24 = 0.0
 *         m.m34 = 0.0
 */
  __pyx_v_m->m14 = 0.0;

  /* "cgtypes.pyx":4279
 *         m = self.ortho()
 *         m.m14 = 0.0
 *         m.m24 = 0.0             # <<<<<<<<<<<<<<
 *         m.m34 = 0.0
 *         m.m44 = 1.0
 */
  __pyx_v_m->m24 = 0.0;

  /* "cgtypes.pyx":4280
 *         m.m14 = 0.0
 *         m.m24 = 0.0
 *         m.m34 = 0.0             # <<<<<<<<<<<<<<
 *         m.m44 = 1.0
 *         m.m41 = 0.0
 */
  __pyx_v_m->m34 = 0.0;

  /* "cgtypes.pyx":4281
 *         m.m24 = 0.0
 *         m.m34 = 0.0
 *         m.m44 = 1.0             # <<<<<<<<<<<<<<
 *         m.m41 = 0.0
 *         m.m42 = 0.0
 */
  __pyx_v_m->m44 = 1.0;

  /* "cgtypes.pyx":4282
 *         m.m34 = 0.0
 *         m.m44 = 1.0
 *         m.m41 = 0.0             # <<<<<<<<<<<<<<
 *         m.m42 = 0.0
 *         m.m43 = 0.0
 */
  __pyx_v_m->m41 = 0.0;

  /* "cgtypes.pyx":4283
 *         m.m44 = 1.0
 *         m.m41 = 0.0
 *         m.m42 = 0.0             # <<<<<<<<<<<<<<
 *         m.m43 = 0.0
 * 
 */
  __pyx_v_m->m42 = 0.0;

  /* "cgtypes.pyx":4284
 *         m.m41 = 0.0
 *         m.m42 = 0.0
 *         m.m43 = 0.0             # <<<<<<<<<<<<<<
 * 
 *         # a,b,c = Column 0,1,2 of m
 */
  __pyx_v_m->m43 = 0.0;

  /* "cgtypes.pyx":4287
 * 
 *         # a,b,c = Column 0,1,2 of m
 *         a = vec3()             # <<<<<<<<<<<<<<
 *         b = vec3()
 *         c = vec3()
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_a = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4288
 *         # a,b,c = Column 0,1,2 of m
 *         a = vec3()
 *         b = vec3()             # <<<<<<<<<<<<<<
 *         c = vec3()
 *         a.x = m.m11
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_b = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4289
 *         a = vec3()
 *         b = vec3()
 *         c = vec3()             # <<<<<<<<<<<<<<
 *         a.x = m.m11
 *         a.y = m.m21
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_c = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4290
 *         b = vec3()
 *         c = vec3()
 *         a.x = m.m11             # <<<<<<<<<<<<<<
 *         a.y = m.m21
 *         a.z = m.m31
 */
  __pyx_t_4 = __pyx_v_m->m11;
  __pyx_v_a->x = __pyx_t_4;

  /* "cgtypes.pyx":4291
 *         c = vec3()
 *         a.x = m.m11
 *         a.y = m.m21             # <<<<<<<<<<<<<<
 *         a.z = m.m31
 *         b.x = m.m12
 */
  __pyx_t_4 = __pyx_v_m->m21;
  __pyx_v_a->y = __pyx_t_4;

  /* "cgtypes.pyx":4292
 *         a.x = m.m11
 *         a.y = m.m21
 *         a.z = m.m31             # <<<<<<<<<<<<<<
 *         b.x = m.m12
 *         b.y = m.m22
 */
  __pyx_t_4 = __pyx_v_m->m31;
  __pyx_v_a->z = __pyx_t_4;

  /* "cgtypes.pyx":4293
 *         a.y = m.m21
 *         a.z = m.m31
 *         b.x = m.m12             # <<<<<<<<<<<<<<
 *         b.y = m.m22
 *         b.z = m.m32
 */
  __pyx_t_4 = __pyx_v_m->m12;
  __pyx_v_b->x = __pyx_t_4;

  /* "cgtypes.pyx":4294
 *         a.z = m.m31
 *         b.x = m.m12
 *         b.y = m.m22             # <<<<<<<<<<<<<<
 *         b.z = m.m32
 *         c.x = m.m13
 */
  __pyx_t_4 = __pyx_v_m->m22;
  __pyx_v_b->y = __pyx_t_4;

  /* "cgtypes.pyx":4295
 *         b.x = m.m12
 *         b.y = m.m22
 *         b.z = m.m32             # <<<<<<<<<<<<<<
 *         c.x = m.m13
 *         c.y = m.m23
 */
  __pyx_t_4 = __pyx_v_m->m32;
  __pyx_v_b->z = __pyx_t_4;

  /* "cgtypes.pyx":4296
 *         b.y = m.m22
 *         b.z = m.m32
 *         c.x = m.m13             # <<<<<<<<<<<<<<
 *         c.y = m.m23
 *         c.z = m.m33
 */
  __pyx_t_4 = __pyx_v_m->m13;
  __pyx_v_c->x = __pyx_t_4;

  /* "cgtypes.pyx":4297
 *         b.z = m.m32
 *         c.x = m.m13
 *         c.y = m.m23             # <<<<<<<<<<<<<<
 *         c.z = m.m33
 * 
 */
  __pyx_t_4 = __pyx_v_m->m23;
  __pyx_v_c->y = __pyx_t_4;

  /* "cgtypes.pyx":4298
 *         c.x = m.m13
 *         c.y = m.m23
 *         c.z = m.m33             # <<<<<<<<<<<<<<
 * 
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 */
  __pyx_t_4 = __pyx_v_m->m33;
  __pyx_v_c->z = __pyx_t_4;

  /* "cgtypes.pyx":4301
 * 
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)             # <<<<<<<<<<<<<<
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 */
  __pyx_v_al = sqrt((((__pyx_v_a->x * __pyx_v_a->x) + (__pyx_v_a->y * __pyx_v_a->y)) + (__pyx_v_a->z * __pyx_v_a->z)));

  /* "cgtypes.pyx":4302
 *         # al,bl,cl = length of a,b,c (= scaling factors)
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)             # <<<<<<<<<<<<<<
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:
 */
  __pyx_v_bl = sqrt((((__pyx_v_b->x * __pyx_v_b->x) + (__pyx_v_b->y * __pyx_v_b->y)) + (__pyx_v_b->z * __pyx_v_b->z)));

  /* "cgtypes.pyx":4303
 *         al = sqrt(a.x*a.x + a.y*a.y + a.z*a.z)
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)             # <<<<<<<<<<<<<<
 *         if al<=eps or bl<=eps or cl<=eps:
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 */
  __pyx_v_cl = sqrt((((__pyx_v_c->x * __pyx_v_c->x) + (__pyx_v_c->y * __pyx_v_c->y)) + (__pyx_v_c->z * __pyx_v_c->z)));

  /* "cgtypes.pyx":4304
 *         bl = sqrt(b.x*b.x + b.y*b.y + b.z*b.z)
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 * 
 */
  __pyx_t_6 = ((__pyx_v_al <= __pyx_v_7cgtypes_eps) != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = ((__pyx_v_bl <= __pyx_v_7cgtypes_eps) != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = ((__pyx_v_cl <= __pyx_v_7cgtypes_eps) != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "cgtypes.pyx":4305
 *         cl = sqrt(c.x*c.x + c.y*c.y + c.z*c.z)
 *         if al<=eps or bl<=eps or cl<=eps:
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"             # <<<<<<<<<<<<<<
 * 
 *         scale = vec3(al,bl,cl)
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_transformation_contains_a_0_scal, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4307
 *             raise ZeroDivisionError,"transformation contains a 0 scaling"
 * 
 *         scale = vec3(al,bl,cl)             # <<<<<<<<<<<<<<
 * 
 *         # normalizing a,b,c
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_al); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_bl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_cl); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_scale = ((struct __pyx_obj_7cgtypes_vec3 *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4313
 * #        b/=bl
 * #        c/=cl
 *         a.x = a.x/al             # <<<<<<<<<<<<<<
 *         a.y = a.y/al
 *         a.z = a.z/al
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->x = (__pyx_v_a->x / __pyx_v_al);

  /* "cgtypes.pyx":4314
 * #        c/=cl
 *         a.x = a.x/al
 *         a.y = a.y/al             # <<<<<<<<<<<<<<
 *         a.z = a.z/al
 *         b.x = b.x/bl
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->y = (__pyx_v_a->y / __pyx_v_al);

  /* "cgtypes.pyx":4315
 *         a.x = a.x/al
 *         a.y = a.y/al
 *         a.z = a.z/al             # <<<<<<<<<<<<<<
 *         b.x = b.x/bl
 *         b.y = b.y/bl
 */
  if (unlikely(__pyx_v_al == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a->z = (__pyx_v_a->z / __pyx_v_al);

  /* "cgtypes.pyx":4316
 *         a.y = a.y/al
 *         a.z = a.z/al
 *         b.x = b.x/bl             # <<<<<<<<<<<<<<
 *         b.y = b.y/bl
 *         b.z = b.z/bl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->x = (__pyx_v_b->x / __pyx_v_bl);

  /* "cgtypes.pyx":4317
 *         a.z = a.z/al
 *         b.x = b.x/bl
 *         b.y = b.y/bl             # <<<<<<<<<<<<<<
 *         b.z = b.z/bl
 *         c.x = c.x/cl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->y = (__pyx_v_b->y / __pyx_v_bl);

  /* "cgtypes.pyx":4318
 *         b.x = b.x/bl
 *         b.y = b.y/bl
 *         b.z = b.z/bl             # <<<<<<<<<<<<<<
 *         c.x = c.x/cl
 *         c.y = c.y/cl
 */
  if (unlikely(__pyx_v_bl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b->z = (__pyx_v_b->z / __pyx_v_bl);

  /* "cgtypes.pyx":4319
 *         b.y = b.y/bl
 *         b.z = b.z/bl
 *         c.x = c.x/cl             # <<<<<<<<<<<<<<
 *         c.y = c.y/cl
 *         c.z = c.z/cl
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->x = (__pyx_v_c->x / __pyx_v_cl);

  /* "cgtypes.pyx":4320
 *         b.z = b.z/bl
 *         c.x = c.x/cl
 *         c.y = c.y/cl             # <<<<<<<<<<<<<<
 *         c.z = c.z/cl
 * 
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->y = (__pyx_v_c->y / __pyx_v_cl);

  /* "cgtypes.pyx":4321
 *         c.x = c.x/cl
 *         c.y = c.y/cl
 *         c.z = c.z/cl             # <<<<<<<<<<<<<<
 * 
 *         m.m11 = a.x
 */
  if (unlikely(__pyx_v_cl == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_c->z = (__pyx_v_c->z / __pyx_v_cl);

  /* "cgtypes.pyx":4323
 *         c.z = c.z/cl
 * 
 *         m.m11 = a.x             # <<<<<<<<<<<<<<
 *         m.m21 = a.y
 *         m.m31 = a.z
 */
  __pyx_t_4 = __pyx_v_a->x;
  __pyx_v_m->m11 = __pyx_t_4;

  /* "cgtypes.pyx":4324
 * 
 *         m.m11 = a.x
 *         m.m21 = a.y             # <<<<<<<<<<<<<<
 *         m.m31 = a.z
 *         m.m12 = b.x
 */
  __pyx_t_4 = __pyx_v_a->y;
  __pyx_v_m->m21 = __pyx_t_4;

  /* "cgtypes.pyx":4325
 *         m.m11 = a.x
 *         m.m21 = a.y
 *         m.m31 = a.z             # <<<<<<<<<<<<<<
 *         m.m12 = b.x
 *         m.m22 = b.y
 */
  __pyx_t_4 = __pyx_v_a->z;
  __pyx_v_m->m31 = __pyx_t_4;

  /* "cgtypes.pyx":4326
 *         m.m21 = a.y
 *         m.m31 = a.z
 *         m.m12 = b.x             # <<<<<<<<<<<<<<
 *         m.m22 = b.y
 *         m.m32 = b.z
 */
  __pyx_t_4 = __pyx_v_b->x;
  __pyx_v_m->m12 = __pyx_t_4;

  /* "cgtypes.pyx":4327
 *         m.m31 = a.z
 *         m.m12 = b.x
 *         m.m22 = b.y             # <<<<<<<<<<<<<<
 *         m.m32 = b.z
 *         m.m13 = c.x
 */
  __pyx_t_4 = __pyx_v_b->y;
  __pyx_v_m->m22 = __pyx_t_4;

  /* "cgtypes.pyx":4328
 *         m.m12 = b.x
 *         m.m22 = b.y
 *         m.m32 = b.z             # <<<<<<<<<<<<<<
 *         m.m13 = c.x
 *         m.m23 = c.y
 */
  __pyx_t_4 = __pyx_v_b->z;
  __pyx_v_m->m32 = __pyx_t_4;

  /* "cgtypes.pyx":4329
 *         m.m22 = b.y
 *         m.m32 = b.z
 *         m.m13 = c.x             # <<<<<<<<<<<<<<
 *         m.m23 = c.y
 *         m.m33 = c.z
 */
  __pyx_t_4 = __pyx_v_c->x;
  __pyx_v_m->m13 = __pyx_t_4;

  /* "cgtypes.pyx":4330
 *         m.m32 = b.z
 *         m.m13 = c.x
 *         m.m23 = c.y             # <<<<<<<<<<<<<<
 *         m.m33 = c.z
 *         if m.determinant()<0.0:
 */
  __pyx_t_4 = __pyx_v_c->y;
  __pyx_v_m->m23 = __pyx_t_4;

  /* "cgtypes.pyx":4331
 *         m.m13 = c.x
 *         m.m23 = c.y
 *         m.m33 = c.z             # <<<<<<<<<<<<<<
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11
 */
  __pyx_t_4 = __pyx_v_c->z;
  __pyx_v_m->m33 = __pyx_t_4;

  /* "cgtypes.pyx":4332
 *         m.m23 = c.y
 *         m.m33 = c.z
 *         if m.determinant()<0.0:             # <<<<<<<<<<<<<<
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_m), __pyx_n_s_determinant); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_float_0_0, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {

    /* "cgtypes.pyx":4333
 *         m.m33 = c.z
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11             # <<<<<<<<<<<<<<
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31
 */
    __pyx_v_m->m11 = (-__pyx_v_m->m11);

    /* "cgtypes.pyx":4334
 *         if m.determinant()<0.0:
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21             # <<<<<<<<<<<<<<
 *             m.m31 = -m.m31
 *             scale.x = -scale.x
 */
    __pyx_v_m->m21 = (-__pyx_v_m->m21);

    /* "cgtypes.pyx":4335
 *             m.m11 = -m.m11
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31             # <<<<<<<<<<<<<<
 *             scale.x = -scale.x
 * 
 */
    __pyx_v_m->m31 = (-__pyx_v_m->m31);

    /* "cgtypes.pyx":4336
 *             m.m21 = -m.m21
 *             m.m31 = -m.m31
 *             scale.x = -scale.x             # <<<<<<<<<<<<<<
 * 
 *         return (vec3(self.m14, self.m24, self.m34), m, scale)
 */
    __pyx_v_scale->x = (-__pyx_v_scale->x);
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "cgtypes.pyx":4338
 *             scale.x = -scale.x
 * 
 *         return (vec3(self.m14, self.m24, self.m34), m, scale)             # <<<<<<<<<<<<<<
 * 
 *     def getMat3(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->m14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->m24); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->m34); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_7 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_m));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_m));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_m));
  __Pyx_INCREF(((PyObject *)__pyx_v_scale));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_scale));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_scale));
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4266
 *         return res
 * 
 *     def decompose(self):             # <<<<<<<<<<<<<<
 *         """Decomposes the matrix into a translation, rotation and scaling part.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.mat4.decompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_m);
  __Pyx_XDECREF((PyObject *)__pyx_v_a);
  __Pyx_XDECREF((PyObject *)__pyx_v_b);
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XDECREF((PyObject *)__pyx_v_scale);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4340
 *         return (vec3(self.m14, self.m24, self.m34), m, scale)
 * 
 *     def getMat3(self):             # <<<<<<<<<<<<<<
 *         """Convert to mat3 by discarding 4th row and column.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_87getMat3(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_86getMat3[] = "Convert to mat3 by discarding 4th row and column.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_87getMat3(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getMat3 (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4mat4_86getMat3(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_86getMat3(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("getMat3", 0);

  /* "cgtypes.pyx":4344
 *         """
 *         cdef mat3 res
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4345
 *         cdef mat3 res
 *         res = mat3()
 *         res.m11 = self.m11             # <<<<<<<<<<<<<<
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 */
  __pyx_t_2 = __pyx_v_self->m11;
  __pyx_v_res->m11 = __pyx_t_2;

  /* "cgtypes.pyx":4346
 *         res = mat3()
 *         res.m11 = self.m11
 *         res.m12 = self.m12             # <<<<<<<<<<<<<<
 *         res.m13 = self.m13
 *         res.m21 = self.m21
 */
  __pyx_t_2 = __pyx_v_self->m12;
  __pyx_v_res->m12 = __pyx_t_2;

  /* "cgtypes.pyx":4347
 *         res.m11 = self.m11
 *         res.m12 = self.m12
 *         res.m13 = self.m13             # <<<<<<<<<<<<<<
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 */
  __pyx_t_2 = __pyx_v_self->m13;
  __pyx_v_res->m13 = __pyx_t_2;

  /* "cgtypes.pyx":4348
 *         res.m12 = self.m12
 *         res.m13 = self.m13
 *         res.m21 = self.m21             # <<<<<<<<<<<<<<
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 */
  __pyx_t_2 = __pyx_v_self->m21;
  __pyx_v_res->m21 = __pyx_t_2;

  /* "cgtypes.pyx":4349
 *         res.m13 = self.m13
 *         res.m21 = self.m21
 *         res.m22 = self.m22             # <<<<<<<<<<<<<<
 *         res.m23 = self.m23
 *         res.m31 = self.m31
 */
  __pyx_t_2 = __pyx_v_self->m22;
  __pyx_v_res->m22 = __pyx_t_2;

  /* "cgtypes.pyx":4350
 *         res.m21 = self.m21
 *         res.m22 = self.m22
 *         res.m23 = self.m23             # <<<<<<<<<<<<<<
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 */
  __pyx_t_2 = __pyx_v_self->m23;
  __pyx_v_res->m23 = __pyx_t_2;

  /* "cgtypes.pyx":4351
 *         res.m22 = self.m22
 *         res.m23 = self.m23
 *         res.m31 = self.m31             # <<<<<<<<<<<<<<
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 */
  __pyx_t_2 = __pyx_v_self->m31;
  __pyx_v_res->m31 = __pyx_t_2;

  /* "cgtypes.pyx":4352
 *         res.m23 = self.m23
 *         res.m31 = self.m31
 *         res.m32 = self.m32             # <<<<<<<<<<<<<<
 *         res.m33 = self.m33
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->m32;
  __pyx_v_res->m32 = __pyx_t_2;

  /* "cgtypes.pyx":4353
 *         res.m31 = self.m31
 *         res.m32 = self.m32
 *         res.m33 = self.m33             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->m33;
  __pyx_v_res->m33 = __pyx_t_2;

  /* "cgtypes.pyx":4354
 *         res.m32 = self.m32
 *         res.m33 = self.m33
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def setMat3(self, mat3 m):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4340
 *         return (vec3(self.m14, self.m24, self.m34), m, scale)
 * 
 *     def getMat3(self):             # <<<<<<<<<<<<<<
 *         """Convert to mat3 by discarding 4th row and column.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.mat4.getMat3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4356
 *         return res
 * 
 *     def setMat3(self, mat3 m):             # <<<<<<<<<<<<<<
 *         """Set the mat3 part of self.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4mat4_89setMat3(PyObject *__pyx_v_self, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_7cgtypes_4mat4_88setMat3[] = "Set the mat3 part of self.\n        ";
static PyObject *__pyx_pw_7cgtypes_4mat4_89setMat3(PyObject *__pyx_v_self, PyObject *__pyx_v_m) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setMat3 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_7cgtypes_mat3, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4mat4_88setMat3(((struct __pyx_obj_7cgtypes_mat4 *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_v_m));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4mat4_88setMat3(struct __pyx_obj_7cgtypes_mat4 *__pyx_v_self, struct __pyx_obj_7cgtypes_mat3 *__pyx_v_m) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("setMat3", 0);

  /* "cgtypes.pyx":4359
 *         """Set the mat3 part of self.
 *         """
 *         self.m11 = m.m11             # <<<<<<<<<<<<<<
 *         self.m12 = m.m12
 *         self.m13 = m.m13
 */
  __pyx_t_1 = __pyx_v_m->m11;
  __pyx_v_self->m11 = __pyx_t_1;

  /* "cgtypes.pyx":4360
 *         """
 *         self.m11 = m.m11
 *         self.m12 = m.m12             # <<<<<<<<<<<<<<
 *         self.m13 = m.m13
 *         self.m21 = m.m21
 */
  __pyx_t_1 = __pyx_v_m->m12;
  __pyx_v_self->m12 = __pyx_t_1;

  /* "cgtypes.pyx":4361
 *         self.m11 = m.m11
 *         self.m12 = m.m12
 *         self.m13 = m.m13             # <<<<<<<<<<<<<<
 *         self.m21 = m.m21
 *         self.m22 = m.m22
 */
  __pyx_t_1 = __pyx_v_m->m13;
  __pyx_v_self->m13 = __pyx_t_1;

  /* "cgtypes.pyx":4362
 *         self.m12 = m.m12
 *         self.m13 = m.m13
 *         self.m21 = m.m21             # <<<<<<<<<<<<<<
 *         self.m22 = m.m22
 *         self.m23 = m.m23
 */
  __pyx_t_1 = __pyx_v_m->m21;
  __pyx_v_self->m21 = __pyx_t_1;

  /* "cgtypes.pyx":4363
 *         self.m13 = m.m13
 *         self.m21 = m.m21
 *         self.m22 = m.m22             # <<<<<<<<<<<<<<
 *         self.m23 = m.m23
 *         self.m31 = m.m31
 */
  __pyx_t_1 = __pyx_v_m->m22;
  __pyx_v_self->m22 = __pyx_t_1;

  /* "cgtypes.pyx":4364
 *         self.m21 = m.m21
 *         self.m22 = m.m22
 *         self.m23 = m.m23             # <<<<<<<<<<<<<<
 *         self.m31 = m.m31
 *         self.m32 = m.m32
 */
  __pyx_t_1 = __pyx_v_m->m23;
  __pyx_v_self->m23 = __pyx_t_1;

  /* "cgtypes.pyx":4365
 *         self.m22 = m.m22
 *         self.m23 = m.m23
 *         self.m31 = m.m31             # <<<<<<<<<<<<<<
 *         self.m32 = m.m32
 *         self.m33 = m.m33
 */
  __pyx_t_1 = __pyx_v_m->m31;
  __pyx_v_self->m31 = __pyx_t_1;

  /* "cgtypes.pyx":4366
 *         self.m23 = m.m23
 *         self.m31 = m.m31
 *         self.m32 = m.m32             # <<<<<<<<<<<<<<
 *         self.m33 = m.m33
 * 
 */
  __pyx_t_1 = __pyx_v_m->m32;
  __pyx_v_self->m32 = __pyx_t_1;

  /* "cgtypes.pyx":4367
 *         self.m31 = m.m31
 *         self.m32 = m.m32
 *         self.m33 = m.m33             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
  __pyx_t_1 = __pyx_v_m->m33;
  __pyx_v_self->m33 = __pyx_t_1;

  /* "cgtypes.pyx":4356
 *         return res
 * 
 *     def setMat3(self, mat3 m):             # <<<<<<<<<<<<<<
 *         """Set the mat3 part of self.
 *         """
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4382
 *     cdef double w,x,y,z
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4quat_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7cgtypes_4quat_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7cgtypes_4quat___cinit__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4quat___cinit__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_args) {
  int __pyx_v_arglen;
  int __pyx_v_seqlen;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q = 0;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_v_s = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_seq = NULL;
  PyObject *__pyx_v_angle = NULL;
  PyObject *__pyx_v_axis = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cgtypes.pyx":4396
 *         cdef int arglen, seqlen
 *         cdef quat q
 *         arglen = len(args)             # <<<<<<<<<<<<<<
 * 
 *         # 0 arguments
 */
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_arglen = __pyx_t_1;

  /* "cgtypes.pyx":4468
 * 
 *         # 4 arguments
 *         elif arglen==4:             # <<<<<<<<<<<<<<
 *             self.w = args[0]
 *             self.x = args[1]
 */
  switch (__pyx_v_arglen) {

    /* "cgtypes.pyx":4399
 * 
 *         # 0 arguments
 *         if arglen==0:             # <<<<<<<<<<<<<<
 *             self.w = 0.0
 *             self.x = 0.0
 */
    case 0:

    /* "cgtypes.pyx":4400
 *         # 0 arguments
 *         if arglen==0:
 *             self.w = 0.0             # <<<<<<<<<<<<<<
 *             self.x = 0.0
 *             self.y = 0.0
 */
    __pyx_v_self->w = 0.0;

    /* "cgtypes.pyx":4401
 *         if arglen==0:
 *             self.w = 0.0
 *             self.x = 0.0             # <<<<<<<<<<<<<<
 *             self.y = 0.0
 *             self.z = 0.0
 */
    __pyx_v_self->x = 0.0;

    /* "cgtypes.pyx":4402
 *             self.w = 0.0
 *             self.x = 0.0
 *             self.y = 0.0             # <<<<<<<<<<<<<<
 *             self.z = 0.0
 * 
 */
    __pyx_v_self->y = 0.0;

    /* "cgtypes.pyx":4403
 *             self.x = 0.0
 *             self.y = 0.0
 *             self.z = 0.0             # <<<<<<<<<<<<<<
 * 
 *         # 1 argument
 */
    __pyx_v_self->z = 0.0;
    break;

    /* "cgtypes.pyx":4406
 * 
 *         # 1 argument
 *         elif arglen==1:             # <<<<<<<<<<<<<<
 *             T = type(args[0])
 *             # scalar
 */
    case 1:

    /* "cgtypes.pyx":4407
 *         # 1 argument
 *         elif arglen==1:
 *             T = type(args[0])             # <<<<<<<<<<<<<<
 *             # scalar
 *             if T==float or T==int or T==long:
 */
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4407; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2)));
    __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_t_2)));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cgtypes.pyx":4409
 *             T = type(args[0])
 *             # scalar
 *             if T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *                 self.w = args[0]
 *                 self.x = 0.0
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":4410
 *             # scalar
 *             if T==float or T==int or T==long:
 *                 self.w = args[0]             # <<<<<<<<<<<<<<
 *                 self.x = 0.0
 *                 self.y = 0.0
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4410; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->w = __pyx_t_5;

      /* "cgtypes.pyx":4411
 *             if T==float or T==int or T==long:
 *                 self.w = args[0]
 *                 self.x = 0.0             # <<<<<<<<<<<<<<
 *                 self.y = 0.0
 *                 self.z = 0.0
 */
      __pyx_v_self->x = 0.0;

      /* "cgtypes.pyx":4412
 *                 self.w = args[0]
 *                 self.x = 0.0
 *                 self.y = 0.0             # <<<<<<<<<<<<<<
 *                 self.z = 0.0
 *             # quat
 */
      __pyx_v_self->y = 0.0;

      /* "cgtypes.pyx":4413
 *                 self.x = 0.0
 *                 self.y = 0.0
 *                 self.z = 0.0             # <<<<<<<<<<<<<<
 *             # quat
 *             elif T==quat:
 */
      __pyx_v_self->z = 0.0;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":4415
 *                 self.z = 0.0
 *             # quat
 *             elif T==quat:             # <<<<<<<<<<<<<<
 *                 q = args[0]
 *                 self.w = q.w
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":4416
 *             # quat
 *             elif T==quat:
 *                 q = args[0]             # <<<<<<<<<<<<<<
 *                 self.w = q.w
 *                 self.x = q.x
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4416; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_q = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":4417
 *             elif T==quat:
 *                 q = args[0]
 *                 self.w = q.w             # <<<<<<<<<<<<<<
 *                 self.x = q.x
 *                 self.y = q.y
 */
      __pyx_t_5 = __pyx_v_q->w;
      __pyx_v_self->w = __pyx_t_5;

      /* "cgtypes.pyx":4418
 *                 q = args[0]
 *                 self.w = q.w
 *                 self.x = q.x             # <<<<<<<<<<<<<<
 *                 self.y = q.y
 *                 self.z = q.z
 */
      __pyx_t_5 = __pyx_v_q->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":4419
 *                 self.w = q.w
 *                 self.x = q.x
 *                 self.y = q.y             # <<<<<<<<<<<<<<
 *                 self.z = q.z
 *             # String
 */
      __pyx_t_5 = __pyx_v_q->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":4420
 *                 self.x = q.x
 *                 self.y = q.y
 *                 self.z = q.z             # <<<<<<<<<<<<<<
 *             # String
 *             elif T==str or T==unicode:
 */
      __pyx_t_5 = __pyx_v_q->z;
      __pyx_v_self->z = __pyx_t_5;
      goto __pyx_L3;
    }

    /* "cgtypes.pyx":4422
 *                 self.z = q.z
 *             # String
 *             elif T==str or T==unicode:             # <<<<<<<<<<<<<<
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 */
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyString_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyUnicode_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_4;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":4423
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
      __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_strip); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":4424
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:             # <<<<<<<<<<<<<<
 *                     s=[]
 *                 for i in range(len(s)):
 */
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_s__7);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s__7);
      __Pyx_GIVEREF(__pyx_kp_s__7);
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_s, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {

        /* "cgtypes.pyx":4425
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")
 *                 if s==[""]:
 *                     s=[]             # <<<<<<<<<<<<<<
 *                 for i in range(len(s)):
 *                     try:
 */
        __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "cgtypes.pyx":4426
 *                 if s==[""]:
 *                     s=[]
 *                 for i in range(len(s)):             # <<<<<<<<<<<<<<
 *                     try:
 *                         s[i] = float(s[i])
 */
      __pyx_t_1 = PyObject_Length(__pyx_v_s); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "cgtypes.pyx":4427
 *                     s=[]
 *                 for i in range(len(s)):
 *                     try:             # <<<<<<<<<<<<<<
 *                         s[i] = float(s[i])
 *                     except:
 */
        {
          __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
          __Pyx_XGOTREF(__pyx_t_9);
          __Pyx_XGOTREF(__pyx_t_10);
          __Pyx_XGOTREF(__pyx_t_11);
          /*try:*/ {

            /* "cgtypes.pyx":4428
 *                 for i in range(len(s)):
 *                     try:
 *                         s[i] = float(s[i])             # <<<<<<<<<<<<<<
 *                     except:
 *                         raise ValueError,"quat() arg is a malformed string"
 */
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_s, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4428; __pyx_clineno = __LINE__; goto __pyx_L12_error;};
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_t_7); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4428; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4428; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_GOTREF(__pyx_t_7);
            if (unlikely(__Pyx_SetItemInt(__pyx_v_s, __pyx_v_i, __pyx_t_7, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4428; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L19_try_end;
          __pyx_L12_error:;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "cgtypes.pyx":4429
 *                     try:
 *                         s[i] = float(s[i])
 *                     except:             # <<<<<<<<<<<<<<
 *                         raise ValueError,"quat() arg is a malformed string"
 *                 q = quat(s)
 */
          /*except:*/ {
            __Pyx_AddTraceback("cgtypes.quat.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4429; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_6);

            /* "cgtypes.pyx":4430
 *                         s[i] = float(s[i])
 *                     except:
 *                         raise ValueError,"quat() arg is a malformed string"             # <<<<<<<<<<<<<<
 *                 q = quat(s)
 *                 self.w = q.w
 */
            __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_quat_arg_is_a_malformed_string, 0, 0);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4430; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          }
          __pyx_L14_except_error:;
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_10);
          __Pyx_XGIVEREF(__pyx_t_11);
          __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
          goto __pyx_L1_error;
          __pyx_L19_try_end:;
        }
      }

      /* "cgtypes.pyx":4431
 *                     except:
 *                         raise ValueError,"quat() arg is a malformed string"
 *                 q = quat(s)             # <<<<<<<<<<<<<<
 *                 self.w = q.w
 *                 self.x = q.x
 */
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_q = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":4432
 *                         raise ValueError,"quat() arg is a malformed string"
 *                 q = quat(s)
 *                 self.w = q.w             # <<<<<<<<<<<<<<
 *                 self.x = q.x
 *                 self.y = q.y
 */
      __pyx_t_5 = __pyx_v_q->w;
      __pyx_v_self->w = __pyx_t_5;

      /* "cgtypes.pyx":4433
 *                 q = quat(s)
 *                 self.w = q.w
 *                 self.x = q.x             # <<<<<<<<<<<<<<
 *                 self.y = q.y
 *                 self.z = q.z
 */
      __pyx_t_5 = __pyx_v_q->x;
      __pyx_v_self->x = __pyx_t_5;

      /* "cgtypes.pyx":4434
 *                 self.w = q.w
 *                 self.x = q.x
 *                 self.y = q.y             # <<<<<<<<<<<<<<
 *                 self.z = q.z
 *             # Sequence of floats
 */
      __pyx_t_5 = __pyx_v_q->y;
      __pyx_v_self->y = __pyx_t_5;

      /* "cgtypes.pyx":4435
 *                 self.x = q.x
 *                 self.y = q.y
 *                 self.z = q.z             # <<<<<<<<<<<<<<
 *             # Sequence of floats
 *             else:
 */
      __pyx_t_5 = __pyx_v_q->z;
      __pyx_v_self->z = __pyx_t_5;
      goto __pyx_L3;
    }
    /*else*/ {

      /* "cgtypes.pyx":4438
 *             # Sequence of floats
 *             else:
 *                 seq = args[0]             # <<<<<<<<<<<<<<
 *                 try:
 *                     seqlen = len(seq)
 */
      __pyx_t_2 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4438; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_seq = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cgtypes.pyx":4439
 *             else:
 *                 seq = args[0]
 *                 try:             # <<<<<<<<<<<<<<
 *                     seqlen = len(seq)
 *                 except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_9);
        /*try:*/ {

          /* "cgtypes.pyx":4440
 *                 seq = args[0]
 *                 try:
 *                     seqlen = len(seq)             # <<<<<<<<<<<<<<
 *                 except:
 *                     raise TypeError,"quat() arg can't be converted to quat"
 */
          __pyx_t_1 = PyObject_Length(__pyx_v_seq); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4440; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
          __pyx_v_seqlen = __pyx_t_1;
        }
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "cgtypes.pyx":4441
 *                 try:
 *                     seqlen = len(seq)
 *                 except:             # <<<<<<<<<<<<<<
 *                     raise TypeError,"quat() arg can't be converted to quat"
 * 
 */
        /*except:*/ {
          __Pyx_AddTraceback("cgtypes.quat.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4441; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "cgtypes.pyx":4442
 *                     seqlen = len(seq)
 *                 except:
 *                     raise TypeError,"quat() arg can't be converted to quat"             # <<<<<<<<<<<<<<
 * 
 *                 if seqlen==0:
 */
          __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_quat_arg_can_t_be_converted_to_q, 0, 0);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4442; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
        }
        __pyx_L24_except_error:;
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        goto __pyx_L1_error;
        __pyx_L29_try_end:;
      }

      /* "cgtypes.pyx":4444
 *                     raise TypeError,"quat() arg can't be converted to quat"
 * 
 *                 if seqlen==0:             # <<<<<<<<<<<<<<
 *                     self.w = 0.0
 *                     self.x = 0.0
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 0) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":4445
 * 
 *                 if seqlen==0:
 *                     self.w = 0.0             # <<<<<<<<<<<<<<
 *                     self.x = 0.0
 *                     self.y = 0.0
 */
        __pyx_v_self->w = 0.0;

        /* "cgtypes.pyx":4446
 *                 if seqlen==0:
 *                     self.w = 0.0
 *                     self.x = 0.0             # <<<<<<<<<<<<<<
 *                     self.y = 0.0
 *                     self.z = 0.0
 */
        __pyx_v_self->x = 0.0;

        /* "cgtypes.pyx":4447
 *                     self.w = 0.0
 *                     self.x = 0.0
 *                     self.y = 0.0             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                 elif seqlen==1:
 */
        __pyx_v_self->y = 0.0;

        /* "cgtypes.pyx":4448
 *                     self.x = 0.0
 *                     self.y = 0.0
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                 elif seqlen==1:
 *                     self.w = seq[0]
 */
        __pyx_v_self->z = 0.0;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":4449
 *                     self.y = 0.0
 *                     self.z = 0.0
 *                 elif seqlen==1:             # <<<<<<<<<<<<<<
 *                     self.w = seq[0]
 *                     self.x = 0.0
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 1) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":4450
 *                     self.z = 0.0
 *                 elif seqlen==1:
 *                     self.w = seq[0]             # <<<<<<<<<<<<<<
 *                     self.x = 0.0
 *                     self.y = 0.0
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4450; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->w = __pyx_t_5;

        /* "cgtypes.pyx":4451
 *                 elif seqlen==1:
 *                     self.w = seq[0]
 *                     self.x = 0.0             # <<<<<<<<<<<<<<
 *                     self.y = 0.0
 *                     self.z = 0.0
 */
        __pyx_v_self->x = 0.0;

        /* "cgtypes.pyx":4452
 *                     self.w = seq[0]
 *                     self.x = 0.0
 *                     self.y = 0.0             # <<<<<<<<<<<<<<
 *                     self.z = 0.0
 *                 elif seqlen==4:
 */
        __pyx_v_self->y = 0.0;

        /* "cgtypes.pyx":4453
 *                     self.x = 0.0
 *                     self.y = 0.0
 *                     self.z = 0.0             # <<<<<<<<<<<<<<
 *                 elif seqlen==4:
 *                     self.w = seq[0]
 */
        __pyx_v_self->z = 0.0;
        goto __pyx_L32;
      }

      /* "cgtypes.pyx":4454
 *                     self.y = 0.0
 *                     self.z = 0.0
 *                 elif seqlen==4:             # <<<<<<<<<<<<<<
 *                     self.w = seq[0]
 *                     self.x = seq[1]
 */
      __pyx_t_3 = ((__pyx_v_seqlen == 4) != 0);
      if (__pyx_t_3) {

        /* "cgtypes.pyx":4455
 *                     self.z = 0.0
 *                 elif seqlen==4:
 *                     self.w = seq[0]             # <<<<<<<<<<<<<<
 *                     self.x = seq[1]
 *                     self.y = seq[2]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4455; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->w = __pyx_t_5;

        /* "cgtypes.pyx":4456
 *                 elif seqlen==4:
 *                     self.w = seq[0]
 *                     self.x = seq[1]             # <<<<<<<<<<<<<<
 *                     self.y = seq[2]
 *                     self.z = seq[3]
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4456; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->x = __pyx_t_5;

        /* "cgtypes.pyx":4457
 *                     self.w = seq[0]
 *                     self.x = seq[1]
 *                     self.y = seq[2]             # <<<<<<<<<<<<<<
 *                     self.z = seq[3]
 *                 else:
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4457; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->y = __pyx_t_5;

        /* "cgtypes.pyx":4458
 *                     self.x = seq[1]
 *                     self.y = seq[2]
 *                     self.z = seq[3]             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise TypeError, "quat() arg can't be converted to quat"
 */
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_seq, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4458; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_self->z = __pyx_t_5;
        goto __pyx_L32;
      }
      /*else*/ {

        /* "cgtypes.pyx":4460
 *                     self.z = seq[3]
 *                 else:
 *                     raise TypeError, "quat() arg can't be converted to quat"             # <<<<<<<<<<<<<<
 * 
 *         # 2 arguments (angle & axis)
 */
        __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_quat_arg_can_t_be_converted_to_q, 0, 0);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L32:;
    }
    __pyx_L3:;
    break;

    /* "cgtypes.pyx":4463
 * 
 *         # 2 arguments (angle & axis)
 *         elif arglen==2:             # <<<<<<<<<<<<<<
 *             angle, axis = args
 *             self.fromAngleAxis(angle,axis)
 */
    case 2:

    /* "cgtypes.pyx":4464
 *         # 2 arguments (angle & axis)
 *         elif arglen==2:
 *             angle, axis = args             # <<<<<<<<<<<<<<
 *             self.fromAngleAxis(angle,axis)
 * 
 */
    if (1) {
      PyObject* sequence = __pyx_v_args;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
    }
    __pyx_v_angle = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_axis = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "cgtypes.pyx":4465
 *         elif arglen==2:
 *             angle, axis = args
 *             self.fromAngleAxis(angle,axis)             # <<<<<<<<<<<<<<
 * 
 *         # 4 arguments
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_fromAngleAxis); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_1 = 1;
      }
    }
    __pyx_t_12 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    if (__pyx_t_2) {
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_angle);
    PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_1, __pyx_v_angle);
    __Pyx_GIVEREF(__pyx_v_angle);
    __Pyx_INCREF(__pyx_v_axis);
    PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_1, __pyx_v_axis);
    __Pyx_GIVEREF(__pyx_v_axis);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    break;

    /* "cgtypes.pyx":4468
 * 
 *         # 4 arguments
 *         elif arglen==4:             # <<<<<<<<<<<<<<
 *             self.w = args[0]
 *             self.x = args[1]
 */
    case 4:

    /* "cgtypes.pyx":4469
 *         # 4 arguments
 *         elif arglen==4:
 *             self.w = args[0]             # <<<<<<<<<<<<<<
 *             self.x = args[1]
 *             self.y = args[2]
 */
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4469; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_self->w = __pyx_t_5;

    /* "cgtypes.pyx":4470
 *         elif arglen==4:
 *             self.w = args[0]
 *             self.x = args[1]             # <<<<<<<<<<<<<<
 *             self.y = args[2]
 *             self.z = args[3]
 */
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4470; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_self->x = __pyx_t_5;

    /* "cgtypes.pyx":4471
 *             self.w = args[0]
 *             self.x = args[1]
 *             self.y = args[2]             # <<<<<<<<<<<<<<
 *             self.z = args[3]
 * 
 */
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4471; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_self->y = __pyx_t_5;

    /* "cgtypes.pyx":4472
 *             self.x = args[1]
 *             self.y = args[2]
 *             self.z = args[3]             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_args, 3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4472; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_self->z = __pyx_t_5;
    break;
    default:

    /* "cgtypes.pyx":4475
 * 
 *         else:
 *             raise TypeError, "quat() arg can't be converted to quat"             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_quat_arg_can_t_be_converted_to_q, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":4382
 *     cdef double w,x,y,z
 * 
 *     def __cinit__(self, *args):             # <<<<<<<<<<<<<<
 *         """Constructor.
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("cgtypes.quat.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_angle);
  __Pyx_XDECREF(__pyx_v_axis);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4477
 *             raise TypeError, "quat() arg can't be converted to quat"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_quatconstruct, (self.w, self.x, self.y, self.z))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4quat_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_2__reduce__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_2__reduce__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cgtypes.pyx":4478
 * 
 *     def __reduce__(self):
 *         return (_quatconstruct, (self.w, self.x, self.y, self.z))             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_quatconstruct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4477
 *             raise TypeError, "quat() arg can't be converted to quat"
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         return (_quatconstruct, (self.w, self.x, self.y, self.z))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cgtypes.quat.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4480
 *         return (_quatconstruct, (self.w, self.x, self.y, self.z))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'quat(%s, %s, %s, %s)'%(repr(self.w),repr(self.x),repr(self.y),repr(self.z))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4quat_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_4__repr__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_4__repr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cgtypes.pyx":4481
 * 
 *     def __repr__(self):
 *         return 'quat(%s, %s, %s, %s)'%(repr(self.w),repr(self.x),repr(self.y),repr(self.z))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Repr(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_quat_s_s_s_s, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4480
 *         return (_quatconstruct, (self.w, self.x, self.y, self.z))
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return 'quat(%s, %s, %s, %s)'%(repr(self.w),repr(self.x),repr(self.y),repr(self.z))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4483
 *         return 'quat(%s, %s, %s, %s)'%(repr(self.w),repr(self.x),repr(self.y),repr(self.z))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.w, self.x, self.y, self.z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4quat_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_6__str__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_6__str__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cgtypes.pyx":4484
 * 
 *     def __str__(self):
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.w, self.x, self.y, self.z)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_1_4f_1_4f_1_4f_1_4f, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4483
 *         return 'quat(%s, %s, %s, %s)'%(repr(self.w),repr(self.x),repr(self.y),repr(self.z))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "(%1.4f, %1.4f, %1.4f, %1.4f)"%(self.w, self.x, self.y, self.z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4487
 * 
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef quat va, vb
 *         cdef int cop
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_9__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4quat_9__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4487; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.quat.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4quat_8__richcmp__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b), ((PyObject *)__pyx_v_op));

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_op);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_8__richcmp__(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_op) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_vb = 0;
  int __pyx_v_cop;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cgtypes.pyx":4491
 *         cdef int cop
 * 
 *         cop = op             # <<<<<<<<<<<<<<
 * 
 *         ta = type(a)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_op); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_cop = __pyx_t_1;

  /* "cgtypes.pyx":4493
 *         cop = op
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 *         if (ta!=quat or tb!=quat):
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":4494
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 *         if (ta!=quat or tb!=quat):
 *             if cop==3:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":4495
 *         ta = type(a)
 *         tb = type(b)
 *         if (ta!=quat or tb!=quat):             # <<<<<<<<<<<<<<
 *             if cop==3:
 *                 return 1
 */
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4496
 *         tb = type(b)
 *         if (ta!=quat or tb!=quat):
 *             if cop==3:             # <<<<<<<<<<<<<<
 *                 return 1
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_cop == 3) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":4497
 *         if (ta!=quat or tb!=quat):
 *             if cop==3:
 *                 return 1             # <<<<<<<<<<<<<<
 *             else:
 *                 return 0
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;
    }
    /*else*/ {

      /* "cgtypes.pyx":4499
 *                 return 1
 *             else:
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *         va = a
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;
    }
  }

  /* "cgtypes.pyx":4501
 *                 return 0
 * 
 *         va = a             # <<<<<<<<<<<<<<
 *         vb = b
 * 
 */
  if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_a;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_va = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4502
 * 
 *         va = a
 *         vb = b             # <<<<<<<<<<<<<<
 * 
 *         # <
 */
  if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __pyx_v_b;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_vb = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4520
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
  switch (__pyx_v_cop) {

    /* "cgtypes.pyx":4505
 * 
 *         # <
 *         if cop==0:             # <<<<<<<<<<<<<<
 *             return 0
 *         # <=
 */
    case 0:

    /* "cgtypes.pyx":4506
 *         # <
 *         if cop==0:
 *             return 0             # <<<<<<<<<<<<<<
 *         # <=
 *         elif cop==1:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":4508
 *             return 0
 *         # <=
 *         elif cop==1:             # <<<<<<<<<<<<<<
 *             return 0
 *         # ==
 */
    case 1:

    /* "cgtypes.pyx":4509
 *         # <=
 *         elif cop==1:
 *             return 0             # <<<<<<<<<<<<<<
 *         # ==
 *         elif cop==2:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":4511
 *             return 0
 *         # ==
 *         elif cop==2:             # <<<<<<<<<<<<<<
 *             return (fabs(va.w-vb.w)<=eps and fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)
 *         # !=
 */
    case 2:

    /* "cgtypes.pyx":4512
 *         # ==
 *         elif cop==2:
 *             return (fabs(va.w-vb.w)<=eps and fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)             # <<<<<<<<<<<<<<
 *         # !=
 *         elif cop==3:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->w - __pyx_v_vb->w)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) <= __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) <= __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":4514
 *             return (fabs(va.w-vb.w)<=eps and fabs(va.x-vb.x)<=eps and fabs(va.y-vb.y)<=eps and fabs(va.z-vb.z)<=eps)
 *         # !=
 *         elif cop==3:             # <<<<<<<<<<<<<<
 *             return (fabs(va.w-vb.w)>eps or fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)
 *         # >
 */
    case 3:

    /* "cgtypes.pyx":4515
 *         # !=
 *         elif cop==3:
 *             return (fabs(va.w-vb.w)>eps or fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)             # <<<<<<<<<<<<<<
 *         # >
 *         elif cop==4:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = (fabs((__pyx_v_va->w - __pyx_v_vb->w)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->x - __pyx_v_vb->x)) > __pyx_v_7cgtypes_eps);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->y - __pyx_v_vb->y)) > __pyx_v_7cgtypes_eps);
    if (__pyx_t_2) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (fabs((__pyx_v_va->z - __pyx_v_vb->z)) > __pyx_v_7cgtypes_eps);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L11_bool_binop_done:;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":4517
 *             return (fabs(va.w-vb.w)>eps or fabs(va.x-vb.x)>eps or fabs(va.y-vb.y)>eps and fabs(va.z-vb.z)>eps)
 *         # >
 *         elif cop==4:             # <<<<<<<<<<<<<<
 *             return 0
 *         # >=
 */
    case 4:

    /* "cgtypes.pyx":4518
 *         # >
 *         elif cop==4:
 *             return 0             # <<<<<<<<<<<<<<
 *         # >=
 *         elif cop==5:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;

    /* "cgtypes.pyx":4520
 *             return 0
 *         # >=
 *         elif cop==5:             # <<<<<<<<<<<<<<
 *             return 0
 *         # sonst (Fehler)
 */
    case 5:

    /* "cgtypes.pyx":4521
 *         # >=
 *         elif cop==5:
 *             return 0             # <<<<<<<<<<<<<<
 *         # sonst (Fehler)
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    break;
    default:

    /* "cgtypes.pyx":4524
 *         # sonst (Fehler)
 *         else:
 *             raise ValueError,"internal error: illegal rich comparison number"             # <<<<<<<<<<<<<<
 * 
 *     def __add__(quat a, quat b):
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_internal_error_illegal_rich_comp, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    break;
  }

  /* "cgtypes.pyx":4487
 * 
 * 
 *     def __richcmp__(a,b,op):             # <<<<<<<<<<<<<<
 *         cdef quat va, vb
 *         cdef int cop
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4526
 *             raise ValueError,"internal error: illegal rich comparison number"
 * 
 *     def __add__(quat a, quat b):             # <<<<<<<<<<<<<<
 *         """Addition.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_11__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4quat_10__add__[] = "Addition.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q+q\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_10__add__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_11__add__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_quat, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_quat, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_10__add__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_quat *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_10__add__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cgtypes.pyx":4534
 *         """
 *         cdef quat res
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w = a.w+b.w
 *         res.x = a.x+b.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4535
 *         cdef quat res
 *         res = quat()
 *         res.w = a.w+b.w             # <<<<<<<<<<<<<<
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 */
  __pyx_v_res->w = (__pyx_v_a->w + __pyx_v_b->w);

  /* "cgtypes.pyx":4536
 *         res = quat()
 *         res.w = a.w+b.w
 *         res.x = a.x+b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x + __pyx_v_b->x);

  /* "cgtypes.pyx":4537
 *         res.w = a.w+b.w
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z+b.z
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_a->y + __pyx_v_b->y);

  /* "cgtypes.pyx":4538
 *         res.x = a.x+b.x
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_a->z + __pyx_v_b->z);

  /* "cgtypes.pyx":4539
 *         res.y = a.y+b.y
 *         res.z = a.z+b.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(quat a, quat b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4526
 *             raise ValueError,"internal error: illegal rich comparison number"
 * 
 *     def __add__(quat a, quat b):             # <<<<<<<<<<<<<<
 *         """Addition.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4541
 *         return res
 * 
 *     def __sub__(quat a, quat b):             # <<<<<<<<<<<<<<
 *         """Subtraction.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_13__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4quat_12__sub__[] = "Subtraction.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q-q\n        (0.0000, 0.0000, 0.0000, 0.0000)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_12__sub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_13__sub__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_quat, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_quat, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_12__sub__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_a), ((struct __pyx_obj_7cgtypes_quat *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_12__sub__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cgtypes.pyx":4549
 *         """
 *         cdef quat res
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w = a.w-b.w
 *         res.x = a.x-b.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4550
 *         cdef quat res
 *         res = quat()
 *         res.w = a.w-b.w             # <<<<<<<<<<<<<<
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 */
  __pyx_v_res->w = (__pyx_v_a->w - __pyx_v_b->w);

  /* "cgtypes.pyx":4551
 *         res = quat()
 *         res.w = a.w-b.w
 *         res.x = a.x-b.x             # <<<<<<<<<<<<<<
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 */
  __pyx_v_res->x = (__pyx_v_a->x - __pyx_v_b->x);

  /* "cgtypes.pyx":4552
 *         res.w = a.w-b.w
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y             # <<<<<<<<<<<<<<
 *         res.z = a.z-b.z
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_a->y - __pyx_v_b->y);

  /* "cgtypes.pyx":4553
 *         res.x = a.x-b.x
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_a->z - __pyx_v_b->z);

  /* "cgtypes.pyx":4554
 *         res.y = a.y-b.y
 *         res.z = a.z-b.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4541
 *         return res
 * 
 *     def __sub__(quat a, quat b):             # <<<<<<<<<<<<<<
 *         """Subtraction.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4556
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_15__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4quat_14__mul__[] = "Multiplication.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q*2.0\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        >>> print 2.0*q\n        (1.9378, 0.4320, 0.2160, 0.1080)\n        >>> print q*q\n        (0.8775, 0.4186, 0.2093, 0.1046)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_14__mul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_15__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_14__mul__(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_14__mul__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_va = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_vb = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_ta = NULL;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cgtypes.pyx":4570
 *         cdef double r
 * 
 *         ta = type(a)             # <<<<<<<<<<<<<<
 *         tb = type(b)
 * 
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_a)));
  __pyx_v_ta = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_a)));

  /* "cgtypes.pyx":4571
 * 
 *         ta = type(a)
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if ta==quat:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":4573
 *         tb = type(b)
 * 
 *         if ta==quat:             # <<<<<<<<<<<<<<
 *             va = a
 *             if tb==quat:
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4574
 * 
 *         if ta==quat:
 *             va = a             # <<<<<<<<<<<<<<
 *             if tb==quat:
 *                 # quat*quat
 */
    if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_va = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":4575
 *         if ta==quat:
 *             va = a
 *             if tb==quat:             # <<<<<<<<<<<<<<
 *                 # quat*quat
 *                 vb = b
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":4577
 *             if tb==quat:
 *                 # quat*quat
 *                 vb = b             # <<<<<<<<<<<<<<
 *                 res = quat()
 *                 res.w = va.w*vb.w - va.x*vb.x - va.y*vb.y - va.z*vb.z
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":4578
 *                 # quat*quat
 *                 vb = b
 *                 res = quat()             # <<<<<<<<<<<<<<
 *                 res.w = va.w*vb.w - va.x*vb.x - va.y*vb.y - va.z*vb.z
 *                 res.x = va.w*vb.x + va.x*vb.w + va.y*vb.z - va.z*vb.y
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":4579
 *                 vb = b
 *                 res = quat()
 *                 res.w = va.w*vb.w - va.x*vb.x - va.y*vb.y - va.z*vb.z             # <<<<<<<<<<<<<<
 *                 res.x = va.w*vb.x + va.x*vb.w + va.y*vb.z - va.z*vb.y
 *                 res.y = va.w*vb.y + va.y*vb.w - va.x*vb.z + va.z*vb.x
 */
      __pyx_v_res->w = ((((__pyx_v_va->w * __pyx_v_vb->w) - (__pyx_v_va->x * __pyx_v_vb->x)) - (__pyx_v_va->y * __pyx_v_vb->y)) - (__pyx_v_va->z * __pyx_v_vb->z));

      /* "cgtypes.pyx":4580
 *                 res = quat()
 *                 res.w = va.w*vb.w - va.x*vb.x - va.y*vb.y - va.z*vb.z
 *                 res.x = va.w*vb.x + va.x*vb.w + va.y*vb.z - va.z*vb.y             # <<<<<<<<<<<<<<
 *                 res.y = va.w*vb.y + va.y*vb.w - va.x*vb.z + va.z*vb.x
 *                 res.z = va.w*vb.z + va.z*vb.w + va.x*vb.y - va.y*vb.x
 */
      __pyx_v_res->x = ((((__pyx_v_va->w * __pyx_v_vb->x) + (__pyx_v_va->x * __pyx_v_vb->w)) + (__pyx_v_va->y * __pyx_v_vb->z)) - (__pyx_v_va->z * __pyx_v_vb->y));

      /* "cgtypes.pyx":4581
 *                 res.w = va.w*vb.w - va.x*vb.x - va.y*vb.y - va.z*vb.z
 *                 res.x = va.w*vb.x + va.x*vb.w + va.y*vb.z - va.z*vb.y
 *                 res.y = va.w*vb.y + va.y*vb.w - va.x*vb.z + va.z*vb.x             # <<<<<<<<<<<<<<
 *                 res.z = va.w*vb.z + va.z*vb.w + va.x*vb.y - va.y*vb.x
 *                 return res
 */
      __pyx_v_res->y = ((((__pyx_v_va->w * __pyx_v_vb->y) + (__pyx_v_va->y * __pyx_v_vb->w)) - (__pyx_v_va->x * __pyx_v_vb->z)) + (__pyx_v_va->z * __pyx_v_vb->x));

      /* "cgtypes.pyx":4582
 *                 res.x = va.w*vb.x + va.x*vb.w + va.y*vb.z - va.z*vb.y
 *                 res.y = va.w*vb.y + va.y*vb.w - va.x*vb.z + va.z*vb.x
 *                 res.z = va.w*vb.z + va.z*vb.w + va.x*vb.y - va.y*vb.x             # <<<<<<<<<<<<<<
 *                 return res
 *             elif tb==float or tb==int or tb==long:
 */
      __pyx_v_res->z = ((((__pyx_v_va->w * __pyx_v_vb->z) + (__pyx_v_va->z * __pyx_v_vb->w)) + (__pyx_v_va->x * __pyx_v_vb->y)) - (__pyx_v_va->y * __pyx_v_vb->x));

      /* "cgtypes.pyx":4583
 *                 res.y = va.w*vb.y + va.y*vb.w - va.x*vb.z + va.z*vb.x
 *                 res.z = va.w*vb.z + va.z*vb.w + va.x*vb.y - va.y*vb.x
 *                 return res             # <<<<<<<<<<<<<<
 *             elif tb==float or tb==int or tb==long:
 *                 # quat*scalar
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }

    /* "cgtypes.pyx":4584
 *                 res.z = va.w*vb.z + va.z*vb.w + va.x*vb.y - va.y*vb.x
 *                 return res
 *             elif tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *                 # quat*scalar
 *                 res = quat()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":4586
 *             elif tb==float or tb==int or tb==long:
 *                 # quat*scalar
 *                 res = quat()             # <<<<<<<<<<<<<<
 *                 r   = b
 *                 res.w = va.w*r
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":4587
 *                 # quat*scalar
 *                 res = quat()
 *                 r   = b             # <<<<<<<<<<<<<<
 *                 res.w = va.w*r
 *                 res.x = va.x*r
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":4588
 *                 res = quat()
 *                 r   = b
 *                 res.w = va.w*r             # <<<<<<<<<<<<<<
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 */
      __pyx_v_res->w = (__pyx_v_va->w * __pyx_v_r);

      /* "cgtypes.pyx":4589
 *                 r   = b
 *                 res.w = va.w*r
 *                 res.x = va.x*r             # <<<<<<<<<<<<<<
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 */
      __pyx_v_res->x = (__pyx_v_va->x * __pyx_v_r);

      /* "cgtypes.pyx":4590
 *                 res.w = va.w*r
 *                 res.x = va.x*r
 *                 res.y = va.y*r             # <<<<<<<<<<<<<<
 *                 res.z = va.z*r
 *                 return res
 */
      __pyx_v_res->y = (__pyx_v_va->y * __pyx_v_r);

      /* "cgtypes.pyx":4591
 *                 res.x = va.x*r
 *                 res.y = va.y*r
 *                 res.z = va.z*r             # <<<<<<<<<<<<<<
 *                 return res
 *         elif ta==float or ta==int or ta==long:
 */
      __pyx_v_res->z = (__pyx_v_va->z * __pyx_v_r);

      /* "cgtypes.pyx":4592
 *                 res.y = va.y*r
 *                 res.z = va.z*r
 *                 return res             # <<<<<<<<<<<<<<
 *         elif ta==float or ta==int or ta==long:
 *             if tb==quat:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":4593
 *                 res.z = va.z*r
 *                 return res
 *         elif ta==float or ta==int or ta==long:             # <<<<<<<<<<<<<<
 *             if tb==quat:
 *                 # scalar*quat
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_ta), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4594
 *                 return res
 *         elif ta==float or ta==int or ta==long:
 *             if tb==quat:             # <<<<<<<<<<<<<<
 *                 # scalar*quat
 *                 res = quat()
 */
    __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_2) {

      /* "cgtypes.pyx":4596
 *             if tb==quat:
 *                 # scalar*quat
 *                 res = quat()             # <<<<<<<<<<<<<<
 *                 vb  = b
 *                 r   = a
 */
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":4597
 *                 # scalar*quat
 *                 res = quat()
 *                 vb  = b             # <<<<<<<<<<<<<<
 *                 r   = a
 *                 res.w = r*vb.w
 */
      if (!(likely(((__pyx_v_b) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_b, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_b;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_vb = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cgtypes.pyx":4598
 *                 res = quat()
 *                 vb  = b
 *                 r   = a             # <<<<<<<<<<<<<<
 *                 res.w = r*vb.w
 *                 res.x = r*vb.x
 */
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_a); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_r = __pyx_t_4;

      /* "cgtypes.pyx":4599
 *                 vb  = b
 *                 r   = a
 *                 res.w = r*vb.w             # <<<<<<<<<<<<<<
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 */
      __pyx_v_res->w = (__pyx_v_r * __pyx_v_vb->w);

      /* "cgtypes.pyx":4600
 *                 r   = a
 *                 res.w = r*vb.w
 *                 res.x = r*vb.x             # <<<<<<<<<<<<<<
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 */
      __pyx_v_res->x = (__pyx_v_r * __pyx_v_vb->x);

      /* "cgtypes.pyx":4601
 *                 res.w = r*vb.w
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y             # <<<<<<<<<<<<<<
 *                 res.z = r*vb.z
 *                 return res
 */
      __pyx_v_res->y = (__pyx_v_r * __pyx_v_vb->y);

      /* "cgtypes.pyx":4602
 *                 res.x = r*vb.x
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z             # <<<<<<<<<<<<<<
 *                 return res
 * 
 */
      __pyx_v_res->z = (__pyx_v_r * __pyx_v_vb->z);

      /* "cgtypes.pyx":4603
 *                 res.y = r*vb.y
 *                 res.z = r*vb.z
 *                 return res             # <<<<<<<<<<<<<<
 * 
 *         raise TypeError, "unsupported operand type for *"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_res));
      __pyx_r = ((PyObject *)__pyx_v_res);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":4605
 *                 return res
 * 
 *         raise TypeError, "unsupported operand type for *"             # <<<<<<<<<<<<<<
 * 
 *     def __div__(quat a, b):
 */
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for, 0, 0);
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":4556
 *         return res
 * 
 *     def __mul__(a, b):             # <<<<<<<<<<<<<<
 *         """Multiplication.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF((PyObject *)__pyx_v_va);
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_ta);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4607
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(quat a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 * 
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4quat_17__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4quat_16__div__[] = "Division.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q/2.0\n        (0.4844, 0.1080, 0.0540, 0.0270)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_16__div__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_17__div__(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_quat, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_16__div__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4quat_16__div__(struct __pyx_obj_7cgtypes_quat *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cgtypes.pyx":4617
 *         cdef double r
 * 
 *         tb = type(b)             # <<<<<<<<<<<<<<
 * 
 *         if tb==float or tb==int or tb==long:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_b)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_b)));

  /* "cgtypes.pyx":4619
 *         tb = type(b)
 * 
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             # quat/scalar
 *             res = quat()
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4621
 *         if tb==float or tb==int or tb==long:
 *             # quat/scalar
 *             res = quat()             # <<<<<<<<<<<<<<
 *             r = b
 *             if fabs(r)<=eps:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cgtypes.pyx":4622
 *             # quat/scalar
 *             res = quat()
 *             r = b             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_b); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":4623
 *             res = quat()
 *             r = b
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"quat division"
 *             res.w = a.w/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":4624
 *             r = b
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"             # <<<<<<<<<<<<<<
 *             res.w = a.w/r
 *             res.x = a.x/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_quat_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":4625
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"
 *             res.w = a.w/r             # <<<<<<<<<<<<<<
 *             res.x = a.x/r
 *             res.y = a.y/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->w = (__pyx_v_a->w / __pyx_v_r);

    /* "cgtypes.pyx":4626
 *                 raise ZeroDivisionError,"quat division"
 *             res.w = a.w/r
 *             res.x = a.x/r             # <<<<<<<<<<<<<<
 *             res.y = a.y/r
 *             res.z = a.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->x = (__pyx_v_a->x / __pyx_v_r);

    /* "cgtypes.pyx":4627
 *             res.w = a.w/r
 *             res.x = a.x/r
 *             res.y = a.y/r             # <<<<<<<<<<<<<<
 *             res.z = a.z/r
 *             return res
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->y = (__pyx_v_a->y / __pyx_v_r);

    /* "cgtypes.pyx":4628
 *             res.x = a.x/r
 *             res.y = a.y/r
 *             res.z = a.z/r             # <<<<<<<<<<<<<<
 *             return res
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_res->z = (__pyx_v_a->z / __pyx_v_r);

    /* "cgtypes.pyx":4629
 *             res.y = a.y/r
 *             res.z = a.z/r
 *             return res             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /"
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_res));
    __pyx_r = ((PyObject *)__pyx_v_res);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":4631
 *             return res
 *         else:
 *             raise TypeError, "unsupported operand type for /"             # <<<<<<<<<<<<<<
 * 
 *     def __pow__(quat self, other, modulo):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_2, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4607
 *         raise TypeError, "unsupported operand type for *"
 * 
 *     def __div__(quat a, b):             # <<<<<<<<<<<<<<
 *         """Division.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":4633
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __pow__(quat self, other, modulo):             # <<<<<<<<<<<<<<
 *         """Return self**q."""
 *         cdef quat q
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_19__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo); /*proto*/
static char __pyx_doc_7cgtypes_4quat_18__pow__[] = "Return self**q.";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_18__pow__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_19__pow__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pow__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_7cgtypes_quat, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_18__pow__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_modulo));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_18__pow__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_modulo) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pow__", 0);

  /* "cgtypes.pyx":4636
 *         """Return self**q."""
 *         cdef quat q
 *         if modulo!=None:             # <<<<<<<<<<<<<<
 *             raise TypeError, "unsupported operation"
 *         q = quat(other)
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_modulo, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4637
 *         cdef quat q
 *         if modulo!=None:
 *             raise TypeError, "unsupported operation"             # <<<<<<<<<<<<<<
 *         q = quat(other)
 *         return (q*self.log()).exp()
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operation, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4638
 *         if modulo!=None:
 *             raise TypeError, "unsupported operation"
 *         q = quat(other)             # <<<<<<<<<<<<<<
 *         return (q*self.log()).exp()
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_other);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_other);
  __Pyx_GIVEREF(__pyx_v_other);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_q = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cgtypes.pyx":4639
 *             raise TypeError, "unsupported operation"
 *         q = quat(other)
 *         return (q*self.log()).exp()             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_q), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4633
 *             raise TypeError, "unsupported operand type for /"
 * 
 *     def __pow__(quat self, other, modulo):             # <<<<<<<<<<<<<<
 *         """Return self**q."""
 *         cdef quat q
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4641
 *         return (q*self.log()).exp()
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_21__neg__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4quat_20__neg__[] = "Negation.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print -q\n        (-0.9689, -0.2160, -0.1080, -0.0540)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_20__neg__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_21__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_20__neg__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_20__neg__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cgtypes.pyx":4649
 *         """
 *         cdef quat res
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w = -self.w
 *         res.x = -self.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4650
 *         cdef quat res
 *         res = quat()
 *         res.w = -self.w             # <<<<<<<<<<<<<<
 *         res.x = -self.x
 *         res.y = -self.y
 */
  __pyx_v_res->w = (-__pyx_v_self->w);

  /* "cgtypes.pyx":4651
 *         res = quat()
 *         res.w = -self.w
 *         res.x = -self.x             # <<<<<<<<<<<<<<
 *         res.y = -self.y
 *         res.z = -self.z
 */
  __pyx_v_res->x = (-__pyx_v_self->x);

  /* "cgtypes.pyx":4652
 *         res.w = -self.w
 *         res.x = -self.x
 *         res.y = -self.y             # <<<<<<<<<<<<<<
 *         res.z = -self.z
 *         return res
 */
  __pyx_v_res->y = (-__pyx_v_self->y);

  /* "cgtypes.pyx":4653
 *         res.x = -self.x
 *         res.y = -self.y
 *         res.z = -self.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (-__pyx_v_self->z);

  /* "cgtypes.pyx":4654
 *         res.y = -self.y
 *         res.z = -self.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4641
 *         return (q*self.log()).exp()
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         """Negation.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4656
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_23__pos__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4quat_22__pos__[] = "\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print +q\n        (0.9689, 0.2160, 0.1080, 0.0540)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_22__pos__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_23__pos__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_22__pos__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_22__pos__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "cgtypes.pyx":4663
 *         """
 *         cdef quat res
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w = self.w
 *         res.x = self.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4664
 *         cdef quat res
 *         res = quat()
 *         res.w = self.w             # <<<<<<<<<<<<<<
 *         res.x = self.x
 *         res.y = self.y
 */
  __pyx_t_2 = __pyx_v_self->w;
  __pyx_v_res->w = __pyx_t_2;

  /* "cgtypes.pyx":4665
 *         res = quat()
 *         res.w = self.w
 *         res.x = self.x             # <<<<<<<<<<<<<<
 *         res.y = self.y
 *         res.z = self.z
 */
  __pyx_t_2 = __pyx_v_self->x;
  __pyx_v_res->x = __pyx_t_2;

  /* "cgtypes.pyx":4666
 *         res.w = self.w
 *         res.x = self.x
 *         res.y = self.y             # <<<<<<<<<<<<<<
 *         res.z = self.z
 *         return res
 */
  __pyx_t_2 = __pyx_v_self->y;
  __pyx_v_res->y = __pyx_t_2;

  /* "cgtypes.pyx":4667
 *         res.x = self.x
 *         res.y = self.y
 *         res.z = self.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_2 = __pyx_v_self->z;
  __pyx_v_res->z = __pyx_t_2;

  /* "cgtypes.pyx":4668
 *         res.y = self.y
 *         res.z = self.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def __iadd__(self, quat other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4656
 *         return res
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         """
 *         >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__pos__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4670
 *         return res
 * 
 *     def __iadd__(self, quat other):             # <<<<<<<<<<<<<<
 *         """Inline quaternion addition.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_25__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4quat_24__iadd__[] = "Inline quaternion addition.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_24__iadd__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_25__iadd__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_quat, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_24__iadd__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_quat *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_24__iadd__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iadd__", 0);

  /* "cgtypes.pyx":4673
 *         """Inline quaternion addition.
 *         """
 *         self.w=self.w+other.w             # <<<<<<<<<<<<<<
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y
 */
  __pyx_v_self->w = (__pyx_v_self->w + __pyx_v_other->w);

  /* "cgtypes.pyx":4674
 *         """
 *         self.w=self.w+other.w
 *         self.x=self.x+other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x + __pyx_v_other->x);

  /* "cgtypes.pyx":4675
 *         self.w=self.w+other.w
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z+other.z
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_self->y + __pyx_v_other->y);

  /* "cgtypes.pyx":4676
 *         self.x=self.x+other.x
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_self->z + __pyx_v_other->z);

  /* "cgtypes.pyx":4677
 *         self.y=self.y+other.y
 *         self.z=self.z+other.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __isub__(self, quat other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4670
 *         return res
 * 
 *     def __iadd__(self, quat other):             # <<<<<<<<<<<<<<
 *         """Inline quaternion addition.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4679
 *         return self
 * 
 *     def __isub__(self, quat other):             # <<<<<<<<<<<<<<
 *         """Inline quaternion subtraction.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_27__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4quat_26__isub__[] = "Inline quaternion subtraction.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_26__isub__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_27__isub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_7cgtypes_quat, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_26__isub__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_quat *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_26__isub__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__isub__", 0);

  /* "cgtypes.pyx":4682
 *         """Inline quaternion subtraction.
 *         """
 *         self.w=self.w-other.w             # <<<<<<<<<<<<<<
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y
 */
  __pyx_v_self->w = (__pyx_v_self->w - __pyx_v_other->w);

  /* "cgtypes.pyx":4683
 *         """
 *         self.w=self.w-other.w
 *         self.x=self.x-other.x             # <<<<<<<<<<<<<<
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 */
  __pyx_v_self->x = (__pyx_v_self->x - __pyx_v_other->x);

  /* "cgtypes.pyx":4684
 *         self.w=self.w-other.w
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y             # <<<<<<<<<<<<<<
 *         self.z=self.z-other.z
 *         return self
 */
  __pyx_v_self->y = (__pyx_v_self->y - __pyx_v_other->y);

  /* "cgtypes.pyx":4685
 *         self.x=self.x-other.x
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_v_self->z = (__pyx_v_self->z - __pyx_v_other->z);

  /* "cgtypes.pyx":4686
 *         self.y=self.y-other.y
 *         self.z=self.z-other.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __imul__(self, other):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4679
 *         return self
 * 
 *     def __isub__(self, quat other):             # <<<<<<<<<<<<<<
 *         """Inline quaternion subtraction.
 *         """
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4688
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication.
 *         """
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_29__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4quat_28__imul__[] = "Inline multiplication.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_28__imul__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_29__imul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__imul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_28__imul__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_28__imul__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_vb = 0;
  double __pyx_v_r;
  double __pyx_v_w;
  double __pyx_v_x;
  double __pyx_v_y;
  double __pyx_v_z;
  PyObject *__pyx_v_T = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__imul__", 0);

  /* "cgtypes.pyx":4695
 *         cdef double w,x,y,z
 * 
 *         T = type(other)             # <<<<<<<<<<<<<<
 * 
 *         if T==quat:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_T = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":4697
 *         T = type(other)
 * 
 *         if T==quat:             # <<<<<<<<<<<<<<
 *             # quat*=quat
 *             vb = other
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4699
 *         if T==quat:
 *             # quat*=quat
 *             vb = other             # <<<<<<<<<<<<<<
 *             w = self.w*vb.w - self.x*vb.x - self.y*vb.y - self.z*vb.z
 *             x = self.w*vb.x + self.x*vb.w + self.y*vb.z - self.z*vb.y
 */
    if (!(likely(((__pyx_v_other) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_other, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4699; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_other;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v_vb = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "cgtypes.pyx":4700
 *             # quat*=quat
 *             vb = other
 *             w = self.w*vb.w - self.x*vb.x - self.y*vb.y - self.z*vb.z             # <<<<<<<<<<<<<<
 *             x = self.w*vb.x + self.x*vb.w + self.y*vb.z - self.z*vb.y
 *             y = self.w*vb.y + self.y*vb.w - self.x*vb.z + self.z*vb.x
 */
    __pyx_v_w = ((((__pyx_v_self->w * __pyx_v_vb->w) - (__pyx_v_self->x * __pyx_v_vb->x)) - (__pyx_v_self->y * __pyx_v_vb->y)) - (__pyx_v_self->z * __pyx_v_vb->z));

    /* "cgtypes.pyx":4701
 *             vb = other
 *             w = self.w*vb.w - self.x*vb.x - self.y*vb.y - self.z*vb.z
 *             x = self.w*vb.x + self.x*vb.w + self.y*vb.z - self.z*vb.y             # <<<<<<<<<<<<<<
 *             y = self.w*vb.y + self.y*vb.w - self.x*vb.z + self.z*vb.x
 *             z = self.w*vb.z + self.z*vb.w + self.x*vb.y - self.y*vb.x
 */
    __pyx_v_x = ((((__pyx_v_self->w * __pyx_v_vb->x) + (__pyx_v_self->x * __pyx_v_vb->w)) + (__pyx_v_self->y * __pyx_v_vb->z)) - (__pyx_v_self->z * __pyx_v_vb->y));

    /* "cgtypes.pyx":4702
 *             w = self.w*vb.w - self.x*vb.x - self.y*vb.y - self.z*vb.z
 *             x = self.w*vb.x + self.x*vb.w + self.y*vb.z - self.z*vb.y
 *             y = self.w*vb.y + self.y*vb.w - self.x*vb.z + self.z*vb.x             # <<<<<<<<<<<<<<
 *             z = self.w*vb.z + self.z*vb.w + self.x*vb.y - self.y*vb.x
 *             self.w = w
 */
    __pyx_v_y = ((((__pyx_v_self->w * __pyx_v_vb->y) + (__pyx_v_self->y * __pyx_v_vb->w)) - (__pyx_v_self->x * __pyx_v_vb->z)) + (__pyx_v_self->z * __pyx_v_vb->x));

    /* "cgtypes.pyx":4703
 *             x = self.w*vb.x + self.x*vb.w + self.y*vb.z - self.z*vb.y
 *             y = self.w*vb.y + self.y*vb.w - self.x*vb.z + self.z*vb.x
 *             z = self.w*vb.z + self.z*vb.w + self.x*vb.y - self.y*vb.x             # <<<<<<<<<<<<<<
 *             self.w = w
 *             self.x = x
 */
    __pyx_v_z = ((((__pyx_v_self->w * __pyx_v_vb->z) + (__pyx_v_self->z * __pyx_v_vb->w)) + (__pyx_v_self->x * __pyx_v_vb->y)) - (__pyx_v_self->y * __pyx_v_vb->x));

    /* "cgtypes.pyx":4704
 *             y = self.w*vb.y + self.y*vb.w - self.x*vb.z + self.z*vb.x
 *             z = self.w*vb.z + self.z*vb.w + self.x*vb.y - self.y*vb.x
 *             self.w = w             # <<<<<<<<<<<<<<
 *             self.x = x
 *             self.y = y
 */
    __pyx_v_self->w = __pyx_v_w;

    /* "cgtypes.pyx":4705
 *             z = self.w*vb.z + self.z*vb.w + self.x*vb.y - self.y*vb.x
 *             self.w = w
 *             self.x = x             # <<<<<<<<<<<<<<
 *             self.y = y
 *             self.z = z
 */
    __pyx_v_self->x = __pyx_v_x;

    /* "cgtypes.pyx":4706
 *             self.w = w
 *             self.x = x
 *             self.y = y             # <<<<<<<<<<<<<<
 *             self.z = z
 *             return self
 */
    __pyx_v_self->y = __pyx_v_y;

    /* "cgtypes.pyx":4707
 *             self.x = x
 *             self.y = y
 *             self.z = z             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
    __pyx_v_self->z = __pyx_v_z;

    /* "cgtypes.pyx":4708
 *             self.y = y
 *             self.z = z
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         elif T==float or T==int or T==long:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":4710
 *             return self
 * 
 *         elif T==float or T==int or T==long:             # <<<<<<<<<<<<<<
 *             # quat*=scalar
 *             r   = other
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_T), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cgtypes.pyx":4712
 *         elif T==float or T==int or T==long:
 *             # quat*=scalar
 *             r   = other             # <<<<<<<<<<<<<<
 *             self.w = self.w*r
 *             self.x = self.x*r
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":4713
 *             # quat*=scalar
 *             r   = other
 *             self.w = self.w*r             # <<<<<<<<<<<<<<
 *             self.x = self.x*r
 *             self.y = self.y*r
 */
    __pyx_v_self->w = (__pyx_v_self->w * __pyx_v_r);

    /* "cgtypes.pyx":4714
 *             r   = other
 *             self.w = self.w*r
 *             self.x = self.x*r             # <<<<<<<<<<<<<<
 *             self.y = self.y*r
 *             self.z = self.z*r
 */
    __pyx_v_self->x = (__pyx_v_self->x * __pyx_v_r);

    /* "cgtypes.pyx":4715
 *             self.w = self.w*r
 *             self.x = self.x*r
 *             self.y = self.y*r             # <<<<<<<<<<<<<<
 *             self.z = self.z*r
 *             return self
 */
    __pyx_v_self->y = (__pyx_v_self->y * __pyx_v_r);

    /* "cgtypes.pyx":4716
 *             self.x = self.x*r
 *             self.y = self.y*r
 *             self.z = self.z*r             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
    __pyx_v_self->z = (__pyx_v_self->z * __pyx_v_r);

    /* "cgtypes.pyx":4717
 *             self.y = self.y*r
 *             self.z = self.z*r
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":4720
 * 
 *         else:
 *             raise TypeError, "unsupported operand type for *="             # <<<<<<<<<<<<<<
 * 
 *     def __idiv__(self, other):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_4, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4688
 *         return self
 * 
 *     def __imul__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline multiplication.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__imul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vb);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4722
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_7cgtypes_4quat_31__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_7cgtypes_4quat_30__idiv__[] = "Inline division with scalar.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_30__idiv__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_31__idiv__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__idiv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_30__idiv__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_other));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_7cgtypes_4quat_30__idiv__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_other) {
  double __pyx_v_r;
  PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__idiv__", 0);

  /* "cgtypes.pyx":4726
 *         """
 *         cdef double r
 *         tb = type(other)             # <<<<<<<<<<<<<<
 *         if tb==float or tb==int or tb==long:
 *             r=other
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_other)));
  __pyx_v_tb = ((PyObject*)((PyObject *)Py_TYPE(__pyx_v_other)));

  /* "cgtypes.pyx":4727
 *         cdef double r
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:             # <<<<<<<<<<<<<<
 *             r=other
 *             if fabs(r)<=eps:
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyFloat_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_tb), ((PyObject *)((PyObject*)(&PyLong_Type))), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4728
 *         tb = type(other)
 *         if tb==float or tb==int or tb==long:
 *             r=other             # <<<<<<<<<<<<<<
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"
 */
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_other); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_r = __pyx_t_4;

    /* "cgtypes.pyx":4729
 *         if tb==float or tb==int or tb==long:
 *             r=other
 *             if fabs(r)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ZeroDivisionError,"quat division"
 *             self.w=self.w/r
 */
    __pyx_t_1 = ((fabs(__pyx_v_r) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_1) {

      /* "cgtypes.pyx":4730
 *             r=other
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"             # <<<<<<<<<<<<<<
 *             self.w=self.w/r
 *             self.x=self.x/r
 */
      __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_quat_division, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":4731
 *             if fabs(r)<=eps:
 *                 raise ZeroDivisionError,"quat division"
 *             self.w=self.w/r             # <<<<<<<<<<<<<<
 *             self.x=self.x/r
 *             self.y=self.y/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->w = (__pyx_v_self->w / __pyx_v_r);

    /* "cgtypes.pyx":4732
 *                 raise ZeroDivisionError,"quat division"
 *             self.w=self.w/r
 *             self.x=self.x/r             # <<<<<<<<<<<<<<
 *             self.y=self.y/r
 *             self.z=self.z/r
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->x = (__pyx_v_self->x / __pyx_v_r);

    /* "cgtypes.pyx":4733
 *             self.w=self.w/r
 *             self.x=self.x/r
 *             self.y=self.y/r             # <<<<<<<<<<<<<<
 *             self.z=self.z/r
 *             return self
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->y = (__pyx_v_self->y / __pyx_v_r);

    /* "cgtypes.pyx":4734
 *             self.x=self.x/r
 *             self.y=self.y/r
 *             self.z=self.z/r             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
    if (unlikely(__pyx_v_r == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->z = (__pyx_v_self->z / __pyx_v_r);

    /* "cgtypes.pyx":4735
 *             self.y=self.y/r
 *             self.z=self.z/r
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "unsupported operand type for /="
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":4737
 *             return self
 *         else:
 *             raise TypeError, "unsupported operand type for /="             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, name):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_unsupported_operand_type_for_5, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4722
 *             raise TypeError, "unsupported operand type for *="
 * 
 *     def __idiv__(self, other):             # <<<<<<<<<<<<<<
 *         """Inline division with scalar.
 *         """
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.__idiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cgtypes.pyx":4739
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="w":
 *             return self.w
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_33__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static PyObject *__pyx_pw_7cgtypes_4quat_33__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_32__getattr__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_32__getattr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "cgtypes.pyx":4740
 * 
 *     def __getattr__(self, name):
 *         if name=="w":             # <<<<<<<<<<<<<<
 *             return self.w
 *         elif name=="x":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_w, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4741
 *     def __getattr__(self, name):
 *         if name=="w":
 *             return self.w             # <<<<<<<<<<<<<<
 *         elif name=="x":
 *             return self.x
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":4742
 *         if name=="w":
 *             return self.w
 *         elif name=="x":             # <<<<<<<<<<<<<<
 *             return self.x
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4743
 *             return self.w
 *         elif name=="x":
 *             return self.x             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             return self.y
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":4744
 *         elif name=="x":
 *             return self.x
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             return self.y
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4745
 *             return self.x
 *         elif name=="y":
 *             return self.y             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             return self.z
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":4746
 *         elif name=="y":
 *             return self.y
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             return self.z
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4747
 *             return self.y
 *         elif name=="z":
 *             return self.z             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"quat has no attribute '"+name+"'"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->z); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "cgtypes.pyx":4749
 *             return self.z
 *         else:
 *             raise AttributeError,"quat has no attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 *     def __setattr__(self, name, val):
 */
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_quat_has_no_attribute, __pyx_v_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_kp_s__8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4739
 *             raise TypeError, "unsupported operand type for /="
 * 
 *     def __getattr__(self, name):             # <<<<<<<<<<<<<<
 *         if name=="w":
 *             return self.w
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cgtypes.quat.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4751
 *             raise AttributeError,"quat has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="w":
 *             self.w = val
 */

/* Python wrapper */
static int __pyx_pw_7cgtypes_4quat_35__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val); /*proto*/
static int __pyx_pw_7cgtypes_4quat_35__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_34__setattr__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_val));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7cgtypes_4quat_34__setattr__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setattr__", 0);

  /* "cgtypes.pyx":4752
 * 
 *     def __setattr__(self, name, val):
 *         if name=="w":             # <<<<<<<<<<<<<<
 *             self.w = val
 *         elif name=="x":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_w, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4753
 *     def __setattr__(self, name, val):
 *         if name=="w":
 *             self.w = val             # <<<<<<<<<<<<<<
 *         elif name=="x":
 *             self.x = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->w = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":4754
 *         if name=="w":
 *             self.w = val
 *         elif name=="x":             # <<<<<<<<<<<<<<
 *             self.x = val
 *         elif name=="y":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4755
 *             self.w = val
 *         elif name=="x":
 *             self.x = val             # <<<<<<<<<<<<<<
 *         elif name=="y":
 *             self.y = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->x = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":4756
 *         elif name=="x":
 *             self.x = val
 *         elif name=="y":             # <<<<<<<<<<<<<<
 *             self.y = val
 *         elif name=="z":
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4757
 *             self.x = val
 *         elif name=="y":
 *             self.y = val             # <<<<<<<<<<<<<<
 *         elif name=="z":
 *             self.z = val
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->y = __pyx_t_2;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":4758
 *         elif name=="y":
 *             self.y = val
 *         elif name=="z":             # <<<<<<<<<<<<<<
 *             self.z = val
 *         else:
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_name, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4758; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4759
 *             self.y = val
 *         elif name=="z":
 *             self.z = val             # <<<<<<<<<<<<<<
 *         else:
 *             raise AttributeError,"quat has no writable attribute '"+name+"'"
 */
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_val); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_self->z = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":4761
 *             self.z = val
 *         else:
 *             raise AttributeError,"quat has no writable attribute '"+name+"'"             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = PyNumber_Add(__pyx_kp_s_quat_has_no_writable_attribute, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_builtin_AttributeError, __pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L3:;

  /* "cgtypes.pyx":4751
 *             raise AttributeError,"quat has no attribute '"+name+"'"
 * 
 *     def __setattr__(self, name, val):             # <<<<<<<<<<<<<<
 *         if name=="w":
 *             self.w = val
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.quat.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4764
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return magnitude.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_37__abs__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7cgtypes_4quat_36__abs__[] = "Return magnitude.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print round(abs(q),5)\n        1.0\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_7cgtypes_4quat_36__abs__;
#endif
static PyObject *__pyx_pw_7cgtypes_4quat_37__abs__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_36__abs__(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_36__abs__(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  double __pyx_v_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__abs__", 0);

  /* "cgtypes.pyx":4772
 *         """
 *         cdef double a
 *         a = self.w*self.w + self.x*self.x + self.y*self.y + self.z*self.z             # <<<<<<<<<<<<<<
 *         return sqrt(a)
 * 
 */
  __pyx_v_a = ((((__pyx_v_self->w * __pyx_v_self->w) + (__pyx_v_self->x * __pyx_v_self->x)) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z));

  /* "cgtypes.pyx":4773
 *         cdef double a
 *         a = self.w*self.w + self.x*self.x + self.y*self.y + self.z*self.z
 *         return sqrt(a)             # <<<<<<<<<<<<<<
 * 
 *     def conjugate(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(sqrt(__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4764
 * 
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         """Return magnitude.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4775
 *         return sqrt(a)
 * 
 *     def conjugate(self):             # <<<<<<<<<<<<<<
 *         """Return conjugate.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_39conjugate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_38conjugate[] = "Return conjugate.\n\n        >>> q=quat(0.9689, 0.2160, 0.1080, 0.0540)\n        >>> print q.conjugate()\n        (0.9689, -0.2160, -0.1080, -0.0540)\n        ";
static PyObject *__pyx_pw_7cgtypes_4quat_39conjugate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conjugate (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_38conjugate(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_38conjugate(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("conjugate", 0);

  /* "cgtypes.pyx":4783
 *         """
 *         cdef quat res
 *         res=quat()             # <<<<<<<<<<<<<<
 *         res.w = self.w
 *         res.x = -self.x
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4784
 *         cdef quat res
 *         res=quat()
 *         res.w = self.w             # <<<<<<<<<<<<<<
 *         res.x = -self.x
 *         res.y = -self.y
 */
  __pyx_t_2 = __pyx_v_self->w;
  __pyx_v_res->w = __pyx_t_2;

  /* "cgtypes.pyx":4785
 *         res=quat()
 *         res.w = self.w
 *         res.x = -self.x             # <<<<<<<<<<<<<<
 *         res.y = -self.y
 *         res.z = -self.z
 */
  __pyx_v_res->x = (-__pyx_v_self->x);

  /* "cgtypes.pyx":4786
 *         res.w = self.w
 *         res.x = -self.x
 *         res.y = -self.y             # <<<<<<<<<<<<<<
 *         res.z = -self.z
 *         return res
 */
  __pyx_v_res->y = (-__pyx_v_self->y);

  /* "cgtypes.pyx":4787
 *         res.x = -self.x
 *         res.y = -self.y
 *         res.z = -self.z             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (-__pyx_v_self->z);

  /* "cgtypes.pyx":4788
 *         res.y = -self.y
 *         res.z = -self.z
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def normalize(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4775
 *         return sqrt(a)
 * 
 *     def conjugate(self):             # <<<<<<<<<<<<<<
 *         """Return conjugate.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.conjugate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4790
 *         return res
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized quaternion.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_41normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_40normalize[] = "Return normalized quaternion.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> q=q.normalize()\n        >>> print q\n        (0.8250, 0.4583, 0.1833, 0.2750)\n        >>> print abs(q)\n        1.0\n        ";
static PyObject *__pyx_pw_7cgtypes_4quat_41normalize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normalize (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_40normalize(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_40normalize(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  double __pyx_v_nlen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("normalize", 0);

  /* "cgtypes.pyx":4803
 *         cdef double nlen
 * 
 *         nlen = sqrt(self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z)             # <<<<<<<<<<<<<<
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"quat division"
 */
  __pyx_v_nlen = sqrt(((((__pyx_v_self->w * __pyx_v_self->w) + (__pyx_v_self->x * __pyx_v_self->x)) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)));

  /* "cgtypes.pyx":4804
 * 
 *         nlen = sqrt(self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z)
 *         if nlen<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"quat division"
 * 
 */
  __pyx_t_1 = ((__pyx_v_nlen <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4805
 *         nlen = sqrt(self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z)
 *         if nlen<=eps:
 *             raise ZeroDivisionError,"quat division"             # <<<<<<<<<<<<<<
 * 
 *         nlen = 1.0/nlen
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_quat_division, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4807
 *             raise ZeroDivisionError,"quat division"
 * 
 *         nlen = 1.0/nlen             # <<<<<<<<<<<<<<
 *         res = quat()
 *         res.w = self.w*nlen
 */
  if (unlikely(__pyx_v_nlen == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_nlen = (1.0 / __pyx_v_nlen);

  /* "cgtypes.pyx":4808
 * 
 *         nlen = 1.0/nlen
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w = self.w*nlen
 *         res.x = self.x*nlen
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4809
 *         nlen = 1.0/nlen
 *         res = quat()
 *         res.w = self.w*nlen             # <<<<<<<<<<<<<<
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 */
  __pyx_v_res->w = (__pyx_v_self->w * __pyx_v_nlen);

  /* "cgtypes.pyx":4810
 *         res = quat()
 *         res.w = self.w*nlen
 *         res.x = self.x*nlen             # <<<<<<<<<<<<<<
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 */
  __pyx_v_res->x = (__pyx_v_self->x * __pyx_v_nlen);

  /* "cgtypes.pyx":4811
 *         res.w = self.w*nlen
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen             # <<<<<<<<<<<<<<
 *         res.z = self.z*nlen
 *         return res
 */
  __pyx_v_res->y = (__pyx_v_self->y * __pyx_v_nlen);

  /* "cgtypes.pyx":4812
 *         res.x = self.x*nlen
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = (__pyx_v_self->z * __pyx_v_nlen);

  /* "cgtypes.pyx":4813
 *         res.y = self.y*nlen
 *         res.z = self.z*nlen
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def inverse(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4790
 *         return res
 * 
 *     def normalize(self):             # <<<<<<<<<<<<<<
 *         """Return normalized quaternion.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.normalize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4815
 *         return res
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_43inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_42inverse[] = "Return inverse.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> print q.inverse()\n        (0.7563, -0.4202, -0.1681, -0.2521)\n        ";
static PyObject *__pyx_pw_7cgtypes_4quat_43inverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inverse (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_42inverse(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_42inverse(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  double __pyx_v_len_2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inverse", 0);

  /* "cgtypes.pyx":4824
 *         cdef quat res
 * 
 *         len_2 = self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z             # <<<<<<<<<<<<<<
 *         if fabs(len_2)<=eps:
 *             raise ZeroDivisionError,"quat is not invertible"
 */
  __pyx_v_len_2 = ((((__pyx_v_self->w * __pyx_v_self->w) + (__pyx_v_self->x * __pyx_v_self->x)) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z));

  /* "cgtypes.pyx":4825
 * 
 *         len_2 = self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z
 *         if fabs(len_2)<=eps:             # <<<<<<<<<<<<<<
 *             raise ZeroDivisionError,"quat is not invertible"
 * 
 */
  __pyx_t_1 = ((fabs(__pyx_v_len_2) <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_1) {

    /* "cgtypes.pyx":4826
 *         len_2 = self.w*self.w+self.x*self.x+self.y*self.y+self.z*self.z
 *         if fabs(len_2)<=eps:
 *             raise ZeroDivisionError,"quat is not invertible"             # <<<<<<<<<<<<<<
 * 
 *         len_2 = 1.0/len_2
 */
    __Pyx_Raise(__pyx_builtin_ZeroDivisionError, __pyx_kp_s_quat_is_not_invertible, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4828
 *             raise ZeroDivisionError,"quat is not invertible"
 * 
 *         len_2 = 1.0/len_2             # <<<<<<<<<<<<<<
 *         res = quat()
 *         res.w =  self.w*len_2
 */
  if (unlikely(__pyx_v_len_2 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_len_2 = (1.0 / __pyx_v_len_2);

  /* "cgtypes.pyx":4829
 * 
 *         len_2 = 1.0/len_2
 *         res = quat()             # <<<<<<<<<<<<<<
 *         res.w =  self.w*len_2
 *         res.x = -self.x*len_2
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cgtypes.pyx":4830
 *         len_2 = 1.0/len_2
 *         res = quat()
 *         res.w =  self.w*len_2             # <<<<<<<<<<<<<<
 *         res.x = -self.x*len_2
 *         res.y = -self.y*len_2
 */
  __pyx_v_res->w = (__pyx_v_self->w * __pyx_v_len_2);

  /* "cgtypes.pyx":4831
 *         res = quat()
 *         res.w =  self.w*len_2
 *         res.x = -self.x*len_2             # <<<<<<<<<<<<<<
 *         res.y = -self.y*len_2
 *         res.z = -self.z*len_2
 */
  __pyx_v_res->x = ((-__pyx_v_self->x) * __pyx_v_len_2);

  /* "cgtypes.pyx":4832
 *         res.w =  self.w*len_2
 *         res.x = -self.x*len_2
 *         res.y = -self.y*len_2             # <<<<<<<<<<<<<<
 *         res.z = -self.z*len_2
 *         return res
 */
  __pyx_v_res->y = ((-__pyx_v_self->y) * __pyx_v_len_2);

  /* "cgtypes.pyx":4833
 *         res.x = -self.x*len_2
 *         res.y = -self.y*len_2
 *         res.z = -self.z*len_2             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->z = ((-__pyx_v_self->z) * __pyx_v_len_2);

  /* "cgtypes.pyx":4834
 *         res.y = -self.y*len_2
 *         res.z = -self.z*len_2
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def toAngleAxis(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4815
 *         return res
 * 
 *     def inverse(self):             # <<<<<<<<<<<<<<
 *         """Return inverse.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.inverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4836
 *         return res
 * 
 *     def toAngleAxis(self):             # <<<<<<<<<<<<<<
 *         """Return angle (in radians) and rotation axis.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_45toAngleAxis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_44toAngleAxis[] = "Return angle (in radians) and rotation axis.\n\n        >>> q=quat(0.9, 0.5, 0.2, 0.3)\n        >>> angle, axis = q.toAngleAxis()\n        >>> print round(angle,4)\n        1.2011\n        >>> print axis\n        (0.8111, 0.3244, 0.4867)\n        ";
static PyObject *__pyx_pw_7cgtypes_4quat_45toAngleAxis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toAngleAxis (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_44toAngleAxis(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_44toAngleAxis(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q = 0;
  double __pyx_v_s;
  double __pyx_v_w;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  double __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toAngleAxis", 0);

  /* "cgtypes.pyx":4849
 *         cdef double s,w
 * 
 *         q = self.normalize()             # <<<<<<<<<<<<<<
 * 
 *         # Clamp nself.w (since the quat has to be normalized it should
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_normalize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_q = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4854
 *         # be between -1 and 1 anyway, but it might be slightly off due
 *         # to numerical inaccuracies)
 *         if q.w<-1.0:             # <<<<<<<<<<<<<<
 *             w = -1.0
 *         elif q.w>1.0:
 */
  __pyx_t_4 = ((__pyx_v_q->w < -1.0) != 0);
  if (__pyx_t_4) {

    /* "cgtypes.pyx":4855
 *         # to numerical inaccuracies)
 *         if q.w<-1.0:
 *             w = -1.0             # <<<<<<<<<<<<<<
 *         elif q.w>1.0:
 *             w = 1.0
 */
    __pyx_v_w = -1.0;
    goto __pyx_L3;
  }

  /* "cgtypes.pyx":4856
 *         if q.w<-1.0:
 *             w = -1.0
 *         elif q.w>1.0:             # <<<<<<<<<<<<<<
 *             w = 1.0
 *         else:
 */
  __pyx_t_4 = ((__pyx_v_q->w > 1.0) != 0);
  if (__pyx_t_4) {

    /* "cgtypes.pyx":4857
 *             w = -1.0
 *         elif q.w>1.0:
 *             w = 1.0             # <<<<<<<<<<<<<<
 *         else:
 *             w = q.w
 */
    __pyx_v_w = 1.0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":4859
 *             w = 1.0
 *         else:
 *             w = q.w             # <<<<<<<<<<<<<<
 * 
 *         w = acos(w)
 */
    __pyx_t_5 = __pyx_v_q->w;
    __pyx_v_w = __pyx_t_5;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":4861
 *             w = q.w
 * 
 *         w = acos(w)             # <<<<<<<<<<<<<<
 *         s = sin(w)
 *         if s<=eps:
 */
  __pyx_v_w = acos(__pyx_v_w);

  /* "cgtypes.pyx":4862
 * 
 *         w = acos(w)
 *         s = sin(w)             # <<<<<<<<<<<<<<
 *         if s<=eps:
 *             return (0.0, vec3(0.0,0.0,0.0))
 */
  __pyx_v_s = sin(__pyx_v_w);

  /* "cgtypes.pyx":4863
 *         w = acos(w)
 *         s = sin(w)
 *         if s<=eps:             # <<<<<<<<<<<<<<
 *             return (0.0, vec3(0.0,0.0,0.0))
 * 
 */
  __pyx_t_4 = ((__pyx_v_s <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_4) {

    /* "cgtypes.pyx":4864
 *         s = sin(w)
 *         if s<=eps:
 *             return (0.0, vec3(0.0,0.0,0.0))             # <<<<<<<<<<<<<<
 * 
 *         return (2.0*w, vec3(q.x/s, q.y/s, q.z/s))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_float_0_0);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_float_0_0);
    __Pyx_GIVEREF(__pyx_float_0_0);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":4866
 *             return (0.0, vec3(0.0,0.0,0.0))
 * 
 *         return (2.0*w, vec3(q.x/s, q.y/s, q.z/s))             # <<<<<<<<<<<<<<
 * 
 *     def fromAngleAxis(self, angle, axis):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble((2.0 * __pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(__pyx_v_s == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_q->x / __pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(__pyx_v_s == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_q->y / __pyx_v_s)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(__pyx_v_s == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = PyFloat_FromDouble((__pyx_v_q->z / __pyx_v_s)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_2 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4836
 *         return res
 * 
 *     def toAngleAxis(self):             # <<<<<<<<<<<<<<
 *         """Return angle (in radians) and rotation axis.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cgtypes.quat.toAngleAxis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4868
 *         return (2.0*w, vec3(q.x/s, q.y/s, q.z/s))
 * 
 *     def fromAngleAxis(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Initialize self from an angle (in radians) and an axis and returns self."""
 *         cdef double a,n, x,y,z
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_47fromAngleAxis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4quat_46fromAngleAxis[] = "Initialize self from an angle (in radians) and an axis and returns self.";
static PyObject *__pyx_pw_7cgtypes_4quat_47fromAngleAxis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_angle = 0;
  PyObject *__pyx_v_axis = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromAngleAxis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_angle,&__pyx_n_s_axis,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_angle)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fromAngleAxis", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fromAngleAxis") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_angle = values[0];
    __pyx_v_axis = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromAngleAxis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4868; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.quat.fromAngleAxis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_4quat_46fromAngleAxis(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), __pyx_v_angle, __pyx_v_axis);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_46fromAngleAxis(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_angle, PyObject *__pyx_v_axis) {
  double __pyx_v_a;
  double __pyx_v_n;
  double __pyx_v_x;
  double __pyx_v_y;
  double __pyx_v_z;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q = 0;
  double __pyx_v_s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromAngleAxis", 0);

  /* "cgtypes.pyx":4873
 *         cdef quat q
 * 
 *         a = angle/2.0             # <<<<<<<<<<<<<<
 *         self.w = cos(a)
 * 
 */
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_angle, __pyx_float_2_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_a = __pyx_t_2;

  /* "cgtypes.pyx":4874
 * 
 *         a = angle/2.0
 *         self.w = cos(a)             # <<<<<<<<<<<<<<
 * 
 *         x = axis[0]
 */
  __pyx_v_self->w = cos(__pyx_v_a);

  /* "cgtypes.pyx":4876
 *         self.w = cos(a)
 * 
 *         x = axis[0]             # <<<<<<<<<<<<<<
 *         y = axis[1]
 *         z = axis[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_axis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4876; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_x = __pyx_t_2;

  /* "cgtypes.pyx":4877
 * 
 *         x = axis[0]
 *         y = axis[1]             # <<<<<<<<<<<<<<
 *         z = axis[2]
 *         n = x*x+y*y+z*z
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_axis, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4877; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;

  /* "cgtypes.pyx":4878
 *         x = axis[0]
 *         y = axis[1]
 *         z = axis[2]             # <<<<<<<<<<<<<<
 *         n = x*x+y*y+z*z
 *         if n<=eps:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_axis, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4878; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_z = __pyx_t_2;

  /* "cgtypes.pyx":4879
 *         y = axis[1]
 *         z = axis[2]
 *         n = x*x+y*y+z*z             # <<<<<<<<<<<<<<
 *         if n<=eps:
 *             raise ValueError,"axis mustn't be the null vector"
 */
  __pyx_v_n = (((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z * __pyx_v_z));

  /* "cgtypes.pyx":4880
 *         z = axis[2]
 *         n = x*x+y*y+z*z
 *         if n<=eps:             # <<<<<<<<<<<<<<
 *             raise ValueError,"axis mustn't be the null vector"
 * 
 */
  __pyx_t_3 = ((__pyx_v_n <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_3) {

    /* "cgtypes.pyx":4881
 *         n = x*x+y*y+z*z
 *         if n<=eps:
 *             raise ValueError,"axis mustn't be the null vector"             # <<<<<<<<<<<<<<
 * 
 *         s = sin(a)/n
 */
    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_axis_mustn_t_be_the_null_vector, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "cgtypes.pyx":4883
 *             raise ValueError,"axis mustn't be the null vector"
 * 
 *         s = sin(a)/n             # <<<<<<<<<<<<<<
 *         self.x = x*s
 *         self.y = y*s
 */
  __pyx_t_2 = sin(__pyx_v_a);
  if (unlikely(__pyx_v_n == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_s = (__pyx_t_2 / __pyx_v_n);

  /* "cgtypes.pyx":4884
 * 
 *         s = sin(a)/n
 *         self.x = x*s             # <<<<<<<<<<<<<<
 *         self.y = y*s
 *         self.z = z*s
 */
  __pyx_v_self->x = (__pyx_v_x * __pyx_v_s);

  /* "cgtypes.pyx":4885
 *         s = sin(a)/n
 *         self.x = x*s
 *         self.y = y*s             # <<<<<<<<<<<<<<
 *         self.z = z*s
 * 
 */
  __pyx_v_self->y = (__pyx_v_y * __pyx_v_s);

  /* "cgtypes.pyx":4886
 *         self.x = x*s
 *         self.y = y*s
 *         self.z = z*s             # <<<<<<<<<<<<<<
 * 
 *         # Normalize the quat
 */
  __pyx_v_self->z = (__pyx_v_z * __pyx_v_s);

  /* "cgtypes.pyx":4889
 * 
 *         # Normalize the quat
 *         q = self.normalize()             # <<<<<<<<<<<<<<
 *         self.w = q.w
 *         self.x = q.x
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_normalize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cgtypes_quat))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_q = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4890
 *         # Normalize the quat
 *         q = self.normalize()
 *         self.w = q.w             # <<<<<<<<<<<<<<
 *         self.x = q.x
 *         self.y = q.y
 */
  __pyx_t_2 = __pyx_v_q->w;
  __pyx_v_self->w = __pyx_t_2;

  /* "cgtypes.pyx":4891
 *         q = self.normalize()
 *         self.w = q.w
 *         self.x = q.x             # <<<<<<<<<<<<<<
 *         self.y = q.y
 *         self.z = q.z
 */
  __pyx_t_2 = __pyx_v_q->x;
  __pyx_v_self->x = __pyx_t_2;

  /* "cgtypes.pyx":4892
 *         self.w = q.w
 *         self.x = q.x
 *         self.y = q.y             # <<<<<<<<<<<<<<
 *         self.z = q.z
 *         return self
 */
  __pyx_t_2 = __pyx_v_q->y;
  __pyx_v_self->y = __pyx_t_2;

  /* "cgtypes.pyx":4893
 *         self.x = q.x
 *         self.y = q.y
 *         self.z = q.z             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __pyx_v_q->z;
  __pyx_v_self->z = __pyx_t_2;

  /* "cgtypes.pyx":4894
 *         self.y = q.y
 *         self.z = q.z
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def toMat3(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4868
 *         return (2.0*w, vec3(q.x/s, q.y/s, q.z/s))
 * 
 *     def fromAngleAxis(self, angle, axis):             # <<<<<<<<<<<<<<
 *         """Initialize self from an angle (in radians) and an axis and returns self."""
 *         cdef double a,n, x,y,z
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.fromAngleAxis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4896
 *         return self
 * 
 *     def toMat3(self):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix as mat3."""
 *         cdef mat3 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_49toMat3(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_48toMat3[] = "Return rotation matrix as mat3.";
static PyObject *__pyx_pw_7cgtypes_4quat_49toMat3(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toMat3 (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_48toMat3(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_48toMat3(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat3 *__pyx_v_res = 0;
  PyObject *__pyx_v_xx = 0;
  PyObject *__pyx_v_yy = 0;
  PyObject *__pyx_v_zz = 0;
  PyObject *__pyx_v_xy = 0;
  PyObject *__pyx_v_zw = 0;
  PyObject *__pyx_v_xz = 0;
  PyObject *__pyx_v_yw = 0;
  PyObject *__pyx_v_yz = 0;
  PyObject *__pyx_v_xw = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toMat3", 0);

  /* "cgtypes.pyx":4901
 *         cdef xx,yy,zz,xy,zw,xz,yw,yz,xw
 * 
 *         xx = 2.0*self.x*self.x             # <<<<<<<<<<<<<<
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4902
 * 
 *         xx = 2.0*self.x*self.x
 *         yy = 2.0*self.y*self.y             # <<<<<<<<<<<<<<
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yy = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4903
 *         xx = 2.0*self.x*self.x
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z             # <<<<<<<<<<<<<<
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->z) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_zz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4904
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y             # <<<<<<<<<<<<<<
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xy = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4905
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w             # <<<<<<<<<<<<<<
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->z) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_zw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4906
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z             # <<<<<<<<<<<<<<
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4907
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w             # <<<<<<<<<<<<<<
 *         yz = 2.0*self.y*self.z
 *         xw = 2.0*self.x*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4908
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z             # <<<<<<<<<<<<<<
 *         xw = 2.0*self.x*self.w
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4909
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z
 *         xw = 2.0*self.x*self.w             # <<<<<<<<<<<<<<
 * 
 *         res = mat3()
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4911
 *         xw = 2.0*self.x*self.w
 * 
 *         res = mat3()             # <<<<<<<<<<<<<<
 *         res.m11 = 1.0-yy-zz
 *         res.m12 = xy-zw
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat3 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4912
 * 
 *         res = mat3()
 *         res.m11 = 1.0-yy-zz             # <<<<<<<<<<<<<<
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_yy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_zz); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m11 = __pyx_t_3;

  /* "cgtypes.pyx":4913
 *         res = mat3()
 *         res.m11 = 1.0-yy-zz
 *         res.m12 = xy-zw             # <<<<<<<<<<<<<<
 *         res.m13 = xz+yw
 *         res.m21 = xy+zw
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_xy, __pyx_v_zw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m12 = __pyx_t_3;

  /* "cgtypes.pyx":4914
 *         res.m11 = 1.0-yy-zz
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw             # <<<<<<<<<<<<<<
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz
 */
  __pyx_t_2 = PyNumber_Add(__pyx_v_xz, __pyx_v_yw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m13 = __pyx_t_3;

  /* "cgtypes.pyx":4915
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw
 *         res.m21 = xy+zw             # <<<<<<<<<<<<<<
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw
 */
  __pyx_t_2 = PyNumber_Add(__pyx_v_xy, __pyx_v_zw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m21 = __pyx_t_3;

  /* "cgtypes.pyx":4916
 *         res.m13 = xz+yw
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz             # <<<<<<<<<<<<<<
 *         res.m23 = yz-xw
 *         res.m31 = xz-yw
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_xx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_zz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m22 = __pyx_t_3;

  /* "cgtypes.pyx":4917
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw             # <<<<<<<<<<<<<<
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_yz, __pyx_v_xw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m23 = __pyx_t_3;

  /* "cgtypes.pyx":4918
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw
 *         res.m31 = xz-yw             # <<<<<<<<<<<<<<
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_xz, __pyx_v_yw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m31 = __pyx_t_3;

  /* "cgtypes.pyx":4919
 *         res.m23 = yz-xw
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw             # <<<<<<<<<<<<<<
 *         res.m33 = 1.0-xx-yy
 *         return res
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_yz, __pyx_v_xw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m32 = __pyx_t_3;

  /* "cgtypes.pyx":4920
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_xx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_yy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m33 = __pyx_t_3;

  /* "cgtypes.pyx":4921
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def toMat4(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4896
 *         return self
 * 
 *     def toMat3(self):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix as mat3."""
 *         cdef mat3 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.toMat3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_yy);
  __Pyx_XDECREF(__pyx_v_zz);
  __Pyx_XDECREF(__pyx_v_xy);
  __Pyx_XDECREF(__pyx_v_zw);
  __Pyx_XDECREF(__pyx_v_xz);
  __Pyx_XDECREF(__pyx_v_yw);
  __Pyx_XDECREF(__pyx_v_yz);
  __Pyx_XDECREF(__pyx_v_xw);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4923
 *         return res
 * 
 *     def toMat4(self):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix as mat4."""
 *         cdef mat4 res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_51toMat4(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_50toMat4[] = "Return rotation matrix as mat4.";
static PyObject *__pyx_pw_7cgtypes_4quat_51toMat4(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("toMat4 (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_50toMat4(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_50toMat4(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  struct __pyx_obj_7cgtypes_mat4 *__pyx_v_res = 0;
  PyObject *__pyx_v_xx = 0;
  PyObject *__pyx_v_yy = 0;
  PyObject *__pyx_v_zz = 0;
  PyObject *__pyx_v_xy = 0;
  PyObject *__pyx_v_zw = 0;
  PyObject *__pyx_v_xz = 0;
  PyObject *__pyx_v_yw = 0;
  PyObject *__pyx_v_yz = 0;
  PyObject *__pyx_v_xw = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("toMat4", 0);

  /* "cgtypes.pyx":4928
 *         cdef xx,yy,zz,xy,zw,xz,yw,yz,xw
 * 
 *         xx = 2.0*self.x*self.x             # <<<<<<<<<<<<<<
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->x)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4929
 * 
 *         xx = 2.0*self.x*self.x
 *         yy = 2.0*self.y*self.y             # <<<<<<<<<<<<<<
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yy = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4930
 *         xx = 2.0*self.x*self.x
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z             # <<<<<<<<<<<<<<
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->z) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_zz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4931
 *         yy = 2.0*self.y*self.y
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y             # <<<<<<<<<<<<<<
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xy = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4932
 *         zz = 2.0*self.z*self.z
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w             # <<<<<<<<<<<<<<
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->z) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_zw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4933
 *         xy = 2.0*self.x*self.y
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z             # <<<<<<<<<<<<<<
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4934
 *         zw = 2.0*self.z*self.w
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w             # <<<<<<<<<<<<<<
 *         yz = 2.0*self.y*self.z
 *         xw = 2.0*self.x*self.w
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4935
 *         xz = 2.0*self.x*self.z
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z             # <<<<<<<<<<<<<<
 *         xw = 2.0*self.x*self.w
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->y) * __pyx_v_self->z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_yz = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4936
 *         yw = 2.0*self.y*self.w
 *         yz = 2.0*self.y*self.z
 *         xw = 2.0*self.x*self.w             # <<<<<<<<<<<<<<
 * 
 *         res = mat4()
 */
  __pyx_t_1 = PyFloat_FromDouble(((2.0 * __pyx_v_self->x) * __pyx_v_self->w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_xw = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4938
 *         xw = 2.0*self.x*self.w
 * 
 *         res = mat4()             # <<<<<<<<<<<<<<
 * 
 *         res.m11 = 1.0-yy-zz
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_mat4 *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":4940
 *         res = mat4()
 * 
 *         res.m11 = 1.0-yy-zz             # <<<<<<<<<<<<<<
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_yy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_zz); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m11 = __pyx_t_3;

  /* "cgtypes.pyx":4941
 * 
 *         res.m11 = 1.0-yy-zz
 *         res.m12 = xy-zw             # <<<<<<<<<<<<<<
 *         res.m13 = xz+yw
 *         res.m14 = 0.0
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_xy, __pyx_v_zw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m12 = __pyx_t_3;

  /* "cgtypes.pyx":4942
 *         res.m11 = 1.0-yy-zz
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw             # <<<<<<<<<<<<<<
 *         res.m14 = 0.0
 *         res.m21 = xy+zw
 */
  __pyx_t_2 = PyNumber_Add(__pyx_v_xz, __pyx_v_yw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m13 = __pyx_t_3;

  /* "cgtypes.pyx":4943
 *         res.m12 = xy-zw
 *         res.m13 = xz+yw
 *         res.m14 = 0.0             # <<<<<<<<<<<<<<
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz
 */
  __pyx_v_res->m14 = 0.0;

  /* "cgtypes.pyx":4944
 *         res.m13 = xz+yw
 *         res.m14 = 0.0
 *         res.m21 = xy+zw             # <<<<<<<<<<<<<<
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw
 */
  __pyx_t_2 = PyNumber_Add(__pyx_v_xy, __pyx_v_zw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m21 = __pyx_t_3;

  /* "cgtypes.pyx":4945
 *         res.m14 = 0.0
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz             # <<<<<<<<<<<<<<
 *         res.m23 = yz-xw
 *         res.m24 = 0.0
 */
  __pyx_t_2 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_xx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_zz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m22 = __pyx_t_3;

  /* "cgtypes.pyx":4946
 *         res.m21 = xy+zw
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw             # <<<<<<<<<<<<<<
 *         res.m24 = 0.0
 *         res.m31 = xz-yw
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_yz, __pyx_v_xw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m23 = __pyx_t_3;

  /* "cgtypes.pyx":4947
 *         res.m22 = 1.0-xx-zz
 *         res.m23 = yz-xw
 *         res.m24 = 0.0             # <<<<<<<<<<<<<<
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw
 */
  __pyx_v_res->m24 = 0.0;

  /* "cgtypes.pyx":4948
 *         res.m23 = yz-xw
 *         res.m24 = 0.0
 *         res.m31 = xz-yw             # <<<<<<<<<<<<<<
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_xz, __pyx_v_yw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m31 = __pyx_t_3;

  /* "cgtypes.pyx":4949
 *         res.m24 = 0.0
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw             # <<<<<<<<<<<<<<
 *         res.m33 = 1.0-xx-yy
 *         res.m34 = 0.0
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_yz, __pyx_v_xw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_res->m32 = __pyx_t_3;

  /* "cgtypes.pyx":4950
 *         res.m31 = xz-yw
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy             # <<<<<<<<<<<<<<
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_float_1_0, __pyx_v_xx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_yy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res->m33 = __pyx_t_3;

  /* "cgtypes.pyx":4951
 *         res.m32 = yz+xw
 *         res.m33 = 1.0-xx-yy
 *         res.m34 = 0.0             # <<<<<<<<<<<<<<
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 */
  __pyx_v_res->m34 = 0.0;

  /* "cgtypes.pyx":4952
 *         res.m33 = 1.0-xx-yy
 *         res.m34 = 0.0
 *         res.m41 = 0.0             # <<<<<<<<<<<<<<
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 */
  __pyx_v_res->m41 = 0.0;

  /* "cgtypes.pyx":4953
 *         res.m34 = 0.0
 *         res.m41 = 0.0
 *         res.m42 = 0.0             # <<<<<<<<<<<<<<
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 */
  __pyx_v_res->m42 = 0.0;

  /* "cgtypes.pyx":4954
 *         res.m41 = 0.0
 *         res.m42 = 0.0
 *         res.m43 = 0.0             # <<<<<<<<<<<<<<
 *         res.m44 = 1.0
 *         return res
 */
  __pyx_v_res->m43 = 0.0;

  /* "cgtypes.pyx":4955
 *         res.m42 = 0.0
 *         res.m43 = 0.0
 *         res.m44 = 1.0             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_v_res->m44 = 1.0;

  /* "cgtypes.pyx":4956
 *         res.m43 = 0.0
 *         res.m44 = 1.0
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def fromMat(self, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":4923
 *         return res
 * 
 *     def toMat4(self):             # <<<<<<<<<<<<<<
 *         """Return rotation matrix as mat4."""
 *         cdef mat4 res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes.quat.toMat4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_xx);
  __Pyx_XDECREF(__pyx_v_yy);
  __Pyx_XDECREF(__pyx_v_zz);
  __Pyx_XDECREF(__pyx_v_xy);
  __Pyx_XDECREF(__pyx_v_zw);
  __Pyx_XDECREF(__pyx_v_xz);
  __Pyx_XDECREF(__pyx_v_yw);
  __Pyx_XDECREF(__pyx_v_yz);
  __Pyx_XDECREF(__pyx_v_xw);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4958
 *         return res
 * 
 *     def fromMat(self, m):             # <<<<<<<<<<<<<<
 *         """Initialize self from either a mat3 or mat4 and returns self."""
 *         cdef double d1,d2,d3,ad1,ad2,ad3,t,s
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_53fromMat(PyObject *__pyx_v_self, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_7cgtypes_4quat_52fromMat[] = "Initialize self from either a mat3 or mat4 and returns self.";
static PyObject *__pyx_pw_7cgtypes_4quat_53fromMat(PyObject *__pyx_v_self, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromMat (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_52fromMat(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((PyObject *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_52fromMat(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, PyObject *__pyx_v_m) {
  double __pyx_v_d1;
  double __pyx_v_d2;
  double __pyx_v_d3;
  double __pyx_v_ad1;
  double __pyx_v_ad2;
  double __pyx_v_ad3;
  double __pyx_v_t;
  double __pyx_v_s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fromMat", 0);

  /* "cgtypes.pyx":4962
 *         cdef double d1,d2,d3,ad1,ad2,ad3,t,s
 * 
 *         d1 = m[0,0]             # <<<<<<<<<<<<<<
 *         d2 = m[1,1]
 *         d3 = m[2,2]
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__23); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4962; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d1 = __pyx_t_2;

  /* "cgtypes.pyx":4963
 * 
 *         d1 = m[0,0]
 *         d2 = m[1,1]             # <<<<<<<<<<<<<<
 *         d3 = m[2,2]
 *         t = d1+d2+d3+1.0
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__24); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4963; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d2 = __pyx_t_2;

  /* "cgtypes.pyx":4964
 *         d1 = m[0,0]
 *         d2 = m[1,1]
 *         d3 = m[2,2]             # <<<<<<<<<<<<<<
 *         t = d1+d2+d3+1.0
 *         if t>0.0:
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__25); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4964; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_d3 = __pyx_t_2;

  /* "cgtypes.pyx":4965
 *         d2 = m[1,1]
 *         d3 = m[2,2]
 *         t = d1+d2+d3+1.0             # <<<<<<<<<<<<<<
 *         if t>0.0:
 *             s = 0.5/sqrt(t)
 */
  __pyx_v_t = (((__pyx_v_d1 + __pyx_v_d2) + __pyx_v_d3) + 1.0);

  /* "cgtypes.pyx":4966
 *         d3 = m[2,2]
 *         t = d1+d2+d3+1.0
 *         if t>0.0:             # <<<<<<<<<<<<<<
 *             s = 0.5/sqrt(t)
 *             self.w = 0.25/s
 */
  __pyx_t_3 = ((__pyx_v_t > 0.0) != 0);
  if (__pyx_t_3) {

    /* "cgtypes.pyx":4967
 *         t = d1+d2+d3+1.0
 *         if t>0.0:
 *             s = 0.5/sqrt(t)             # <<<<<<<<<<<<<<
 *             self.w = 0.25/s
 *             self.x = (m[2,1]-m[1,2])*s
 */
    __pyx_t_2 = sqrt(__pyx_v_t);
    if (unlikely(__pyx_t_2 == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_s = (0.5 / __pyx_t_2);

    /* "cgtypes.pyx":4968
 *         if t>0.0:
 *             s = 0.5/sqrt(t)
 *             self.w = 0.25/s             # <<<<<<<<<<<<<<
 *             self.x = (m[2,1]-m[1,2])*s
 *             self.y = (m[0,2]-m[2,0])*s
 */
    if (unlikely(__pyx_v_s == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_self->w = (0.25 / __pyx_v_s);

    /* "cgtypes.pyx":4969
 *             s = 0.5/sqrt(t)
 *             self.w = 0.25/s
 *             self.x = (m[2,1]-m[1,2])*s             # <<<<<<<<<<<<<<
 *             self.y = (m[0,2]-m[2,0])*s
 *             self.z = (m[1,0]-m[0,1])*s
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__26); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__27); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->x = __pyx_t_2;

    /* "cgtypes.pyx":4970
 *             self.w = 0.25/s
 *             self.x = (m[2,1]-m[1,2])*s
 *             self.y = (m[0,2]-m[2,0])*s             # <<<<<<<<<<<<<<
 *             self.z = (m[1,0]-m[0,1])*s
 *         else:
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__28); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__29); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->y = __pyx_t_2;

    /* "cgtypes.pyx":4971
 *             self.x = (m[2,1]-m[1,2])*s
 *             self.y = (m[0,2]-m[2,0])*s
 *             self.z = (m[1,0]-m[0,1])*s             # <<<<<<<<<<<<<<
 *         else:
 *             ad1 = fabs(d1)
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__30); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__31); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_self->z = __pyx_t_2;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":4973
 *             self.z = (m[1,0]-m[0,1])*s
 *         else:
 *             ad1 = fabs(d1)             # <<<<<<<<<<<<<<
 *             ad2 = fabs(d2)
 *             ad3 = fabs(d3)
 */
    __pyx_v_ad1 = fabs(__pyx_v_d1);

    /* "cgtypes.pyx":4974
 *         else:
 *             ad1 = fabs(d1)
 *             ad2 = fabs(d2)             # <<<<<<<<<<<<<<
 *             ad3 = fabs(d3)
 *             if ad1>=ad2 and ad1>=ad3:
 */
    __pyx_v_ad2 = fabs(__pyx_v_d2);

    /* "cgtypes.pyx":4975
 *             ad1 = fabs(d1)
 *             ad2 = fabs(d2)
 *             ad3 = fabs(d3)             # <<<<<<<<<<<<<<
 *             if ad1>=ad2 and ad1>=ad3:
 *                 s = sqrt(1.0+d1-d2-d3)*2.0
 */
    __pyx_v_ad3 = fabs(__pyx_v_d3);

    /* "cgtypes.pyx":4976
 *             ad2 = fabs(d2)
 *             ad3 = fabs(d3)
 *             if ad1>=ad2 and ad1>=ad3:             # <<<<<<<<<<<<<<
 *                 s = sqrt(1.0+d1-d2-d3)*2.0
 *                 self.x = 0.5/s
 */
    __pyx_t_6 = ((__pyx_v_ad1 >= __pyx_v_ad2) != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_6 = ((__pyx_v_ad1 >= __pyx_v_ad3) != 0);
    __pyx_t_3 = __pyx_t_6;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":4977
 *             ad3 = fabs(d3)
 *             if ad1>=ad2 and ad1>=ad3:
 *                 s = sqrt(1.0+d1-d2-d3)*2.0             # <<<<<<<<<<<<<<
 *                 self.x = 0.5/s
 *                 self.y = (m[0,1]+m[1,0])/s
 */
      __pyx_v_s = (sqrt((((1.0 + __pyx_v_d1) - __pyx_v_d2) - __pyx_v_d3)) * 2.0);

      /* "cgtypes.pyx":4978
 *             if ad1>=ad2 and ad1>=ad3:
 *                 s = sqrt(1.0+d1-d2-d3)*2.0
 *                 self.x = 0.5/s             # <<<<<<<<<<<<<<
 *                 self.y = (m[0,1]+m[1,0])/s
 *                 self.z = (m[0,2]+m[2,0])/s
 */
      if (unlikely(__pyx_v_s == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_self->x = (0.5 / __pyx_v_s);

      /* "cgtypes.pyx":4979
 *                 s = sqrt(1.0+d1-d2-d3)*2.0
 *                 self.x = 0.5/s
 *                 self.y = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 *                 self.z = (m[0,2]+m[2,0])/s
 *                 self.w = (m[1,2]+m[2,1])/s
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__32); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__33); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->y = __pyx_t_2;

      /* "cgtypes.pyx":4980
 *                 self.x = 0.5/s
 *                 self.y = (m[0,1]+m[1,0])/s
 *                 self.z = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *                 self.w = (m[1,2]+m[2,1])/s
 *             elif ad2>=ad1 and ad2>=ad3:
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__34); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__35); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->z = __pyx_t_2;

      /* "cgtypes.pyx":4981
 *                 self.y = (m[0,1]+m[1,0])/s
 *                 self.z = (m[0,2]+m[2,0])/s
 *                 self.w = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *             elif ad2>=ad1 and ad2>=ad3:
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__36); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__37); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->w = __pyx_t_2;
      goto __pyx_L4;
    }

    /* "cgtypes.pyx":4982
 *                 self.z = (m[0,2]+m[2,0])/s
 *                 self.w = (m[1,2]+m[2,1])/s
 *             elif ad2>=ad1 and ad2>=ad3:             # <<<<<<<<<<<<<<
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 *                 self.x = (m[0,1]+m[1,0])/s
 */
    __pyx_t_6 = ((__pyx_v_ad2 >= __pyx_v_ad1) != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = ((__pyx_v_ad2 >= __pyx_v_ad3) != 0);
    __pyx_t_3 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "cgtypes.pyx":4983
 *                 self.w = (m[1,2]+m[2,1])/s
 *             elif ad2>=ad1 and ad2>=ad3:
 *                 s = sqrt(1.0+d2-d1-d3)*2.0             # <<<<<<<<<<<<<<
 *                 self.x = (m[0,1]+m[1,0])/s
 *                 self.y = 0.5/s
 */
      __pyx_v_s = (sqrt((((1.0 + __pyx_v_d2) - __pyx_v_d1) - __pyx_v_d3)) * 2.0);

      /* "cgtypes.pyx":4984
 *             elif ad2>=ad1 and ad2>=ad3:
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 *                 self.x = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__38); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__39); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->x = __pyx_t_2;

      /* "cgtypes.pyx":4985
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 *                 self.x = (m[0,1]+m[1,0])/s
 *                 self.y = 0.5/s             # <<<<<<<<<<<<<<
 *                 self.z = (m[1,2]+m[2,1])/s
 *                 self.w = (m[0,2]+m[2,0])/s
 */
      if (unlikely(__pyx_v_s == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_self->y = (0.5 / __pyx_v_s);

      /* "cgtypes.pyx":4986
 *                 self.x = (m[0,1]+m[1,0])/s
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *                 self.w = (m[0,2]+m[2,0])/s
 *             else:
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__40); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__41); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->z = __pyx_t_2;

      /* "cgtypes.pyx":4987
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s
 *                 self.w = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *             else:
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__42); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__43); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->w = __pyx_t_2;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "cgtypes.pyx":4989
 *                 self.w = (m[0,2]+m[2,0])/s
 *             else:
 *                 s = sqrt(1.0+d3-d1-d2)*2.0             # <<<<<<<<<<<<<<
 *                 self.x = (m[0,2]+m[2,0])/s
 *                 self.y = (m[1,2]+m[2,1])/s
 */
      __pyx_v_s = (sqrt((((1.0 + __pyx_v_d3) - __pyx_v_d1) - __pyx_v_d2)) * 2.0);

      /* "cgtypes.pyx":4990
 *             else:
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 *                 self.x = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *                 self.y = (m[1,2]+m[2,1])/s
 *                 self.z = 0.5/s
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__44); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__45); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->x = __pyx_t_2;

      /* "cgtypes.pyx":4991
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 *                 self.x = (m[0,2]+m[2,0])/s
 *                 self.y = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *                 self.z = 0.5/s
 *                 self.w = (m[0,1]+m[1,0])/s
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__46); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__47); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->y = __pyx_t_2;

      /* "cgtypes.pyx":4992
 *                 self.x = (m[0,2]+m[2,0])/s
 *                 self.y = (m[1,2]+m[2,1])/s
 *                 self.z = 0.5/s             # <<<<<<<<<<<<<<
 *                 self.w = (m[0,1]+m[1,0])/s
 * 
 */
      if (unlikely(__pyx_v_s == 0)) {
        #ifdef WITH_THREAD
        PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
        #endif
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        #ifdef WITH_THREAD
        PyGILState_Release(__pyx_gilstate_save);
        #endif
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_self->z = (0.5 / __pyx_v_s);

      /* "cgtypes.pyx":4993
 *                 self.y = (m[1,2]+m[2,1])/s
 *                 self.z = 0.5/s
 *                 self.w = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 * 
 *         return self
 */
      __pyx_t_1 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__48); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_m, __pyx_tuple__49); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_s); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_self->w = __pyx_t_2;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "cgtypes.pyx":4995
 *                 self.w = (m[0,1]+m[1,0])/s
 * 
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def dot(self, quat b):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  /* "cgtypes.pyx":4958
 *         return res
 * 
 *     def fromMat(self, m):             # <<<<<<<<<<<<<<
 *         """Initialize self from either a mat3 or mat4 and returns self."""
 *         cdef double d1,d2,d3,ad1,ad2,ad3,t,s
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cgtypes.quat.fromMat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":4997
 *         return self
 * 
 *     def dot(self, quat b):             # <<<<<<<<<<<<<<
 *         """Return the dot product of self and b."""
 *         return self.w*b.w + self.x*b.x + self.y*b.y + self.z*b.z
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_55dot(PyObject *__pyx_v_self, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_7cgtypes_4quat_54dot[] = "Return the dot product of self and b.";
static PyObject *__pyx_pw_7cgtypes_4quat_55dot(PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dot (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_quat, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4quat_54dot(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self), ((struct __pyx_obj_7cgtypes_quat *)__pyx_v_b));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_54dot(struct __pyx_obj_7cgtypes_quat *__pyx_v_self, struct __pyx_obj_7cgtypes_quat *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("dot", 0);

  /* "cgtypes.pyx":4999
 *     def dot(self, quat b):
 *         """Return the dot product of self and b."""
 *         return self.w*b.w + self.x*b.x + self.y*b.y + self.z*b.z             # <<<<<<<<<<<<<<
 * 
 *     def log(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((((__pyx_v_self->w * __pyx_v_b->w) + (__pyx_v_self->x * __pyx_v_b->x)) + (__pyx_v_self->y * __pyx_v_b->y)) + (__pyx_v_self->z * __pyx_v_b->z))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4999; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":4997
 *         return self
 * 
 *     def dot(self, quat b):             # <<<<<<<<<<<<<<
 *         """Return the dot product of self and b."""
 *         return self.w*b.w + self.x*b.x + self.y*b.y + self.z*b.z
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5001
 *         return self.w*b.w + self.x*b.x + self.y*b.y + self.z*b.z
 * 
 *     def log(self):             # <<<<<<<<<<<<<<
 *         """Return the natural logarithm of self."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_57log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_56log[] = "Return the natural logarithm of self.";
static PyObject *__pyx_pw_7cgtypes_4quat_57log(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_56log(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_56log(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  double __pyx_v_b;
  double __pyx_v_t;
  double __pyx_v_f;
  double __pyx_v_ct;
  double __pyx_v_r;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log", 0);

  /* "cgtypes.pyx":5007
 *         cdef quat res
 * 
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)             # <<<<<<<<<<<<<<
 *         res = quat()
 *         if fabs(b)<=eps:
 */
  __pyx_v_b = sqrt((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)));

  /* "cgtypes.pyx":5008
 * 
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         res = quat()             # <<<<<<<<<<<<<<
 *         if fabs(b)<=eps:
 *             res.x = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":5009
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         res = quat()
 *         if fabs(b)<=eps:             # <<<<<<<<<<<<<<
 *             res.x = 0.0
 *             res.y = 0.0
 */
  __pyx_t_2 = ((fabs(__pyx_v_b) <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":5010
 *         res = quat()
 *         if fabs(b)<=eps:
 *             res.x = 0.0             # <<<<<<<<<<<<<<
 *             res.y = 0.0
 *             res.z = 0.0
 */
    __pyx_v_res->x = 0.0;

    /* "cgtypes.pyx":5011
 *         if fabs(b)<=eps:
 *             res.x = 0.0
 *             res.y = 0.0             # <<<<<<<<<<<<<<
 *             res.z = 0.0
 *             if self.w<=eps:
 */
    __pyx_v_res->y = 0.0;

    /* "cgtypes.pyx":5012
 *             res.x = 0.0
 *             res.y = 0.0
 *             res.z = 0.0             # <<<<<<<<<<<<<<
 *             if self.w<=eps:
 *                 raise ValueError, "math domain error"
 */
    __pyx_v_res->z = 0.0;

    /* "cgtypes.pyx":5013
 *             res.y = 0.0
 *             res.z = 0.0
 *             if self.w<=eps:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "math domain error"
 *             res.w = log(self.w)
 */
    __pyx_t_2 = ((__pyx_v_self->w <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":5014
 *             res.z = 0.0
 *             if self.w<=eps:
 *                 raise ValueError, "math domain error"             # <<<<<<<<<<<<<<
 *             res.w = log(self.w)
 *         else:
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_math_domain_error, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":5015
 *             if self.w<=eps:
 *                 raise ValueError, "math domain error"
 *             res.w = log(self.w)             # <<<<<<<<<<<<<<
 *         else:
 *             t = atan2(b, self.w)
 */
    __pyx_v_res->w = log(__pyx_v_self->w);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":5017
 *             res.w = log(self.w)
 *         else:
 *             t = atan2(b, self.w)             # <<<<<<<<<<<<<<
 *             f = t/b
 *             res.x = f*self.x
 */
    __pyx_v_t = atan2(__pyx_v_b, __pyx_v_self->w);

    /* "cgtypes.pyx":5018
 *         else:
 *             t = atan2(b, self.w)
 *             f = t/b             # <<<<<<<<<<<<<<
 *             res.x = f*self.x
 *             res.y = f*self.y
 */
    if (unlikely(__pyx_v_b == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_f = (__pyx_v_t / __pyx_v_b);

    /* "cgtypes.pyx":5019
 *             t = atan2(b, self.w)
 *             f = t/b
 *             res.x = f*self.x             # <<<<<<<<<<<<<<
 *             res.y = f*self.y
 *             res.z = f*self.z
 */
    __pyx_v_res->x = (__pyx_v_f * __pyx_v_self->x);

    /* "cgtypes.pyx":5020
 *             f = t/b
 *             res.x = f*self.x
 *             res.y = f*self.y             # <<<<<<<<<<<<<<
 *             res.z = f*self.z
 *             ct = cos(t)
 */
    __pyx_v_res->y = (__pyx_v_f * __pyx_v_self->y);

    /* "cgtypes.pyx":5021
 *             res.x = f*self.x
 *             res.y = f*self.y
 *             res.z = f*self.z             # <<<<<<<<<<<<<<
 *             ct = cos(t)
 *             if fabs(ct)<=eps:
 */
    __pyx_v_res->z = (__pyx_v_f * __pyx_v_self->z);

    /* "cgtypes.pyx":5022
 *             res.y = f*self.y
 *             res.z = f*self.z
 *             ct = cos(t)             # <<<<<<<<<<<<<<
 *             if fabs(ct)<=eps:
 *                 raise ValueError, "math domain error"
 */
    __pyx_v_ct = cos(__pyx_v_t);

    /* "cgtypes.pyx":5023
 *             res.z = f*self.z
 *             ct = cos(t)
 *             if fabs(ct)<=eps:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "math domain error"
 *             r = self.w/ct
 */
    __pyx_t_2 = ((fabs(__pyx_v_ct) <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":5024
 *             ct = cos(t)
 *             if fabs(ct)<=eps:
 *                 raise ValueError, "math domain error"             # <<<<<<<<<<<<<<
 *             r = self.w/ct
 *             if r<=eps:
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_math_domain_error, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":5025
 *             if fabs(ct)<=eps:
 *                 raise ValueError, "math domain error"
 *             r = self.w/ct             # <<<<<<<<<<<<<<
 *             if r<=eps:
 *                 raise ValueError, "math domain error"
 */
    if (unlikely(__pyx_v_ct == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_r = (__pyx_v_self->w / __pyx_v_ct);

    /* "cgtypes.pyx":5026
 *                 raise ValueError, "math domain error"
 *             r = self.w/ct
 *             if r<=eps:             # <<<<<<<<<<<<<<
 *                 raise ValueError, "math domain error"
 *             res.w = log(r)
 */
    __pyx_t_2 = ((__pyx_v_r <= __pyx_v_7cgtypes_eps) != 0);
    if (__pyx_t_2) {

      /* "cgtypes.pyx":5027
 *             r = self.w/ct
 *             if r<=eps:
 *                 raise ValueError, "math domain error"             # <<<<<<<<<<<<<<
 *             res.w = log(r)
 * 
 */
      __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_math_domain_error, 0, 0);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "cgtypes.pyx":5028
 *             if r<=eps:
 *                 raise ValueError, "math domain error"
 *             res.w = log(r)             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
    __pyx_v_res->w = log(__pyx_v_r);
  }
  __pyx_L3:;

  /* "cgtypes.pyx":5030
 *             res.w = log(r)
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def exp(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":5001
 *         return self.w*b.w + self.x*b.x + self.y*b.y + self.z*b.z
 * 
 *     def log(self):             # <<<<<<<<<<<<<<
 *         """Return the natural logarithm of self."""
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5032
 *         return res
 * 
 *     def exp(self):             # <<<<<<<<<<<<<<
 *         """Return the exponential of self."""
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_4quat_59exp(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7cgtypes_4quat_58exp[] = "Return the exponential of self.";
static PyObject *__pyx_pw_7cgtypes_4quat_59exp(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exp (wrapper)", 0);
  __pyx_r = __pyx_pf_7cgtypes_4quat_58exp(((struct __pyx_obj_7cgtypes_quat *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4quat_58exp(struct __pyx_obj_7cgtypes_quat *__pyx_v_self) {
  double __pyx_v_b;
  double __pyx_v_f;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  double __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("exp", 0);

  /* "cgtypes.pyx":5038
 *         cdef quat res
 * 
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)             # <<<<<<<<<<<<<<
 *         res = quat()
 *         if fabs(b)<=eps:
 */
  __pyx_v_b = sqrt((((__pyx_v_self->x * __pyx_v_self->x) + (__pyx_v_self->y * __pyx_v_self->y)) + (__pyx_v_self->z * __pyx_v_self->z)));

  /* "cgtypes.pyx":5039
 * 
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         res = quat()             # <<<<<<<<<<<<<<
 *         if fabs(b)<=eps:
 *             res.x = 0.0
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((struct __pyx_obj_7cgtypes_quat *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cgtypes.pyx":5040
 *         b = sqrt(self.x*self.x + self.y*self.y + self.z*self.z)
 *         res = quat()
 *         if fabs(b)<=eps:             # <<<<<<<<<<<<<<
 *             res.x = 0.0
 *             res.y = 0.0
 */
  __pyx_t_2 = ((fabs(__pyx_v_b) <= __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_2) {

    /* "cgtypes.pyx":5041
 *         res = quat()
 *         if fabs(b)<=eps:
 *             res.x = 0.0             # <<<<<<<<<<<<<<
 *             res.y = 0.0
 *             res.z = 0.0
 */
    __pyx_v_res->x = 0.0;

    /* "cgtypes.pyx":5042
 *         if fabs(b)<=eps:
 *             res.x = 0.0
 *             res.y = 0.0             # <<<<<<<<<<<<<<
 *             res.z = 0.0
 *             res.w = exp(self.w)
 */
    __pyx_v_res->y = 0.0;

    /* "cgtypes.pyx":5043
 *             res.x = 0.0
 *             res.y = 0.0
 *             res.z = 0.0             # <<<<<<<<<<<<<<
 *             res.w = exp(self.w)
 *         else:
 */
    __pyx_v_res->z = 0.0;

    /* "cgtypes.pyx":5044
 *             res.y = 0.0
 *             res.z = 0.0
 *             res.w = exp(self.w)             # <<<<<<<<<<<<<<
 *         else:
 *             f = sin(b)/b
 */
    __pyx_v_res->w = exp(__pyx_v_self->w);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "cgtypes.pyx":5046
 *             res.w = exp(self.w)
 *         else:
 *             f = sin(b)/b             # <<<<<<<<<<<<<<
 *             res.x = f*self.x
 *             res.y = f*self.y
 */
    __pyx_t_3 = sin(__pyx_v_b);
    if (unlikely(__pyx_v_b == 0)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_f = (__pyx_t_3 / __pyx_v_b);

    /* "cgtypes.pyx":5047
 *         else:
 *             f = sin(b)/b
 *             res.x = f*self.x             # <<<<<<<<<<<<<<
 *             res.y = f*self.y
 *             res.z = f*self.z
 */
    __pyx_v_res->x = (__pyx_v_f * __pyx_v_self->x);

    /* "cgtypes.pyx":5048
 *             f = sin(b)/b
 *             res.x = f*self.x
 *             res.y = f*self.y             # <<<<<<<<<<<<<<
 *             res.z = f*self.z
 *             res.w = exp(self.w)*cos(b)
 */
    __pyx_v_res->y = (__pyx_v_f * __pyx_v_self->y);

    /* "cgtypes.pyx":5049
 *             res.x = f*self.x
 *             res.y = f*self.y
 *             res.z = f*self.z             # <<<<<<<<<<<<<<
 *             res.w = exp(self.w)*cos(b)
 * 
 */
    __pyx_v_res->z = (__pyx_v_f * __pyx_v_self->z);

    /* "cgtypes.pyx":5050
 *             res.y = f*self.y
 *             res.z = f*self.z
 *             res.w = exp(self.w)*cos(b)             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
    __pyx_v_res->w = (exp(__pyx_v_self->w) * cos(__pyx_v_b));
  }
  __pyx_L3:;

  /* "cgtypes.pyx":5052
 *             res.w = exp(self.w)*cos(b)
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_res));
  __pyx_r = ((PyObject *)__pyx_v_res);
  goto __pyx_L0;

  /* "cgtypes.pyx":5032
 *         return res
 * 
 *     def exp(self):             # <<<<<<<<<<<<<<
 *         """Return the exponential of self."""
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cgtypes.quat.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5055
 * 
 * 
 * def slerp(double t, quat q0, quat q1):             # <<<<<<<<<<<<<<
 *     """Spherical linear interpolation between two quaternions.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_5slerp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_4slerp[] = "Spherical linear interpolation between two quaternions.\n\n    The return value is an interpolation between q0 and q1. For t=0.0\n    the return value equals q0, for t=1.0 it equals q1.\n    q0 and q1 must be unit quaternions.\n    ";
static PyMethodDef __pyx_mdef_7cgtypes_5slerp = {"slerp", (PyCFunction)__pyx_pw_7cgtypes_5slerp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4slerp};
static PyObject *__pyx_pw_7cgtypes_5slerp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_t;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q0 = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_q1 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slerp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_q0,&__pyx_n_s_q1,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slerp", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_q1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slerp", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slerp") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_q0 = ((struct __pyx_obj_7cgtypes_quat *)values[1]);
    __pyx_v_q1 = ((struct __pyx_obj_7cgtypes_quat *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("slerp", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.slerp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q0), __pyx_ptype_7cgtypes_quat, 1, "q0", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q1), __pyx_ptype_7cgtypes_quat, 1, "q1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_4slerp(__pyx_self, __pyx_v_t, __pyx_v_q0, __pyx_v_q1);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_4slerp(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, struct __pyx_obj_7cgtypes_quat *__pyx_v_q0, struct __pyx_obj_7cgtypes_quat *__pyx_v_q1) {
  double __pyx_v_o;
  double __pyx_v_so;
  double __pyx_v_a;
  double __pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slerp", 0);

  /* "cgtypes.pyx":5064
 *     cdef double o,so,a,b
 * 
 *     o = acos(q0.dot(q1))             # <<<<<<<<<<<<<<
 *     so = sin(o)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_q0), __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_q1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(((PyObject *)__pyx_v_q1));
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_q1));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_q1));
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_o = acos(__pyx_t_5);

  /* "cgtypes.pyx":5065
 * 
 *     o = acos(q0.dot(q1))
 *     so = sin(o)             # <<<<<<<<<<<<<<
 * 
 *     if (fabs(so)<eps):
 */
  __pyx_v_so = sin(__pyx_v_o);

  /* "cgtypes.pyx":5067
 *     so = sin(o)
 * 
 *     if (fabs(so)<eps):             # <<<<<<<<<<<<<<
 *         return quat(q0)
 * 
 */
  __pyx_t_6 = ((fabs(__pyx_v_so) < __pyx_v_7cgtypes_eps) != 0);
  if (__pyx_t_6) {

    /* "cgtypes.pyx":5068
 * 
 *     if (fabs(so)<eps):
 *         return quat(q0)             # <<<<<<<<<<<<<<
 * 
 *     a = sin(o*(1.0-t)) / so
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_v_q0));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q0));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_q0));
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "cgtypes.pyx":5070
 *         return quat(q0)
 * 
 *     a = sin(o*(1.0-t)) / so             # <<<<<<<<<<<<<<
 *     b = sin(o*t) / so
 *     return q0*a + q1*b
 */
  __pyx_t_5 = sin((__pyx_v_o * (1.0 - __pyx_v_t)));
  if (unlikely(__pyx_v_so == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_a = (__pyx_t_5 / __pyx_v_so);

  /* "cgtypes.pyx":5071
 * 
 *     a = sin(o*(1.0-t)) / so
 *     b = sin(o*t) / so             # <<<<<<<<<<<<<<
 *     return q0*a + q1*b
 * 
 */
  __pyx_t_5 = sin((__pyx_v_o * __pyx_v_t));
  if (unlikely(__pyx_v_so == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_b = (__pyx_t_5 / __pyx_v_so);

  /* "cgtypes.pyx":5072
 *     a = sin(o*(1.0-t)) / so
 *     b = sin(o*t) / so
 *     return q0*a + q1*b             # <<<<<<<<<<<<<<
 * 
 * def squad(double t, quat a, quat b, quat c, quat d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_a); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_q0), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_q1), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5055
 * 
 * 
 * def slerp(double t, quat q0, quat q1):             # <<<<<<<<<<<<<<
 *     """Spherical linear interpolation between two quaternions.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cgtypes.slerp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5074
 *     return q0*a + q1*b
 * 
 * def squad(double t, quat a, quat b, quat c, quat d):             # <<<<<<<<<<<<<<
 *     """Spherical cubic interpolation."""
 *     return slerp(2*t*(1.0-t), slerp(t,a,d), slerp(t,b,c))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_7squad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7cgtypes_6squad[] = "Spherical cubic interpolation.";
static PyMethodDef __pyx_mdef_7cgtypes_7squad = {"squad", (PyCFunction)__pyx_pw_7cgtypes_7squad, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_6squad};
static PyObject *__pyx_pw_7cgtypes_7squad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_t;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_a = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_b = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_c = 0;
  struct __pyx_obj_7cgtypes_quat *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("squad (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_c,&__pyx_n_s_d,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("squad", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("squad", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("squad", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("squad", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "squad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_a = ((struct __pyx_obj_7cgtypes_quat *)values[1]);
    __pyx_v_b = ((struct __pyx_obj_7cgtypes_quat *)values[2]);
    __pyx_v_c = ((struct __pyx_obj_7cgtypes_quat *)values[3]);
    __pyx_v_d = ((struct __pyx_obj_7cgtypes_quat *)values[4]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("squad", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes.squad", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_7cgtypes_quat, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_7cgtypes_quat, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_c), __pyx_ptype_7cgtypes_quat, 1, "c", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_d), __pyx_ptype_7cgtypes_quat, 1, "d", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7cgtypes_6squad(__pyx_self, __pyx_v_t, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_6squad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, struct __pyx_obj_7cgtypes_quat *__pyx_v_a, struct __pyx_obj_7cgtypes_quat *__pyx_v_b, struct __pyx_obj_7cgtypes_quat *__pyx_v_c, struct __pyx_obj_7cgtypes_quat *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("squad", 0);

  /* "cgtypes.pyx":5076
 * def squad(double t, quat a, quat b, quat c, quat d):
 *     """Spherical cubic interpolation."""
 *     return slerp(2*t*(1.0-t), slerp(t,a,d), slerp(t,b,c))             # <<<<<<<<<<<<<<
 * 
 * ######################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_slerp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(((2.0 * __pyx_v_t) * (1.0 - __pyx_v_t))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_slerp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (__pyx_t_7) {
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_a));
  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, ((PyObject *)__pyx_v_a));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_a));
  __Pyx_INCREF(((PyObject *)__pyx_v_d));
  PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, ((PyObject *)__pyx_v_d));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_d));
  __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_slerp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_7) {
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_b));
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, ((PyObject *)__pyx_v_b));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_b));
  __Pyx_INCREF(((PyObject *)__pyx_v_c));
  PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, ((PyObject *)__pyx_v_c));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_c));
  __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_9) {
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5074
 *     return q0*a + q1*b
 * 
 * def squad(double t, quat a, quat b, quat c, quat d):             # <<<<<<<<<<<<<<
 *     """Spherical cubic interpolation."""
 *     return slerp(2*t*(1.0-t), slerp(t,a,d), slerp(t,b,c))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cgtypes.squad", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5086
 *     import copy_reg
 * 
 * def _vec3construct(x,y,z):             # <<<<<<<<<<<<<<
 *     return vec3(x,y,z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_9_vec3construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7cgtypes_9_vec3construct = {"_vec3construct", (PyCFunction)__pyx_pw_7cgtypes_9_vec3construct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7cgtypes_9_vec3construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_vec3construct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_vec3construct", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_vec3construct", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_vec3construct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_vec3construct", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes._vec3construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_8_vec3construct(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_8_vec3construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_vec3construct", 0);

  /* "cgtypes.pyx":5087
 * 
 * def _vec3construct(x,y,z):
 *     return vec3(x,y,z)             # <<<<<<<<<<<<<<
 * 
 * def _vec4construct(x,y,z,w):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_z);
  __Pyx_GIVEREF(__pyx_v_z);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5086
 *     import copy_reg
 * 
 * def _vec3construct(x,y,z):             # <<<<<<<<<<<<<<
 *     return vec3(x,y,z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes._vec3construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5089
 *     return vec3(x,y,z)
 * 
 * def _vec4construct(x,y,z,w):             # <<<<<<<<<<<<<<
 *     return vec4(x,y,z,w)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_11_vec4construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7cgtypes_11_vec4construct = {"_vec4construct", (PyCFunction)__pyx_pw_7cgtypes_11_vec4construct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7cgtypes_11_vec4construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_w = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_vec4construct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,&__pyx_n_s_w,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_vec4construct", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_vec4construct", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_vec4construct", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_vec4construct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
    __pyx_v_w = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_vec4construct", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes._vec4construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_10_vec4construct(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_w);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_10_vec4construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z, PyObject *__pyx_v_w) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_vec4construct", 0);

  /* "cgtypes.pyx":5090
 * 
 * def _vec4construct(x,y,z,w):
 *     return vec4(x,y,z,w)             # <<<<<<<<<<<<<<
 * 
 * def _mat3construct(b1,b2,b3):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_z);
  __Pyx_GIVEREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_vec4)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5089
 *     return vec3(x,y,z)
 * 
 * def _vec4construct(x,y,z,w):             # <<<<<<<<<<<<<<
 *     return vec4(x,y,z,w)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes._vec4construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5092
 *     return vec4(x,y,z,w)
 * 
 * def _mat3construct(b1,b2,b3):             # <<<<<<<<<<<<<<
 *     return mat3(b1,b2,b3)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_13_mat3construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7cgtypes_13_mat3construct = {"_mat3construct", (PyCFunction)__pyx_pw_7cgtypes_13_mat3construct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7cgtypes_13_mat3construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b1 = 0;
  PyObject *__pyx_v_b2 = 0;
  PyObject *__pyx_v_b3 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_mat3construct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b1,&__pyx_n_s_b2,&__pyx_n_s_b3,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mat3construct", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b3)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mat3construct", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mat3construct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_b1 = values[0];
    __pyx_v_b2 = values[1];
    __pyx_v_b3 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_mat3construct", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes._mat3construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_12_mat3construct(__pyx_self, __pyx_v_b1, __pyx_v_b2, __pyx_v_b3);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_12_mat3construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_b1, PyObject *__pyx_v_b2, PyObject *__pyx_v_b3) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_mat3construct", 0);

  /* "cgtypes.pyx":5093
 * 
 * def _mat3construct(b1,b2,b3):
 *     return mat3(b1,b2,b3)             # <<<<<<<<<<<<<<
 * 
 * def _mat4construct(b1,b2,b3,b4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_b1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_b1);
  __Pyx_GIVEREF(__pyx_v_b1);
  __Pyx_INCREF(__pyx_v_b2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_b2);
  __Pyx_GIVEREF(__pyx_v_b2);
  __Pyx_INCREF(__pyx_v_b3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_b3);
  __Pyx_GIVEREF(__pyx_v_b3);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat3)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5092
 *     return vec4(x,y,z,w)
 * 
 * def _mat3construct(b1,b2,b3):             # <<<<<<<<<<<<<<
 *     return mat3(b1,b2,b3)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes._mat3construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5095
 *     return mat3(b1,b2,b3)
 * 
 * def _mat4construct(b1,b2,b3,b4):             # <<<<<<<<<<<<<<
 *     return mat4(b1,b2,b3,b4)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_15_mat4construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7cgtypes_15_mat4construct = {"_mat4construct", (PyCFunction)__pyx_pw_7cgtypes_15_mat4construct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7cgtypes_15_mat4construct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b1 = 0;
  PyObject *__pyx_v_b2 = 0;
  PyObject *__pyx_v_b3 = 0;
  PyObject *__pyx_v_b4 = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_mat4construct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b1,&__pyx_n_s_b2,&__pyx_n_s_b3,&__pyx_n_s_b4,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mat4construct", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b3)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mat4construct", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b4)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_mat4construct", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mat4construct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_b1 = values[0];
    __pyx_v_b2 = values[1];
    __pyx_v_b3 = values[2];
    __pyx_v_b4 = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_mat4construct", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes._mat4construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_14_mat4construct(__pyx_self, __pyx_v_b1, __pyx_v_b2, __pyx_v_b3, __pyx_v_b4);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_14_mat4construct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_b1, PyObject *__pyx_v_b2, PyObject *__pyx_v_b3, PyObject *__pyx_v_b4) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_mat4construct", 0);

  /* "cgtypes.pyx":5096
 * 
 * def _mat4construct(b1,b2,b3,b4):
 *     return mat4(b1,b2,b3,b4)             # <<<<<<<<<<<<<<
 * 
 * def _quatconstruct(w,x,y,z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_b1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_b1);
  __Pyx_GIVEREF(__pyx_v_b1);
  __Pyx_INCREF(__pyx_v_b2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_b2);
  __Pyx_GIVEREF(__pyx_v_b2);
  __Pyx_INCREF(__pyx_v_b3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_b3);
  __Pyx_GIVEREF(__pyx_v_b3);
  __Pyx_INCREF(__pyx_v_b4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_b4);
  __Pyx_GIVEREF(__pyx_v_b4);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_mat4)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5095
 *     return mat3(b1,b2,b3)
 * 
 * def _mat4construct(b1,b2,b3,b4):             # <<<<<<<<<<<<<<
 *     return mat4(b1,b2,b3,b4)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes._mat4construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cgtypes.pyx":5098
 *     return mat4(b1,b2,b3,b4)
 * 
 * def _quatconstruct(w,x,y,z):             # <<<<<<<<<<<<<<
 *     return quat(w,x,y,z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7cgtypes_17_quatconstruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7cgtypes_17_quatconstruct = {"_quatconstruct", (PyCFunction)__pyx_pw_7cgtypes_17_quatconstruct, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7cgtypes_17_quatconstruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_quatconstruct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quatconstruct", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quatconstruct", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quatconstruct", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_quatconstruct") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_w = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    __pyx_v_z = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_quatconstruct", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("cgtypes._quatconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7cgtypes_16_quatconstruct(__pyx_self, __pyx_v_w, __pyx_v_x, __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7cgtypes_16_quatconstruct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_quatconstruct", 0);

  /* "cgtypes.pyx":5099
 * 
 * def _quatconstruct(w,x,y,z):
 *     return quat(w,x,y,z)             # <<<<<<<<<<<<<<
 * 
 * copy_reg.constructor(_vec3construct)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_z);
  __Pyx_GIVEREF(__pyx_v_z);
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cgtypes_quat)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cgtypes.pyx":5098
 *     return mat4(b1,b2,b3,b4)
 * 
 * def _quatconstruct(w,x,y,z):             # <<<<<<<<<<<<<<
 *     return quat(w,x,y,z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cgtypes._quatconstruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_7cgtypes_vec3(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7cgtypes_4vec3_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_vec3(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_7cgtypes_vec3(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_7cgtypes_vec3(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4vec3_47__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_7cgtypes_vec3(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_7cgtypes_4vec3_39__getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_7cgtypes_vec3(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4vec3_41__setattr__(o, n, v);
  }
  else {
    return PyObject_GenericSetAttr(o, n, 0);
  }
}

static PyMethodDef __pyx_methods_7cgtypes_vec3[] = {
  {"__reduce__", (PyCFunction)__pyx_pw_7cgtypes_4vec3_3__reduce__, METH_NOARGS, 0},
  {"__getattr__", (PyCFunction)__pyx_pw_7cgtypes_4vec3_39__getattr__, METH_O|METH_COEXIST, 0},
  {"cross", (PyCFunction)__pyx_pw_7cgtypes_4vec3_49cross, METH_O, __pyx_doc_7cgtypes_4vec3_48cross},
  {"length", (PyCFunction)__pyx_pw_7cgtypes_4vec3_51length, METH_NOARGS, __pyx_doc_7cgtypes_4vec3_50length},
  {"normalize", (PyCFunction)__pyx_pw_7cgtypes_4vec3_53normalize, METH_NOARGS, __pyx_doc_7cgtypes_4vec3_52normalize},
  {"angle", (PyCFunction)__pyx_pw_7cgtypes_4vec3_55angle, METH_O, __pyx_doc_7cgtypes_4vec3_54angle},
  {"reflect", (PyCFunction)__pyx_pw_7cgtypes_4vec3_57reflect, METH_O, __pyx_doc_7cgtypes_4vec3_56reflect},
  {"refract", (PyCFunction)__pyx_pw_7cgtypes_4vec3_59refract, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4vec3_58refract},
  {"ortho", (PyCFunction)__pyx_pw_7cgtypes_4vec3_61ortho, METH_NOARGS, __pyx_doc_7cgtypes_4vec3_60ortho},
  {"fadd", (PyCFunction)__pyx_pw_7cgtypes_4vec3_63fadd, METH_VARARGS|METH_KEYWORDS, 0},
  {"fnormalize", (PyCFunction)__pyx_pw_7cgtypes_4vec3_65fnormalize, METH_O, __pyx_doc_7cgtypes_4vec3_64fnormalize},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_vec3 = {
  __pyx_pw_7cgtypes_4vec3_13__add__, /*nb_add*/
  __pyx_pw_7cgtypes_4vec3_15__sub__, /*nb_subtract*/
  __pyx_pw_7cgtypes_4vec3_17__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4vec3_19__div__, /*nb_divide*/
  #endif
  __pyx_pw_7cgtypes_4vec3_21__mod__, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_7cgtypes_4vec3_23__neg__, /*nb_negative*/
  __pyx_pw_7cgtypes_4vec3_25__pos__, /*nb_positive*/
  __pyx_pw_7cgtypes_4vec3_37__abs__, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pw_7cgtypes_4vec3_27__iadd__, /*nb_inplace_add*/
  __pyx_pw_7cgtypes_4vec3_29__isub__, /*nb_inplace_subtract*/
  __pyx_pw_7cgtypes_4vec3_31__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4vec3_33__idiv__, /*nb_inplace_divide*/
  #endif
  __pyx_pw_7cgtypes_4vec3_35__imod__, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_vec3 = {
  __pyx_pw_7cgtypes_4vec3_43__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7cgtypes_vec3, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_vec3 = {
  __pyx_pw_7cgtypes_4vec3_43__len__, /*mp_length*/
  __pyx_pw_7cgtypes_4vec3_45__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_7cgtypes_vec3, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7cgtypes_vec3 = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.vec3", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_vec3), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_vec3, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_7cgtypes_4vec3_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_vec3, /*tp_as_number*/
  &__pyx_tp_as_sequence_vec3, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_vec3, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_7cgtypes_4vec3_7__str__, /*tp_str*/
  __pyx_tp_getattro_7cgtypes_vec3, /*tp_getattro*/
  __pyx_tp_setattro_7cgtypes_vec3, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Three-dimensional vector.\n\n    This class can be used to represent points, vectors, normals\n    or even colors. The usual vector operations are available.\n\n    Comparisons are done within an epsilon environment.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_7cgtypes_4vec3_11__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_4vec3_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7cgtypes_vec3, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_vec3, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_vec4(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7cgtypes_4vec4_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_vec4(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_7cgtypes_vec4(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_7cgtypes_vec4(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4vec4_47__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_7cgtypes_vec4(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_7cgtypes_4vec4_39__getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_7cgtypes_vec4(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4vec4_41__setattr__(o, n, v);
  }
  else {
    return PyObject_GenericSetAttr(o, n, 0);
  }
}

static PyMethodDef __pyx_methods_7cgtypes_vec4[] = {
  {"__reduce__", (PyCFunction)__pyx_pw_7cgtypes_4vec4_3__reduce__, METH_NOARGS, 0},
  {"__getattr__", (PyCFunction)__pyx_pw_7cgtypes_4vec4_39__getattr__, METH_O|METH_COEXIST, 0},
  {"length", (PyCFunction)__pyx_pw_7cgtypes_4vec4_49length, METH_NOARGS, __pyx_doc_7cgtypes_4vec4_48length},
  {"normalize", (PyCFunction)__pyx_pw_7cgtypes_4vec4_51normalize, METH_NOARGS, __pyx_doc_7cgtypes_4vec4_50normalize},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_vec4 = {
  __pyx_pw_7cgtypes_4vec4_13__add__, /*nb_add*/
  __pyx_pw_7cgtypes_4vec4_15__sub__, /*nb_subtract*/
  __pyx_pw_7cgtypes_4vec4_17__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4vec4_19__div__, /*nb_divide*/
  #endif
  __pyx_pw_7cgtypes_4vec4_21__mod__, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_7cgtypes_4vec4_23__neg__, /*nb_negative*/
  __pyx_pw_7cgtypes_4vec4_25__pos__, /*nb_positive*/
  __pyx_pw_7cgtypes_4vec4_37__abs__, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pw_7cgtypes_4vec4_27__iadd__, /*nb_inplace_add*/
  __pyx_pw_7cgtypes_4vec4_29__isub__, /*nb_inplace_subtract*/
  __pyx_pw_7cgtypes_4vec4_31__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4vec4_33__idiv__, /*nb_inplace_divide*/
  #endif
  __pyx_pw_7cgtypes_4vec4_35__imod__, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_vec4 = {
  __pyx_pw_7cgtypes_4vec4_43__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7cgtypes_vec4, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_vec4 = {
  __pyx_pw_7cgtypes_4vec4_43__len__, /*mp_length*/
  __pyx_pw_7cgtypes_4vec4_45__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_7cgtypes_vec4, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7cgtypes_vec4 = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.vec4", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_vec4), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_vec4, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_7cgtypes_4vec4_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_vec4, /*tp_as_number*/
  &__pyx_tp_as_sequence_vec4, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_vec4, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_7cgtypes_4vec4_7__str__, /*tp_str*/
  __pyx_tp_getattro_7cgtypes_vec4, /*tp_getattro*/
  __pyx_tp_setattro_7cgtypes_vec4, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Four-dimensional vector.\n\n    This class represents a 4D vector.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_7cgtypes_4vec4_11__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_4vec4_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7cgtypes_vec4, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_vec4, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_mat3(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7cgtypes_4mat3_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_mat3(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_7cgtypes_mat3(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_7cgtypes_mat3(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4mat3_41__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_7cgtypes_mat3[] = {
  {"__reduce__", (PyCFunction)__pyx_pw_7cgtypes_4mat3_3__reduce__, METH_NOARGS, 0},
  {"getRow", (PyCFunction)__pyx_pw_7cgtypes_4mat3_43getRow, METH_O, __pyx_doc_7cgtypes_4mat3_42getRow},
  {"setRow", (PyCFunction)__pyx_pw_7cgtypes_4mat3_45setRow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat3_44setRow},
  {"getColumn", (PyCFunction)__pyx_pw_7cgtypes_4mat3_47getColumn, METH_O, __pyx_doc_7cgtypes_4mat3_46getColumn},
  {"setColumn", (PyCFunction)__pyx_pw_7cgtypes_4mat3_49setColumn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat3_48setColumn},
  {"toList", (PyCFunction)__pyx_pw_7cgtypes_4mat3_51toList, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat3_50toList},
  {"identity", (PyCFunction)__pyx_pw_7cgtypes_4mat3_53identity, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_52identity},
  {"transpose", (PyCFunction)__pyx_pw_7cgtypes_4mat3_55transpose, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_54transpose},
  {"determinant", (PyCFunction)__pyx_pw_7cgtypes_4mat3_57determinant, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_56determinant},
  {"inverse", (PyCFunction)__pyx_pw_7cgtypes_4mat3_59inverse, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_58inverse},
  {"scaling", (PyCFunction)__pyx_pw_7cgtypes_4mat3_61scaling, METH_O, __pyx_doc_7cgtypes_4mat3_60scaling},
  {"rotation", (PyCFunction)__pyx_pw_7cgtypes_4mat3_63rotation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat3_62rotation},
  {"scale", (PyCFunction)__pyx_pw_7cgtypes_4mat3_65scale, METH_O, __pyx_doc_7cgtypes_4mat3_64scale},
  {"rotate", (PyCFunction)__pyx_pw_7cgtypes_4mat3_67rotate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat3_66rotate},
  {"ortho", (PyCFunction)__pyx_pw_7cgtypes_4mat3_69ortho, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_68ortho},
  {"decompose", (PyCFunction)__pyx_pw_7cgtypes_4mat3_71decompose, METH_NOARGS, __pyx_doc_7cgtypes_4mat3_70decompose},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_mat3 = {
  __pyx_pw_7cgtypes_4mat3_13__add__, /*nb_add*/
  __pyx_pw_7cgtypes_4mat3_15__sub__, /*nb_subtract*/
  __pyx_pw_7cgtypes_4mat3_17__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4mat3_19__div__, /*nb_divide*/
  #endif
  __pyx_pw_7cgtypes_4mat3_21__mod__, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_7cgtypes_4mat3_23__neg__, /*nb_negative*/
  __pyx_pw_7cgtypes_4mat3_25__pos__, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pw_7cgtypes_4mat3_27__iadd__, /*nb_inplace_add*/
  __pyx_pw_7cgtypes_4mat3_29__isub__, /*nb_inplace_subtract*/
  __pyx_pw_7cgtypes_4mat3_31__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4mat3_33__idiv__, /*nb_inplace_divide*/
  #endif
  __pyx_pw_7cgtypes_4mat3_35__imod__, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_mat3 = {
  __pyx_pw_7cgtypes_4mat3_37__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7cgtypes_mat3, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_mat3 = {
  __pyx_pw_7cgtypes_4mat3_37__len__, /*mp_length*/
  __pyx_pw_7cgtypes_4mat3_39__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_7cgtypes_mat3, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7cgtypes_mat3 = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.mat3", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_mat3), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_mat3, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_7cgtypes_4mat3_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_mat3, /*tp_as_number*/
  &__pyx_tp_as_sequence_mat3, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_mat3, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_7cgtypes_4mat3_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_7cgtypes_4mat3_11__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_4mat3_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7cgtypes_mat3, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_mat3, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_mat4(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7cgtypes_4mat4_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_mat4(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_7cgtypes_mat4(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_7cgtypes_mat4(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4mat4_41__setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_7cgtypes_mat4[] = {
  {"__reduce__", (PyCFunction)__pyx_pw_7cgtypes_4mat4_3__reduce__, METH_NOARGS, 0},
  {"getRow", (PyCFunction)__pyx_pw_7cgtypes_4mat4_43getRow, METH_O, __pyx_doc_7cgtypes_4mat4_42getRow},
  {"setRow", (PyCFunction)__pyx_pw_7cgtypes_4mat4_45setRow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_44setRow},
  {"getColumn", (PyCFunction)__pyx_pw_7cgtypes_4mat4_47getColumn, METH_O, __pyx_doc_7cgtypes_4mat4_46getColumn},
  {"setColumn", (PyCFunction)__pyx_pw_7cgtypes_4mat4_49setColumn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_48setColumn},
  {"toList", (PyCFunction)__pyx_pw_7cgtypes_4mat4_51toList, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_50toList},
  {"identity", (PyCFunction)__pyx_pw_7cgtypes_4mat4_53identity, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_52identity},
  {"transpose", (PyCFunction)__pyx_pw_7cgtypes_4mat4_55transpose, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_54transpose},
  {"determinant", (PyCFunction)__pyx_pw_7cgtypes_4mat4_57determinant, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_56determinant},
  {"_submat", (PyCFunction)__pyx_pw_7cgtypes_4mat4_59_submat, METH_VARARGS|METH_KEYWORDS, 0},
  {"inverse", (PyCFunction)__pyx_pw_7cgtypes_4mat4_61inverse, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_60inverse},
  {"translation", (PyCFunction)__pyx_pw_7cgtypes_4mat4_63translation, METH_O, __pyx_doc_7cgtypes_4mat4_62translation},
  {"scaling", (PyCFunction)__pyx_pw_7cgtypes_4mat4_65scaling, METH_O, __pyx_doc_7cgtypes_4mat4_64scaling},
  {"rotation", (PyCFunction)__pyx_pw_7cgtypes_4mat4_67rotation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_66rotation},
  {"translate", (PyCFunction)__pyx_pw_7cgtypes_4mat4_69translate, METH_O, __pyx_doc_7cgtypes_4mat4_68translate},
  {"scale", (PyCFunction)__pyx_pw_7cgtypes_4mat4_71scale, METH_O, __pyx_doc_7cgtypes_4mat4_70scale},
  {"rotate", (PyCFunction)__pyx_pw_7cgtypes_4mat4_73rotate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_72rotate},
  {"orthographic", (PyCFunction)__pyx_pw_7cgtypes_4mat4_75orthographic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_74orthographic},
  {"frustum", (PyCFunction)__pyx_pw_7cgtypes_4mat4_77frustum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_76frustum},
  {"perspective", (PyCFunction)__pyx_pw_7cgtypes_4mat4_79perspective, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_78perspective},
  {"lookAt", (PyCFunction)__pyx_pw_7cgtypes_4mat4_81lookAt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4mat4_80lookAt},
  {"ortho", (PyCFunction)__pyx_pw_7cgtypes_4mat4_83ortho, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_82ortho},
  {"decompose", (PyCFunction)__pyx_pw_7cgtypes_4mat4_85decompose, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_84decompose},
  {"getMat3", (PyCFunction)__pyx_pw_7cgtypes_4mat4_87getMat3, METH_NOARGS, __pyx_doc_7cgtypes_4mat4_86getMat3},
  {"setMat3", (PyCFunction)__pyx_pw_7cgtypes_4mat4_89setMat3, METH_O, __pyx_doc_7cgtypes_4mat4_88setMat3},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_mat4 = {
  __pyx_pw_7cgtypes_4mat4_13__add__, /*nb_add*/
  __pyx_pw_7cgtypes_4mat4_15__sub__, /*nb_subtract*/
  __pyx_pw_7cgtypes_4mat4_17__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4mat4_19__div__, /*nb_divide*/
  #endif
  __pyx_pw_7cgtypes_4mat4_21__mod__, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  __pyx_pw_7cgtypes_4mat4_23__neg__, /*nb_negative*/
  __pyx_pw_7cgtypes_4mat4_25__pos__, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pw_7cgtypes_4mat4_27__iadd__, /*nb_inplace_add*/
  __pyx_pw_7cgtypes_4mat4_29__isub__, /*nb_inplace_subtract*/
  __pyx_pw_7cgtypes_4mat4_31__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4mat4_33__idiv__, /*nb_inplace_divide*/
  #endif
  __pyx_pw_7cgtypes_4mat4_35__imod__, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_mat4 = {
  __pyx_pw_7cgtypes_4mat4_37__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_7cgtypes_mat4, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_mat4 = {
  __pyx_pw_7cgtypes_4mat4_37__len__, /*mp_length*/
  __pyx_pw_7cgtypes_4mat4_39__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_7cgtypes_mat4, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_7cgtypes_mat4 = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.mat4", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_mat4), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_mat4, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_7cgtypes_4mat4_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_mat4, /*tp_as_number*/
  &__pyx_tp_as_sequence_mat4, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_mat4, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_7cgtypes_4mat4_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_7cgtypes_4mat4_11__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_4mat4_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7cgtypes_mat4, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_mat4, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_vec3iter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7cgtypes_vec3iter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7cgtypes_vec3iter *)o);
  p->v = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7cgtypes_8vec3iter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_vec3iter(PyObject *o) {
  struct __pyx_obj_7cgtypes_vec3iter *p = (struct __pyx_obj_7cgtypes_vec3iter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->v);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7cgtypes_vec3iter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7cgtypes_vec3iter *p = (struct __pyx_obj_7cgtypes_vec3iter *)o;
  if (p->v) {
    e = (*v)(p->v, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7cgtypes_vec3iter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7cgtypes_vec3iter *p = (struct __pyx_obj_7cgtypes_vec3iter *)o;
  tmp = ((PyObject*)p->v);
  p->v = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7cgtypes_vec3iter[] = {
  {"__next__", (PyCFunction)__pyx_pw_7cgtypes_8vec3iter_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7cgtypes_vec3iter = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.vec3iter", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_vec3iter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_vec3iter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "vec3 iterator.", /*tp_doc*/
  __pyx_tp_traverse_7cgtypes_vec3iter, /*tp_traverse*/
  __pyx_tp_clear_7cgtypes_vec3iter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_8vec3iter_3__iter__, /*tp_iter*/
  __pyx_pw_7cgtypes_8vec3iter_5__next__, /*tp_iternext*/
  __pyx_methods_7cgtypes_vec3iter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_vec3iter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_vec4iter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7cgtypes_vec4iter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7cgtypes_vec4iter *)o);
  p->v = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7cgtypes_8vec4iter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_vec4iter(PyObject *o) {
  struct __pyx_obj_7cgtypes_vec4iter *p = (struct __pyx_obj_7cgtypes_vec4iter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->v);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7cgtypes_vec4iter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7cgtypes_vec4iter *p = (struct __pyx_obj_7cgtypes_vec4iter *)o;
  if (p->v) {
    e = (*v)(p->v, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7cgtypes_vec4iter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7cgtypes_vec4iter *p = (struct __pyx_obj_7cgtypes_vec4iter *)o;
  tmp = ((PyObject*)p->v);
  p->v = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7cgtypes_vec4iter[] = {
  {"__next__", (PyCFunction)__pyx_pw_7cgtypes_8vec4iter_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7cgtypes_vec4iter = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.vec4iter", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_vec4iter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_vec4iter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "vec4 iterator.", /*tp_doc*/
  __pyx_tp_traverse_7cgtypes_vec4iter, /*tp_traverse*/
  __pyx_tp_clear_7cgtypes_vec4iter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_8vec4iter_3__iter__, /*tp_iter*/
  __pyx_pw_7cgtypes_8vec4iter_5__next__, /*tp_iternext*/
  __pyx_methods_7cgtypes_vec4iter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_vec4iter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_mat3iter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7cgtypes_mat3iter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7cgtypes_mat3iter *)o);
  p->m = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7cgtypes_8mat3iter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_mat3iter(PyObject *o) {
  struct __pyx_obj_7cgtypes_mat3iter *p = (struct __pyx_obj_7cgtypes_mat3iter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->m);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7cgtypes_mat3iter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7cgtypes_mat3iter *p = (struct __pyx_obj_7cgtypes_mat3iter *)o;
  if (p->m) {
    e = (*v)(p->m, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7cgtypes_mat3iter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7cgtypes_mat3iter *p = (struct __pyx_obj_7cgtypes_mat3iter *)o;
  tmp = ((PyObject*)p->m);
  p->m = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7cgtypes_mat3iter[] = {
  {"__next__", (PyCFunction)__pyx_pw_7cgtypes_8mat3iter_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7cgtypes_mat3iter = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.mat3iter", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_mat3iter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_mat3iter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "mat iterator.", /*tp_doc*/
  __pyx_tp_traverse_7cgtypes_mat3iter, /*tp_traverse*/
  __pyx_tp_clear_7cgtypes_mat3iter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_8mat3iter_3__iter__, /*tp_iter*/
  __pyx_pw_7cgtypes_8mat3iter_5__next__, /*tp_iternext*/
  __pyx_methods_7cgtypes_mat3iter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_mat3iter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_mat4iter(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7cgtypes_mat4iter *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7cgtypes_mat4iter *)o);
  p->m = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7cgtypes_8mat4iter_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_mat4iter(PyObject *o) {
  struct __pyx_obj_7cgtypes_mat4iter *p = (struct __pyx_obj_7cgtypes_mat4iter *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->m);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7cgtypes_mat4iter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7cgtypes_mat4iter *p = (struct __pyx_obj_7cgtypes_mat4iter *)o;
  if (p->m) {
    e = (*v)(p->m, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7cgtypes_mat4iter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7cgtypes_mat4iter *p = (struct __pyx_obj_7cgtypes_mat4iter *)o;
  tmp = ((PyObject*)p->m);
  p->m = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7cgtypes_mat4iter[] = {
  {"__next__", (PyCFunction)__pyx_pw_7cgtypes_8mat4iter_5__next__, METH_NOARGS|METH_COEXIST, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7cgtypes_mat4iter = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.mat4iter", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_mat4iter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_mat4iter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "mat iterator.", /*tp_doc*/
  __pyx_tp_traverse_7cgtypes_mat4iter, /*tp_traverse*/
  __pyx_tp_clear_7cgtypes_mat4iter, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_7cgtypes_8mat4iter_3__iter__, /*tp_iter*/
  __pyx_pw_7cgtypes_8mat4iter_5__next__, /*tp_iternext*/
  __pyx_methods_7cgtypes_mat4iter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_mat4iter, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7cgtypes_quat(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7cgtypes_4quat_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7cgtypes_quat(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_tp_getattro_7cgtypes_quat(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_pw_7cgtypes_4quat_33__getattr__(o, n);
  }
  return v;
}

static int __pyx_tp_setattro_7cgtypes_quat(PyObject *o, PyObject *n, PyObject *v) {
  if (v) {
    return __pyx_pw_7cgtypes_4quat_35__setattr__(o, n, v);
  }
  else {
    return PyObject_GenericSetAttr(o, n, 0);
  }
}

static PyMethodDef __pyx_methods_7cgtypes_quat[] = {
  {"__reduce__", (PyCFunction)__pyx_pw_7cgtypes_4quat_3__reduce__, METH_NOARGS, 0},
  {"__getattr__", (PyCFunction)__pyx_pw_7cgtypes_4quat_33__getattr__, METH_O|METH_COEXIST, 0},
  {"conjugate", (PyCFunction)__pyx_pw_7cgtypes_4quat_39conjugate, METH_NOARGS, __pyx_doc_7cgtypes_4quat_38conjugate},
  {"normalize", (PyCFunction)__pyx_pw_7cgtypes_4quat_41normalize, METH_NOARGS, __pyx_doc_7cgtypes_4quat_40normalize},
  {"inverse", (PyCFunction)__pyx_pw_7cgtypes_4quat_43inverse, METH_NOARGS, __pyx_doc_7cgtypes_4quat_42inverse},
  {"toAngleAxis", (PyCFunction)__pyx_pw_7cgtypes_4quat_45toAngleAxis, METH_NOARGS, __pyx_doc_7cgtypes_4quat_44toAngleAxis},
  {"fromAngleAxis", (PyCFunction)__pyx_pw_7cgtypes_4quat_47fromAngleAxis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7cgtypes_4quat_46fromAngleAxis},
  {"toMat3", (PyCFunction)__pyx_pw_7cgtypes_4quat_49toMat3, METH_NOARGS, __pyx_doc_7cgtypes_4quat_48toMat3},
  {"toMat4", (PyCFunction)__pyx_pw_7cgtypes_4quat_51toMat4, METH_NOARGS, __pyx_doc_7cgtypes_4quat_50toMat4},
  {"fromMat", (PyCFunction)__pyx_pw_7cgtypes_4quat_53fromMat, METH_O, __pyx_doc_7cgtypes_4quat_52fromMat},
  {"dot", (PyCFunction)__pyx_pw_7cgtypes_4quat_55dot, METH_O, __pyx_doc_7cgtypes_4quat_54dot},
  {"log", (PyCFunction)__pyx_pw_7cgtypes_4quat_57log, METH_NOARGS, __pyx_doc_7cgtypes_4quat_56log},
  {"exp", (PyCFunction)__pyx_pw_7cgtypes_4quat_59exp, METH_NOARGS, __pyx_doc_7cgtypes_4quat_58exp},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_quat = {
  __pyx_pw_7cgtypes_4quat_11__add__, /*nb_add*/
  __pyx_pw_7cgtypes_4quat_13__sub__, /*nb_subtract*/
  __pyx_pw_7cgtypes_4quat_15__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4quat_17__div__, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  __pyx_pw_7cgtypes_4quat_19__pow__, /*nb_power*/
  __pyx_pw_7cgtypes_4quat_21__neg__, /*nb_negative*/
  __pyx_pw_7cgtypes_4quat_23__pos__, /*nb_positive*/
  __pyx_pw_7cgtypes_4quat_37__abs__, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  __pyx_pw_7cgtypes_4quat_25__iadd__, /*nb_inplace_add*/
  __pyx_pw_7cgtypes_4quat_27__isub__, /*nb_inplace_subtract*/
  __pyx_pw_7cgtypes_4quat_29__imul__, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_7cgtypes_4quat_31__idiv__, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_7cgtypes_quat = {
  PyVarObject_HEAD_INIT(0, 0)
  "cgtypes.quat", /*tp_name*/
  sizeof(struct __pyx_obj_7cgtypes_quat), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7cgtypes_quat, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_7cgtypes_4quat_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_quat, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_7cgtypes_4quat_7__str__, /*tp_str*/
  __pyx_tp_getattro_7cgtypes_quat, /*tp_getattro*/
  __pyx_tp_setattro_7cgtypes_quat, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Quaternion class.\n\n    Quaternions are an extension to complex numbers and can be used\n    to store rotations. They are composed of four floats which can be\n    seen as an angle and an axis of rotation.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_7cgtypes_4quat_9__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7cgtypes_quat, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7cgtypes_quat, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "cgtypes",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_kp_s_1_4f_1_4f_1_4f, __pyx_k_1_4f_1_4f_1_4f, sizeof(__pyx_k_1_4f_1_4f_1_4f), 0, 0, 1, 0},
  {&__pyx_kp_s_1_4f_1_4f_1_4f_1_4f, __pyx_k_1_4f_1_4f_1_4f_1_4f, sizeof(__pyx_k_1_4f_1_4f_1_4f_1_4f), 0, 0, 1, 0},
  {&__pyx_kp_s_3_sequence_expected, __pyx_k_3_sequence_expected, sizeof(__pyx_k_3_sequence_expected), 0, 0, 1, 0},
  {&__pyx_kp_s_4_sequence_expected, __pyx_k_4_sequence_expected, sizeof(__pyx_k_4_sequence_expected), 0, 0, 1, 0},
  {&__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9, __pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9, sizeof(__pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9), 0, 0, 1, 0},
  {&__pyx_kp_s_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2, __pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2, sizeof(__pyx_k_9_4f_9_4f_9_4f_9_4f_9_4f_9_4f_9_2), 0, 0, 1, 0},
  {&__pyx_kp_u_Addition_q_quat_0_9689_0_2160_0, __pyx_k_Addition_q_quat_0_9689_0_2160_0, sizeof(__pyx_k_Addition_q_quat_0_9689_0_2160_0), 0, 1, 0, 0},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_kp_u_Cross_product_a_vec3_1_0_0_5_1_8, __pyx_k_Cross_product_a_vec3_1_0_0_5_1_8, sizeof(__pyx_k_Cross_product_a_vec3_1_0_0_5_1_8), 0, 1, 0, 0},
  {&__pyx_kp_u_Division_M_mat4_1_2_3_4_5_6_7_8, __pyx_k_Division_M_mat4_1_2_3_4_5_6_7_8, sizeof(__pyx_k_Division_M_mat4_1_2_3_4_5_6_7_8), 0, 1, 0, 0},
  {&__pyx_kp_u_Division_by_scalar_a_vec3_1_0_0, __pyx_k_Division_by_scalar_a_vec3_1_0_0, sizeof(__pyx_k_Division_by_scalar_a_vec3_1_0_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Division_by_scalar_a_vec4_1_0_0, __pyx_k_Division_by_scalar_a_vec4_1_0_0, sizeof(__pyx_k_Division_by_scalar_a_vec4_1_0_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Division_q_quat_0_9689_0_2160_0, __pyx_k_Division_q_quat_0_9689_0_2160_0, sizeof(__pyx_k_Division_q_quat_0_9689_0_2160_0), 0, 1, 0, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_u_Inline_division_with_scalar_a_ve, __pyx_k_Inline_division_with_scalar_a_ve, sizeof(__pyx_k_Inline_division_with_scalar_a_ve), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_division_with_scalar_a_ve_2, __pyx_k_Inline_division_with_scalar_a_ve_2, sizeof(__pyx_k_Inline_division_with_scalar_a_ve_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_modulo_a_vec3_3_0_2_5_1_8, __pyx_k_Inline_modulo_a_vec3_3_0_2_5_1_8, sizeof(__pyx_k_Inline_modulo_a_vec3_3_0_2_5_1_8), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_modulo_a_vec4_3_0_2_5_1_8, __pyx_k_Inline_modulo_a_vec4_3_0_2_5_1_8, sizeof(__pyx_k_Inline_modulo_a_vec4_3_0_2_5_1_8), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_multiplication_only_with, __pyx_k_Inline_multiplication_only_with, sizeof(__pyx_k_Inline_multiplication_only_with), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_multiplication_only_with_2, __pyx_k_Inline_multiplication_only_with_2, sizeof(__pyx_k_Inline_multiplication_only_with_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_vector_addition_a_vec3_1, __pyx_k_Inline_vector_addition_a_vec3_1, sizeof(__pyx_k_Inline_vector_addition_a_vec3_1), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_vector_addition_a_vec4_1, __pyx_k_Inline_vector_addition_a_vec4_1, sizeof(__pyx_k_Inline_vector_addition_a_vec4_1), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_vector_subtraction_a_vec3, __pyx_k_Inline_vector_subtraction_a_vec3, sizeof(__pyx_k_Inline_vector_subtraction_a_vec3), 0, 1, 0, 0},
  {&__pyx_kp_u_Inline_vector_subtraction_a_vec4, __pyx_k_Inline_vector_subtraction_a_vec4, sizeof(__pyx_k_Inline_vector_subtraction_a_vec4), 0, 1, 0, 0},
  {&__pyx_n_s_M3, __pyx_k_M3, sizeof(__pyx_k_M3), 0, 0, 1, 1},
  {&__pyx_kp_u_M_mat4_1_2_3_4_5_6_7_8_9_10_11, __pyx_k_M_mat4_1_2_3_4_5_6_7_8_9_10_11, sizeof(__pyx_k_M_mat4_1_2_3_4_5_6_7_8_9_10_11), 0, 1, 0, 0},
  {&__pyx_kp_u_Matrix_addition_M_mat4_1_2_3_4_5, __pyx_k_Matrix_addition_M_mat4_1_2_3_4_5, sizeof(__pyx_k_Matrix_addition_M_mat4_1_2_3_4_5), 0, 1, 0, 0},
  {&__pyx_kp_u_Matrix_subtraction_M_mat4_1_2_3, __pyx_k_Matrix_subtraction_M_mat4_1_2_3, sizeof(__pyx_k_Matrix_subtraction_M_mat4_1_2_3), 0, 1, 0, 0},
  {&__pyx_kp_u_Modulo_M_mat4_1_2_3_4_5_6_7_8_9, __pyx_k_Modulo_M_mat4_1_2_3_4_5_6_7_8_9, sizeof(__pyx_k_Modulo_M_mat4_1_2_3_4_5_6_7_8_9), 0, 1, 0, 0},
  {&__pyx_kp_u_Modulo_component_wise_a_vec3_3_0, __pyx_k_Modulo_component_wise_a_vec3_3_0, sizeof(__pyx_k_Modulo_component_wise_a_vec3_3_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Modulo_component_wise_a_vec4_3_0, __pyx_k_Modulo_component_wise_a_vec4_3_0, sizeof(__pyx_k_Modulo_component_wise_a_vec4_3_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Multiplication_M_mat4_1_2_3_4_5, __pyx_k_Multiplication_M_mat4_1_2_3_4_5, sizeof(__pyx_k_Multiplication_M_mat4_1_2_3_4_5), 0, 1, 0, 0},
  {&__pyx_kp_u_Multiplication_q_quat_0_9689_0_2, __pyx_k_Multiplication_q_quat_0_9689_0_2, sizeof(__pyx_k_Multiplication_q_quat_0_9689_0_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Multiplication_with_a_scalar_or, __pyx_k_Multiplication_with_a_scalar_or, sizeof(__pyx_k_Multiplication_with_a_scalar_or), 0, 1, 0, 0},
  {&__pyx_kp_u_Multiplication_with_a_scalar_or_2, __pyx_k_Multiplication_with_a_scalar_or_2, sizeof(__pyx_k_Multiplication_with_a_scalar_or_2), 0, 1, 0, 0},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_kp_u_Negation_M_mat4_1_2_3_4_5_6_7_8, __pyx_k_Negation_M_mat4_1_2_3_4_5_6_7_8, sizeof(__pyx_k_Negation_M_mat4_1_2_3_4_5_6_7_8), 0, 1, 0, 0},
  {&__pyx_kp_u_Negation_a_vec3_3_0_2_5_1_8_prin, __pyx_k_Negation_a_vec3_3_0_2_5_1_8_prin, sizeof(__pyx_k_Negation_a_vec3_3_0_2_5_1_8_prin), 0, 1, 0, 0},
  {&__pyx_kp_u_Negation_a_vec4_3_0_2_5_1_8_0_2, __pyx_k_Negation_a_vec4_3_0_2_5_1_8_0_2, sizeof(__pyx_k_Negation_a_vec4_3_0_2_5_1_8_0_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Negation_q_quat_0_9689_0_2160_0, __pyx_k_Negation_q_quat_0_9689_0_2160_0, sizeof(__pyx_k_Negation_q_quat_0_9689_0_2160_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_a_component_by_index_0_ba, __pyx_k_Return_a_component_by_index_0_ba, sizeof(__pyx_k_Return_a_component_by_index_0_ba), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_a_component_by_index_0_ba_2, __pyx_k_Return_a_component_by_index_0_ba_2, sizeof(__pyx_k_Return_a_component_by_index_0_ba_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_a_list_containing_the_mat, __pyx_k_Return_a_list_containing_the_mat, sizeof(__pyx_k_Return_a_list_containing_the_mat), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_angle_in_radians_and_rota, __pyx_k_Return_angle_in_radians_and_rota, sizeof(__pyx_k_Return_angle_in_radians_and_rota), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_angle_in_radians_between, __pyx_k_Return_angle_in_radians_between, sizeof(__pyx_k_Return_angle_in_radians_between), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_conjugate_q_quat_0_9689_0, __pyx_k_Return_conjugate_q_quat_0_9689_0, sizeof(__pyx_k_Return_conjugate_q_quat_0_9689_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_determinant_M_mat4_2_0_0, __pyx_k_Return_determinant_M_mat4_2_0_0, sizeof(__pyx_k_Return_determinant_M_mat4_2_0_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_identity_matrix_print_mat, __pyx_k_Return_identity_matrix_print_mat, sizeof(__pyx_k_Return_identity_matrix_print_mat), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_inverse_matrix_M_mat4_0_2, __pyx_k_Return_inverse_matrix_M_mat4_0_2, sizeof(__pyx_k_Return_inverse_matrix_M_mat4_0_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_inverse_q_quat_0_9_0_5_0, __pyx_k_Return_inverse_q_quat_0_9_0_5_0, sizeof(__pyx_k_Return_inverse_q_quat_0_9_0_5_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_magnitude_q_quat_0_9689_0, __pyx_k_Return_magnitude_q_quat_0_9689_0, sizeof(__pyx_k_Return_magnitude_q_quat_0_9689_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_normalized_quaternion_q_q, __pyx_k_Return_normalized_quaternion_q_q, sizeof(__pyx_k_Return_normalized_quaternion_q_q), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_normalized_vector_a_vec3, __pyx_k_Return_normalized_vector_a_vec3, sizeof(__pyx_k_Return_normalized_vector_a_vec3), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_normalized_vector_a_vec4, __pyx_k_Return_normalized_vector_a_vec4, sizeof(__pyx_k_Return_normalized_vector_a_vec4), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_length_of_the_vector, __pyx_k_Return_the_length_of_the_vector, sizeof(__pyx_k_Return_the_length_of_the_vector), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_length_of_the_vector_2, __pyx_k_Return_the_length_of_the_vector_2, sizeof(__pyx_k_Return_the_length_of_the_vector_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_length_of_the_vector_3, __pyx_k_Return_the_length_of_the_vector_3, sizeof(__pyx_k_Return_the_length_of_the_vector_3), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_length_of_the_vector_4, __pyx_k_Return_the_length_of_the_vector_4, sizeof(__pyx_k_Return_the_length_of_the_vector_4), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_reflection_vector_N_i, __pyx_k_Return_the_reflection_vector_N_i, sizeof(__pyx_k_Return_the_reflection_vector_N_i), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_the_transmitted_vector_N, __pyx_k_Return_the_transmitted_vector_N, sizeof(__pyx_k_Return_the_transmitted_vector_N), 0, 1, 0, 0},
  {&__pyx_kp_u_Return_transpose_matrix_M_mat4_1, __pyx_k_Return_transpose_matrix_M_mat4_1, sizeof(__pyx_k_Return_transpose_matrix_M_mat4_1), 0, 1, 0, 0},
  {&__pyx_kp_u_Returns_an_orthogonal_vector_Ret, __pyx_k_Returns_an_orthogonal_vector_Ret, sizeof(__pyx_k_Returns_an_orthogonal_vector_Ret), 0, 1, 0, 0},
  {&__pyx_kp_u_Set_a_component_by_index_0_based, __pyx_k_Set_a_component_by_index_0_based, sizeof(__pyx_k_Set_a_component_by_index_0_based), 0, 1, 0, 0},
  {&__pyx_kp_u_Set_a_component_by_index_0_based_2, __pyx_k_Set_a_component_by_index_0_based_2, sizeof(__pyx_k_Set_a_component_by_index_0_based_2), 0, 1, 0, 0},
  {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
  {&__pyx_kp_u_Subtraction_q_quat_0_9689_0_2160, __pyx_k_Subtraction_q_quat_0_9689_0_2160, sizeof(__pyx_k_Subtraction_q_quat_0_9689_0_2160), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_u_Vector_addition_a_vec3_1_0_0_5_1, __pyx_k_Vector_addition_a_vec3_1_0_0_5_1, sizeof(__pyx_k_Vector_addition_a_vec3_1_0_0_5_1), 0, 1, 0, 0},
  {&__pyx_kp_u_Vector_addition_a_vec4_1_0_0_5_1, __pyx_k_Vector_addition_a_vec4_1_0_0_5_1, sizeof(__pyx_k_Vector_addition_a_vec4_1_0_0_5_1), 0, 1, 0, 0},
  {&__pyx_kp_u_Vector_subtraction_a_vec3_1_0_0, __pyx_k_Vector_subtraction_a_vec3_1_0_0, sizeof(__pyx_k_Vector_subtraction_a_vec3_1_0_0), 0, 1, 0, 0},
  {&__pyx_kp_u_Vector_subtraction_a_vec4_1_0_0, __pyx_k_Vector_subtraction_a_vec4_1_0_0, sizeof(__pyx_k_Vector_subtraction_a_vec4_1_0_0), 0, 1, 0, 0},
  {&__pyx_n_s_ZeroDivisionError, __pyx_k_ZeroDivisionError, sizeof(__pyx_k_ZeroDivisionError), 0, 0, 1, 1},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0},
  {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_kp_u_a_vec3_3_0_2_5_1_8_print_a_3_00, __pyx_k_a_vec3_3_0_2_5_1_8_print_a_3_00, sizeof(__pyx_k_a_vec3_3_0_2_5_1_8_print_a_3_00), 0, 1, 0, 0},
  {&__pyx_kp_u_a_vec4_3_0_2_5_1_8_0_2_print_a, __pyx_k_a_vec4_3_0_2_5_1_8_0_2_print_a, sizeof(__pyx_k_a_vec4_3_0_2_5_1_8_0_2_print_a), 0, 1, 0, 0},
  {&__pyx_n_s_angle, __pyx_k_angle, sizeof(__pyx_k_angle), 0, 0, 1, 1},
  {&__pyx_kp_s_angle_null_vector_can_t_be_norma, __pyx_k_angle_null_vector_can_t_be_norma, sizeof(__pyx_k_angle_null_vector_can_t_be_norma), 0, 0, 1, 0},
  {&__pyx_n_s_aspect, __pyx_k_aspect, sizeof(__pyx_k_aspect), 0, 0, 1, 1},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_kp_s_axis_mustn_t_be_the_null_vector, __pyx_k_axis_mustn_t_be_the_null_vector, sizeof(__pyx_k_axis_mustn_t_be_the_null_vector), 0, 0, 1, 0},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_b1, __pyx_k_b1, sizeof(__pyx_k_b1), 0, 0, 1, 1},
  {&__pyx_n_s_b2, __pyx_k_b2, sizeof(__pyx_k_b2), 0, 0, 1, 1},
  {&__pyx_n_s_b3, __pyx_k_b3, sizeof(__pyx_k_b3), 0, 0, 1, 1},
  {&__pyx_n_s_b4, __pyx_k_b4, sizeof(__pyx_k_b4), 0, 0, 1, 1},
  {&__pyx_n_s_bottom, __pyx_k_bottom, sizeof(__pyx_k_bottom), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_cgtypes, __pyx_k_cgtypes, sizeof(__pyx_k_cgtypes), 0, 0, 1, 1},
  {&__pyx_n_s_constructor, __pyx_k_constructor, sizeof(__pyx_k_constructor), 0, 0, 1, 1},
  {&__pyx_n_s_copy_reg, __pyx_k_copy_reg, sizeof(__pyx_k_copy_reg), 0, 0, 1, 1},
  {&__pyx_n_s_copyreg, __pyx_k_copyreg, sizeof(__pyx_k_copyreg), 0, 0, 1, 1},
  {&__pyx_n_s_cross, __pyx_k_cross, sizeof(__pyx_k_cross), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_determinant, __pyx_k_determinant, sizeof(__pyx_k_determinant), 0, 0, 1, 1},
  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_eta, __pyx_k_eta, sizeof(__pyx_k_eta), 0, 0, 1, 1},
  {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1},
  {&__pyx_n_s_far, __pyx_k_far, sizeof(__pyx_k_far), 0, 0, 1, 1},
  {&__pyx_kp_s_far_value_must_be_greater_than_n, __pyx_k_far_value_must_be_greater_than_n, sizeof(__pyx_k_far_value_must_be_greater_than_n), 0, 0, 1, 0},
  {&__pyx_n_s_fovy, __pyx_k_fovy, sizeof(__pyx_k_fovy), 0, 0, 1, 1},
  {&__pyx_n_s_fromAngleAxis, __pyx_k_fromAngleAxis, sizeof(__pyx_k_fromAngleAxis), 0, 0, 1, 1},
  {&__pyx_n_s_frustum, __pyx_k_frustum, sizeof(__pyx_k_frustum), 0, 0, 1, 1},
  {&__pyx_n_s_getEpsilon, __pyx_k_getEpsilon, sizeof(__pyx_k_getEpsilon), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_kp_s_index_must_be_integer, __pyx_k_index_must_be_integer, sizeof(__pyx_k_index_must_be_integer), 0, 0, 1, 0},
  {&__pyx_kp_s_index_must_be_integer_or_2_tuple, __pyx_k_index_must_be_integer_or_2_tuple, sizeof(__pyx_k_index_must_be_integer_or_2_tuple), 0, 0, 1, 0},
  {&__pyx_kp_s_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 0, 0, 1, 0},
  {&__pyx_kp_s_index_tuple_must_be_a_2_tuple, __pyx_k_index_tuple_must_be_a_2_tuple, sizeof(__pyx_k_index_tuple_must_be_a_2_tuple), 0, 0, 1, 0},
  {&__pyx_kp_s_internal_error_illegal_rich_comp, __pyx_k_internal_error_illegal_rich_comp, sizeof(__pyx_k_internal_error_illegal_rich_comp), 0, 0, 1, 0},
  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_kp_s_mat3_arg_can_t_be_converted_to_m, __pyx_k_mat3_arg_can_t_be_converted_to_m, sizeof(__pyx_k_mat3_arg_can_t_be_converted_to_m), 0, 0, 1, 0},
  {&__pyx_kp_s_mat3_arg_is_a_malformed_string, __pyx_k_mat3_arg_is_a_malformed_string, sizeof(__pyx_k_mat3_arg_is_a_malformed_string), 0, 0, 1, 0},
  {&__pyx_kp_s_mat3_division, __pyx_k_mat3_division, sizeof(__pyx_k_mat3_division), 0, 0, 1, 0},
  {&__pyx_kp_s_mat3_modulo, __pyx_k_mat3_modulo, sizeof(__pyx_k_mat3_modulo), 0, 0, 1, 0},
  {&__pyx_kp_s_mat3_s_s_s_s_s_s_s_s_s, __pyx_k_mat3_s_s_s_s_s_s_s_s_s, sizeof(__pyx_k_mat3_s_s_s_s_s_s_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_mat3_takes_at_most_9_arguments, __pyx_k_mat3_takes_at_most_9_arguments, sizeof(__pyx_k_mat3_takes_at_most_9_arguments), 0, 0, 1, 0},
  {&__pyx_n_s_mat3construct, __pyx_k_mat3construct, sizeof(__pyx_k_mat3construct), 0, 0, 1, 1},
  {&__pyx_kp_u_mat4___add___line_2821, __pyx_k_mat4___add___line_2821, sizeof(__pyx_k_mat4___add___line_2821), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___div___line_3038, __pyx_k_mat4___div___line_3038, sizeof(__pyx_k_mat4___div___line_3038), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___mod___line_3079, __pyx_k_mat4___mod___line_3079, sizeof(__pyx_k_mat4___mod___line_3079), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___mul___line_2881, __pyx_k_mat4___mul___line_2881, sizeof(__pyx_k_mat4___mul___line_2881), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___neg___line_3152, __pyx_k_mat4___neg___line_3152, sizeof(__pyx_k_mat4___neg___line_3152), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___pos___line_3182, __pyx_k_mat4___pos___line_3182, sizeof(__pyx_k_mat4___pos___line_3182), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4___sub___line_2851, __pyx_k_mat4___sub___line_2851, sizeof(__pyx_k_mat4___sub___line_2851), 0, 1, 0, 0},
  {&__pyx_kp_s_mat4_arg_can_t_be_converted_to_m, __pyx_k_mat4_arg_can_t_be_converted_to_m, sizeof(__pyx_k_mat4_arg_can_t_be_converted_to_m), 0, 0, 1, 0},
  {&__pyx_kp_s_mat4_arg_is_a_malformed_string, __pyx_k_mat4_arg_is_a_malformed_string, sizeof(__pyx_k_mat4_arg_is_a_malformed_string), 0, 0, 1, 0},
  {&__pyx_kp_u_mat4_determinant_line_3753, __pyx_k_mat4_determinant_line_3753, sizeof(__pyx_k_mat4_determinant_line_3753), 0, 1, 0, 0},
  {&__pyx_kp_s_mat4_division, __pyx_k_mat4_division, sizeof(__pyx_k_mat4_division), 0, 0, 1, 0},
  {&__pyx_kp_u_mat4_identity_line_3694, __pyx_k_mat4_identity_line_3694, sizeof(__pyx_k_mat4_identity_line_3694), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4_inverse_line_3825, __pyx_k_mat4_inverse_line_3825, sizeof(__pyx_k_mat4_inverse_line_3825), 0, 1, 0, 0},
  {&__pyx_kp_s_mat4_modulo, __pyx_k_mat4_modulo, sizeof(__pyx_k_mat4_modulo), 0, 0, 1, 0},
  {&__pyx_kp_s_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s, __pyx_k_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s, sizeof(__pyx_k_mat4_s_s_s_s_s_s_s_s_s_s_s_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_mat4_takes_at_most_16_arguments, __pyx_k_mat4_takes_at_most_16_arguments, sizeof(__pyx_k_mat4_takes_at_most_16_arguments), 0, 0, 1, 0},
  {&__pyx_kp_u_mat4_toList_line_3669, __pyx_k_mat4_toList_line_3669, sizeof(__pyx_k_mat4_toList_line_3669), 0, 1, 0, 0},
  {&__pyx_kp_u_mat4_transpose_line_3723, __pyx_k_mat4_transpose_line_3723, sizeof(__pyx_k_mat4_transpose_line_3723), 0, 1, 0, 0},
  {&__pyx_n_s_mat4construct, __pyx_k_mat4construct, sizeof(__pyx_k_mat4construct), 0, 0, 1, 1},
  {&__pyx_kp_s_math_domain_error, __pyx_k_math_domain_error, sizeof(__pyx_k_math_domain_error), 0, 0, 1, 0},
  {&__pyx_kp_s_matrix_is_not_invertible, __pyx_k_matrix_is_not_invertible, sizeof(__pyx_k_matrix_is_not_invertible), 0, 0, 1, 0},
  {&__pyx_kp_s_matrix_not_invertible, __pyx_k_matrix_not_invertible, sizeof(__pyx_k_matrix_not_invertible), 0, 0, 1, 0},
  {&__pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_k_mnt_hgfs_Documents_src_cgkit1_c, sizeof(__pyx_k_mnt_hgfs_Documents_src_cgkit1_c), 0, 0, 1, 0},
  {&__pyx_n_s_near, __pyx_k_near, sizeof(__pyx_k_near), 0, 0, 1, 1},
  {&__pyx_n_s_normalize, __pyx_k_normalize, sizeof(__pyx_k_normalize), 0, 0, 1, 1},
  {&__pyx_kp_s_null_vector_can_t_be_normalized, __pyx_k_null_vector_can_t_be_normalized, sizeof(__pyx_k_null_vector_can_t_be_normalized), 0, 0, 1, 0},
  {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1},
  {&__pyx_n_s_ortho, __pyx_k_ortho, sizeof(__pyx_k_ortho), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_q0, __pyx_k_q0, sizeof(__pyx_k_q0), 0, 0, 1, 1},
  {&__pyx_n_s_q1, __pyx_k_q1, sizeof(__pyx_k_q1), 0, 0, 1, 1},
  {&__pyx_kp_u_q_quat_0_9689_0_2160_0_1080_0_0, __pyx_k_q_quat_0_9689_0_2160_0_1080_0_0, sizeof(__pyx_k_q_quat_0_9689_0_2160_0_1080_0_0), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___abs___line_4764, __pyx_k_quat___abs___line_4764, sizeof(__pyx_k_quat___abs___line_4764), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___add___line_4526, __pyx_k_quat___add___line_4526, sizeof(__pyx_k_quat___add___line_4526), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___div___line_4607, __pyx_k_quat___div___line_4607, sizeof(__pyx_k_quat___div___line_4607), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___mul___line_4556, __pyx_k_quat___mul___line_4556, sizeof(__pyx_k_quat___mul___line_4556), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___neg___line_4641, __pyx_k_quat___neg___line_4641, sizeof(__pyx_k_quat___neg___line_4641), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___pos___line_4656, __pyx_k_quat___pos___line_4656, sizeof(__pyx_k_quat___pos___line_4656), 0, 1, 0, 0},
  {&__pyx_kp_u_quat___sub___line_4541, __pyx_k_quat___sub___line_4541, sizeof(__pyx_k_quat___sub___line_4541), 0, 1, 0, 0},
  {&__pyx_kp_s_quat_arg_can_t_be_converted_to_q, __pyx_k_quat_arg_can_t_be_converted_to_q, sizeof(__pyx_k_quat_arg_can_t_be_converted_to_q), 0, 0, 1, 0},
  {&__pyx_kp_s_quat_arg_is_a_malformed_string, __pyx_k_quat_arg_is_a_malformed_string, sizeof(__pyx_k_quat_arg_is_a_malformed_string), 0, 0, 1, 0},
  {&__pyx_kp_u_quat_conjugate_line_4775, __pyx_k_quat_conjugate_line_4775, sizeof(__pyx_k_quat_conjugate_line_4775), 0, 1, 0, 0},
  {&__pyx_kp_s_quat_division, __pyx_k_quat_division, sizeof(__pyx_k_quat_division), 0, 0, 1, 0},
  {&__pyx_kp_s_quat_has_no_attribute, __pyx_k_quat_has_no_attribute, sizeof(__pyx_k_quat_has_no_attribute), 0, 0, 1, 0},
  {&__pyx_kp_s_quat_has_no_writable_attribute, __pyx_k_quat_has_no_writable_attribute, sizeof(__pyx_k_quat_has_no_writable_attribute), 0, 0, 1, 0},
  {&__pyx_kp_u_quat_inverse_line_4815, __pyx_k_quat_inverse_line_4815, sizeof(__pyx_k_quat_inverse_line_4815), 0, 1, 0, 0},
  {&__pyx_kp_s_quat_is_not_invertible, __pyx_k_quat_is_not_invertible, sizeof(__pyx_k_quat_is_not_invertible), 0, 0, 1, 0},
  {&__pyx_kp_u_quat_normalize_line_4790, __pyx_k_quat_normalize_line_4790, sizeof(__pyx_k_quat_normalize_line_4790), 0, 1, 0, 0},
  {&__pyx_kp_s_quat_s_s_s_s, __pyx_k_quat_s_s_s_s, sizeof(__pyx_k_quat_s_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_u_quat_toAngleAxis_line_4836, __pyx_k_quat_toAngleAxis_line_4836, sizeof(__pyx_k_quat_toAngleAxis_line_4836), 0, 1, 0, 0},
  {&__pyx_n_s_quatconstruct, __pyx_k_quatconstruct, sizeof(__pyx_k_quatconstruct), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
  {&__pyx_kp_s_right_value_must_be_greater_than, __pyx_k_right_value_must_be_greater_than, sizeof(__pyx_k_right_value_must_be_greater_than), 0, 0, 1, 0},
  {&__pyx_n_s_rmul, __pyx_k_rmul, sizeof(__pyx_k_rmul), 0, 0, 1, 1},
  {&__pyx_n_s_rotation, __pyx_k_rotation, sizeof(__pyx_k_rotation), 0, 0, 1, 1},
  {&__pyx_n_s_rowmajor, __pyx_k_rowmajor, sizeof(__pyx_k_rowmajor), 0, 0, 1, 1},
  {&__pyx_n_s_setEpsilon, __pyx_k_setEpsilon, sizeof(__pyx_k_setEpsilon), 0, 0, 1, 1},
  {&__pyx_n_s_slerp, __pyx_k_slerp, sizeof(__pyx_k_slerp), 0, 0, 1, 1},
  {&__pyx_n_s_so, __pyx_k_so, sizeof(__pyx_k_so), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_squad, __pyx_k_squad, sizeof(__pyx_k_squad), 0, 0, 1, 1},
  {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_top, __pyx_k_top, sizeof(__pyx_k_top), 0, 0, 1, 1},
  {&__pyx_kp_s_top_value_must_be_greater_than_b, __pyx_k_top_value_must_be_greater_than_b, sizeof(__pyx_k_top_value_must_be_greater_than_b), 0, 0, 1, 0},
  {&__pyx_kp_s_transformation_contains_a_0_scal, __pyx_k_transformation_contains_a_0_scal, sizeof(__pyx_k_transformation_contains_a_0_scal), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for, __pyx_k_unsupported_operand_type_for, sizeof(__pyx_k_unsupported_operand_type_for), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_2, __pyx_k_unsupported_operand_type_for_2, sizeof(__pyx_k_unsupported_operand_type_for_2), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_3, __pyx_k_unsupported_operand_type_for_3, sizeof(__pyx_k_unsupported_operand_type_for_3), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_4, __pyx_k_unsupported_operand_type_for_4, sizeof(__pyx_k_unsupported_operand_type_for_4), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_5, __pyx_k_unsupported_operand_type_for_5, sizeof(__pyx_k_unsupported_operand_type_for_5), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_6, __pyx_k_unsupported_operand_type_for_6, sizeof(__pyx_k_unsupported_operand_type_for_6), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operand_type_for_cro, __pyx_k_unsupported_operand_type_for_cro, sizeof(__pyx_k_unsupported_operand_type_for_cro), 0, 0, 1, 0},
  {&__pyx_kp_s_unsupported_operation, __pyx_k_unsupported_operation, sizeof(__pyx_k_unsupported_operation), 0, 0, 1, 0},
  {&__pyx_n_s_up, __pyx_k_up, sizeof(__pyx_k_up), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_kp_u_vec3___abs___line_531, __pyx_k_vec3___abs___line_531, sizeof(__pyx_k_vec3___abs___line_531), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___add___line_258, __pyx_k_vec3___add___line_258, sizeof(__pyx_k_vec3___add___line_258), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___div___line_340, __pyx_k_vec3___div___line_340, sizeof(__pyx_k_vec3___div___line_340), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___getitem___line_568, __pyx_k_vec3___getitem___line_568, sizeof(__pyx_k_vec3___getitem___line_568), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___iadd___line_428, __pyx_k_vec3___iadd___line_428, sizeof(__pyx_k_vec3___iadd___line_428), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___idiv___line_475, __pyx_k_vec3___idiv___line_475, sizeof(__pyx_k_vec3___idiv___line_475), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___imod___line_496, __pyx_k_vec3___imod___line_496, sizeof(__pyx_k_vec3___imod___line_496), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___imul___line_456, __pyx_k_vec3___imul___line_456, sizeof(__pyx_k_vec3___imul___line_456), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___isub___line_442, __pyx_k_vec3___isub___line_442, sizeof(__pyx_k_vec3___isub___line_442), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___mod___line_365, __pyx_k_vec3___mod___line_365, sizeof(__pyx_k_vec3___mod___line_365), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___mul___line_288, __pyx_k_vec3___mul___line_288, sizeof(__pyx_k_vec3___mul___line_288), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___neg___line_400, __pyx_k_vec3___neg___line_400, sizeof(__pyx_k_vec3___neg___line_400), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___pos___line_414, __pyx_k_vec3___pos___line_414, sizeof(__pyx_k_vec3___pos___line_414), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___setitem___line_592, __pyx_k_vec3___setitem___line_592, sizeof(__pyx_k_vec3___setitem___line_592), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3___sub___line_273, __pyx_k_vec3___sub___line_273, sizeof(__pyx_k_vec3___sub___line_273), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3_angle_line_666, __pyx_k_vec3_angle_line_666, sizeof(__pyx_k_vec3_angle_line_666), 0, 1, 0, 0},
  {&__pyx_kp_s_vec3_arg_can_t_be_converted_to_v, __pyx_k_vec3_arg_can_t_be_converted_to_v, sizeof(__pyx_k_vec3_arg_can_t_be_converted_to_v), 0, 0, 1, 0},
  {&__pyx_kp_s_vec3_arg_is_a_malformed_string, __pyx_k_vec3_arg_is_a_malformed_string, sizeof(__pyx_k_vec3_arg_is_a_malformed_string), 0, 0, 1, 0},
  {&__pyx_kp_u_vec3_cross_line_613, __pyx_k_vec3_cross_line_613, sizeof(__pyx_k_vec3_cross_line_613), 0, 1, 0, 0},
  {&__pyx_kp_s_vec3_division, __pyx_k_vec3_division, sizeof(__pyx_k_vec3_division), 0, 0, 1, 0},
  {&__pyx_kp_s_vec3_has_no_attribute, __pyx_k_vec3_has_no_attribute, sizeof(__pyx_k_vec3_has_no_attribute), 0, 0, 1, 0},
  {&__pyx_kp_s_vec3_has_no_writable_attribute, __pyx_k_vec3_has_no_writable_attribute, sizeof(__pyx_k_vec3_has_no_writable_attribute), 0, 0, 1, 0},
  {&__pyx_kp_u_vec3_length_line_633, __pyx_k_vec3_length_line_633, sizeof(__pyx_k_vec3_length_line_633), 0, 1, 0, 0},
  {&__pyx_kp_s_vec3_modulo, __pyx_k_vec3_modulo, sizeof(__pyx_k_vec3_modulo), 0, 0, 1, 0},
  {&__pyx_kp_u_vec3_normalize_line_646, __pyx_k_vec3_normalize_line_646, sizeof(__pyx_k_vec3_normalize_line_646), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3_ortho_line_744, __pyx_k_vec3_ortho_line_744, sizeof(__pyx_k_vec3_ortho_line_744), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3_reflect_line_693, __pyx_k_vec3_reflect_line_693, sizeof(__pyx_k_vec3_reflect_line_693), 0, 1, 0, 0},
  {&__pyx_kp_u_vec3_refract_line_712, __pyx_k_vec3_refract_line_712, sizeof(__pyx_k_vec3_refract_line_712), 0, 1, 0, 0},
  {&__pyx_kp_s_vec3_s_s_s, __pyx_k_vec3_s_s_s, sizeof(__pyx_k_vec3_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_vec3_takes_at_most_3_arguments, __pyx_k_vec3_takes_at_most_3_arguments, sizeof(__pyx_k_vec3_takes_at_most_3_arguments), 0, 0, 1, 0},
  {&__pyx_n_s_vec3construct, __pyx_k_vec3construct, sizeof(__pyx_k_vec3construct), 0, 0, 1, 1},
  {&__pyx_kp_u_vec4___abs___line_1295, __pyx_k_vec4___abs___line_1295, sizeof(__pyx_k_vec4___abs___line_1295), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___add___line_1008, __pyx_k_vec4___add___line_1008, sizeof(__pyx_k_vec4___add___line_1008), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___div___line_1091, __pyx_k_vec4___div___line_1091, sizeof(__pyx_k_vec4___div___line_1091), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___getitem___line_1336, __pyx_k_vec4___getitem___line_1336, sizeof(__pyx_k_vec4___getitem___line_1336), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___iadd___line_1185, __pyx_k_vec4___iadd___line_1185, sizeof(__pyx_k_vec4___iadd___line_1185), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___idiv___line_1235, __pyx_k_vec4___idiv___line_1235, sizeof(__pyx_k_vec4___idiv___line_1235), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___imod___line_1257, __pyx_k_vec4___imod___line_1257, sizeof(__pyx_k_vec4___imod___line_1257), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___imul___line_1215, __pyx_k_vec4___imul___line_1215, sizeof(__pyx_k_vec4___imul___line_1215), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___isub___line_1200, __pyx_k_vec4___isub___line_1200, sizeof(__pyx_k_vec4___isub___line_1200), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___mod___line_1118, __pyx_k_vec4___mod___line_1118, sizeof(__pyx_k_vec4___mod___line_1118), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___mul___line_1040, __pyx_k_vec4___mul___line_1040, sizeof(__pyx_k_vec4___mul___line_1040), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___neg___line_1156, __pyx_k_vec4___neg___line_1156, sizeof(__pyx_k_vec4___neg___line_1156), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___pos___line_1171, __pyx_k_vec4___pos___line_1171, sizeof(__pyx_k_vec4___pos___line_1171), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___setitem___line_1363, __pyx_k_vec4___setitem___line_1363, sizeof(__pyx_k_vec4___setitem___line_1363), 0, 1, 0, 0},
  {&__pyx_kp_u_vec4___sub___line_1024, __pyx_k_vec4___sub___line_1024, sizeof(__pyx_k_vec4___sub___line_1024), 0, 1, 0, 0},
  {&__pyx_kp_s_vec4_arg_can_t_be_converted_to_v, __pyx_k_vec4_arg_can_t_be_converted_to_v, sizeof(__pyx_k_vec4_arg_can_t_be_converted_to_v), 0, 0, 1, 0},
  {&__pyx_kp_s_vec4_arg_is_a_malformed_string, __pyx_k_vec4_arg_is_a_malformed_string, sizeof(__pyx_k_vec4_arg_is_a_malformed_string), 0, 0, 1, 0},
  {&__pyx_kp_s_vec4_division, __pyx_k_vec4_division, sizeof(__pyx_k_vec4_division), 0, 0, 1, 0},
  {&__pyx_kp_s_vec4_has_no_attribute, __pyx_k_vec4_has_no_attribute, sizeof(__pyx_k_vec4_has_no_attribute), 0, 0, 1, 0},
  {&__pyx_kp_s_vec4_has_no_writable_attribute, __pyx_k_vec4_has_no_writable_attribute, sizeof(__pyx_k_vec4_has_no_writable_attribute), 0, 0, 1, 0},
  {&__pyx_kp_u_vec4_length_line_1385, __pyx_k_vec4_length_line_1385, sizeof(__pyx_k_vec4_length_line_1385), 0, 1, 0, 0},
  {&__pyx_kp_s_vec4_modulo, __pyx_k_vec4_modulo, sizeof(__pyx_k_vec4_modulo), 0, 0, 1, 0},
  {&__pyx_kp_u_vec4_normalize_line_1398, __pyx_k_vec4_normalize_line_1398, sizeof(__pyx_k_vec4_normalize_line_1398), 0, 1, 0, 0},
  {&__pyx_kp_s_vec4_s_s_s_s, __pyx_k_vec4_s_s_s_s, sizeof(__pyx_k_vec4_s_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_vec4_takes_at_most_4_arguments, __pyx_k_vec4_takes_at_most_4_arguments, sizeof(__pyx_k_vec4_takes_at_most_4_arguments), 0, 0, 1, 0},
  {&__pyx_n_s_vec4construct, __pyx_k_vec4construct, sizeof(__pyx_k_vec4construct), 0, 0, 1, 1},
  {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ZeroDivisionError = __Pyx_GetBuiltinName(__pyx_n_s_ZeroDivisionError); if (!__pyx_builtin_ZeroDivisionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "cgtypes.pyx":152
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
  __pyx_tuple__3 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "cgtypes.pyx":887
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "cgtypes.pyx":1510
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_tuple__13 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "cgtypes.pyx":2631
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
  __pyx_tuple__15 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "cgtypes.pyx":4179
 *         return self.frustum(left, right, bottom, top, near, far)
 * 
 *     def lookAt(self, pos, target, up=(0,0,1)):             # <<<<<<<<<<<<<<
 *         """Look from pos to target.
 * 
 */
  __pyx_tuple__18 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "cgtypes.pyx":4423
 *             # String
 *             elif T==str or T==unicode:
 *                 s=args[0].replace(","," ").replace("  "," ").strip().split(" ")             # <<<<<<<<<<<<<<
 *                 if s==[""]:
 *                     s=[]
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_kp_s_, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_tuple__20 = PyTuple_Pack(2, __pyx_kp_s__4, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "cgtypes.pyx":4864
 *         s = sin(w)
 *         if s<=eps:
 *             return (0.0, vec3(0.0,0.0,0.0))             # <<<<<<<<<<<<<<
 * 
 *         return (2.0*w, vec3(q.x/s, q.y/s, q.z/s))
 */
  __pyx_tuple__22 = PyTuple_Pack(3, __pyx_float_0_0, __pyx_float_0_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "cgtypes.pyx":4962
 *         cdef double d1,d2,d3,ad1,ad2,ad3,t,s
 * 
 *         d1 = m[0,0]             # <<<<<<<<<<<<<<
 *         d2 = m[1,1]
 *         d3 = m[2,2]
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "cgtypes.pyx":4963
 * 
 *         d1 = m[0,0]
 *         d2 = m[1,1]             # <<<<<<<<<<<<<<
 *         d3 = m[2,2]
 *         t = d1+d2+d3+1.0
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "cgtypes.pyx":4964
 *         d1 = m[0,0]
 *         d2 = m[1,1]
 *         d3 = m[2,2]             # <<<<<<<<<<<<<<
 *         t = d1+d2+d3+1.0
 *         if t>0.0:
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4964; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "cgtypes.pyx":4969
 *             s = 0.5/sqrt(t)
 *             self.w = 0.25/s
 *             self.x = (m[2,1]-m[1,2])*s             # <<<<<<<<<<<<<<
 *             self.y = (m[0,2]-m[2,0])*s
 *             self.z = (m[1,0]-m[0,1])*s
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "cgtypes.pyx":4970
 *             self.w = 0.25/s
 *             self.x = (m[2,1]-m[1,2])*s
 *             self.y = (m[0,2]-m[2,0])*s             # <<<<<<<<<<<<<<
 *             self.z = (m[1,0]-m[0,1])*s
 *         else:
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_0); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "cgtypes.pyx":4971
 *             self.x = (m[2,1]-m[1,2])*s
 *             self.y = (m[0,2]-m[2,0])*s
 *             self.z = (m[1,0]-m[0,1])*s             # <<<<<<<<<<<<<<
 *         else:
 *             ad1 = fabs(d1)
 */
  __pyx_tuple__30 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "cgtypes.pyx":4979
 *                 s = sqrt(1.0+d1-d2-d3)*2.0
 *                 self.x = 0.5/s
 *                 self.y = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 *                 self.z = (m[0,2]+m[2,0])/s
 *                 self.w = (m[1,2]+m[2,1])/s
 */
  __pyx_tuple__32 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_tuple__33 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "cgtypes.pyx":4980
 *                 self.x = 0.5/s
 *                 self.y = (m[0,1]+m[1,0])/s
 *                 self.z = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *                 self.w = (m[1,2]+m[2,1])/s
 *             elif ad2>=ad1 and ad2>=ad3:
 */
  __pyx_tuple__34 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_tuple__35 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_0); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "cgtypes.pyx":4981
 *                 self.y = (m[0,1]+m[1,0])/s
 *                 self.z = (m[0,2]+m[2,0])/s
 *                 self.w = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *             elif ad2>=ad1 and ad2>=ad3:
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 */
  __pyx_tuple__36 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_tuple__37 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "cgtypes.pyx":4984
 *             elif ad2>=ad1 and ad2>=ad3:
 *                 s = sqrt(1.0+d2-d1-d3)*2.0
 *                 self.x = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s
 */
  __pyx_tuple__38 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_tuple__39 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "cgtypes.pyx":4986
 *                 self.x = (m[0,1]+m[1,0])/s
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *                 self.w = (m[0,2]+m[2,0])/s
 *             else:
 */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "cgtypes.pyx":4987
 *                 self.y = 0.5/s
 *                 self.z = (m[1,2]+m[2,1])/s
 *                 self.w = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *             else:
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 */
  __pyx_tuple__42 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);
  __pyx_tuple__43 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_0); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "cgtypes.pyx":4990
 *             else:
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 *                 self.x = (m[0,2]+m[2,0])/s             # <<<<<<<<<<<<<<
 *                 self.y = (m[1,2]+m[2,1])/s
 *                 self.z = 0.5/s
 */
  __pyx_tuple__44 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_tuple__45 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_0); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "cgtypes.pyx":4991
 *                 s = sqrt(1.0+d3-d1-d2)*2.0
 *                 self.x = (m[0,2]+m[2,0])/s
 *                 self.y = (m[1,2]+m[2,1])/s             # <<<<<<<<<<<<<<
 *                 self.z = 0.5/s
 *                 self.w = (m[0,1]+m[1,0])/s
 */
  __pyx_tuple__46 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_tuple__47 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);

  /* "cgtypes.pyx":4993
 *                 self.y = (m[1,2]+m[2,1])/s
 *                 self.z = 0.5/s
 *                 self.w = (m[0,1]+m[1,0])/s             # <<<<<<<<<<<<<<
 * 
 *         return self
 */
  __pyx_tuple__48 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_tuple__49 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "cgtypes.pyx":49
 * 
 * # setEpsilon
 * def setEpsilon(e):             # <<<<<<<<<<<<<<
 *     """Sets a new epsilon threshold value.
 * 
 */
  __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_e, __pyx_n_s_res); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_setEpsilon, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":61
 * 
 * # getEpsilon
 * def getEpsilon():             # <<<<<<<<<<<<<<
 *     """Return the epsilon threshold which is used for doing comparisons."""
 *     return eps
 */
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_getEpsilon, 61, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5055
 * 
 * 
 * def slerp(double t, quat q0, quat q1):             # <<<<<<<<<<<<<<
 *     """Spherical linear interpolation between two quaternions.
 * 
 */
  __pyx_tuple__53 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_q0, __pyx_n_s_q1, __pyx_n_s_o, __pyx_n_s_so, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_slerp, 5055, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5074
 *     return q0*a + q1*b
 * 
 * def squad(double t, quat a, quat b, quat c, quat d):             # <<<<<<<<<<<<<<
 *     """Spherical cubic interpolation."""
 *     return slerp(2*t*(1.0-t), slerp(t,a,d), slerp(t,b,c))
 */
  __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_t, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_c, __pyx_n_s_d); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_squad, 5074, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5086
 *     import copy_reg
 * 
 * def _vec3construct(x,y,z):             # <<<<<<<<<<<<<<
 *     return vec3(x,y,z)
 * 
 */
  __pyx_tuple__57 = PyTuple_Pack(3, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_vec3construct, 5086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5089
 *     return vec3(x,y,z)
 * 
 * def _vec4construct(x,y,z,w):             # <<<<<<<<<<<<<<
 *     return vec4(x,y,z,w)
 * 
 */
  __pyx_tuple__59 = PyTuple_Pack(4, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z, __pyx_n_s_w); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_vec4construct, 5089, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5092
 *     return vec4(x,y,z,w)
 * 
 * def _mat3construct(b1,b2,b3):             # <<<<<<<<<<<<<<
 *     return mat3(b1,b2,b3)
 * 
 */
  __pyx_tuple__61 = PyTuple_Pack(3, __pyx_n_s_b1, __pyx_n_s_b2, __pyx_n_s_b3); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_mat3construct, 5092, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5095
 *     return mat3(b1,b2,b3)
 * 
 * def _mat4construct(b1,b2,b3,b4):             # <<<<<<<<<<<<<<
 *     return mat4(b1,b2,b3,b4)
 * 
 */
  __pyx_tuple__63 = PyTuple_Pack(4, __pyx_n_s_b1, __pyx_n_s_b2, __pyx_n_s_b3, __pyx_n_s_b4); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_mat4construct, 5095, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "cgtypes.pyx":5098
 *     return mat4(b1,b2,b3,b4)
 * 
 * def _quatconstruct(w,x,y,z):             # <<<<<<<<<<<<<<
 *     return quat(w,x,y,z)
 * 
 */
  __pyx_tuple__65 = PyTuple_Pack(4, __pyx_n_s_w, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_z); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mnt_hgfs_Documents_src_cgkit1_c, __pyx_n_s_quatconstruct, 5098, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initcgtypes(void); /*proto*/
PyMODINIT_FUNC initcgtypes(void)
#else
PyMODINIT_FUNC PyInit_cgtypes(void); /*proto*/
PyMODINIT_FUNC PyInit_cgtypes(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cgtypes(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("cgtypes", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_cgtypes) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "cgtypes")) {
      if (unlikely(PyDict_SetItemString(modules, "cgtypes", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_7cgtypes_vec3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_vec3.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__add__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_12__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_12__add__.doc = __pyx_doc_7cgtypes_4vec3_12__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_12__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_14__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_14__sub__.doc = __pyx_doc_7cgtypes_4vec3_14__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_14__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__mul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_16__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_16__mul__.doc = __pyx_doc_7cgtypes_4vec3_16__mul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_16__mul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__div__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_18__div__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_18__div__.doc = __pyx_doc_7cgtypes_4vec3_18__div__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_18__div__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__mod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_20__mod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_20__mod__.doc = __pyx_doc_7cgtypes_4vec3_20__mod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_20__mod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__neg__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_22__neg__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_22__neg__.doc = __pyx_doc_7cgtypes_4vec3_22__neg__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_22__neg__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__pos__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_24__pos__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_24__pos__.doc = __pyx_doc_7cgtypes_4vec3_24__pos__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_24__pos__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__iadd__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_26__iadd__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_26__iadd__.doc = __pyx_doc_7cgtypes_4vec3_26__iadd__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_26__iadd__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_28__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_28__isub__.doc = __pyx_doc_7cgtypes_4vec3_28__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_28__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__imul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_30__imul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_30__imul__.doc = __pyx_doc_7cgtypes_4vec3_30__imul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_30__imul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__idiv__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_32__idiv__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_32__idiv__.doc = __pyx_doc_7cgtypes_4vec3_32__idiv__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_32__idiv__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__imod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_34__imod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_34__imod__.doc = __pyx_doc_7cgtypes_4vec3_34__imod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_34__imod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__abs__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_36__abs__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_36__abs__.doc = __pyx_doc_7cgtypes_4vec3_36__abs__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_36__abs__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_42__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_42__len__.doc = __pyx_doc_7cgtypes_4vec3_42__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_42__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_44__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_44__getitem__.doc = __pyx_doc_7cgtypes_4vec3_44__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_44__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec3, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec3_46__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec3_46__setitem__.doc = __pyx_doc_7cgtypes_4vec3_46__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec3_46__setitem__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "vec3", (PyObject *)&__pyx_type_7cgtypes_vec3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_vec3 = &__pyx_type_7cgtypes_vec3;
  if (PyType_Ready(&__pyx_type_7cgtypes_vec4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_vec4.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__add__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_12__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_12__add__.doc = __pyx_doc_7cgtypes_4vec4_12__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_12__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_14__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_14__sub__.doc = __pyx_doc_7cgtypes_4vec4_14__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_14__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__mul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_16__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_16__mul__.doc = __pyx_doc_7cgtypes_4vec4_16__mul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_16__mul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__div__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_18__div__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_18__div__.doc = __pyx_doc_7cgtypes_4vec4_18__div__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_18__div__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__mod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_20__mod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_20__mod__.doc = __pyx_doc_7cgtypes_4vec4_20__mod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_20__mod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__neg__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_22__neg__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_22__neg__.doc = __pyx_doc_7cgtypes_4vec4_22__neg__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_22__neg__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__pos__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_24__pos__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_24__pos__.doc = __pyx_doc_7cgtypes_4vec4_24__pos__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_24__pos__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__iadd__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_26__iadd__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_26__iadd__.doc = __pyx_doc_7cgtypes_4vec4_26__iadd__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_26__iadd__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_28__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_28__isub__.doc = __pyx_doc_7cgtypes_4vec4_28__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_28__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__imul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_30__imul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_30__imul__.doc = __pyx_doc_7cgtypes_4vec4_30__imul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_30__imul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__idiv__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_32__idiv__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_32__idiv__.doc = __pyx_doc_7cgtypes_4vec4_32__idiv__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_32__idiv__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__imod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_34__imod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_34__imod__.doc = __pyx_doc_7cgtypes_4vec4_34__imod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_34__imod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__abs__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_36__abs__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_36__abs__.doc = __pyx_doc_7cgtypes_4vec4_36__abs__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_36__abs__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_42__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_42__len__.doc = __pyx_doc_7cgtypes_4vec4_42__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_42__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_44__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_44__getitem__.doc = __pyx_doc_7cgtypes_4vec4_44__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_44__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_vec4, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4vec4_46__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4vec4_46__setitem__.doc = __pyx_doc_7cgtypes_4vec4_46__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4vec4_46__setitem__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "vec4", (PyObject *)&__pyx_type_7cgtypes_vec4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_vec4 = &__pyx_type_7cgtypes_vec4;
  if (PyType_Ready(&__pyx_type_7cgtypes_mat3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_mat3.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__add__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_12__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_12__add__.doc = __pyx_doc_7cgtypes_4mat3_12__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_12__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_14__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_14__sub__.doc = __pyx_doc_7cgtypes_4mat3_14__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_14__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__mul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_16__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_16__mul__.doc = __pyx_doc_7cgtypes_4mat3_16__mul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_16__mul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__div__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_18__div__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_18__div__.doc = __pyx_doc_7cgtypes_4mat3_18__div__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_18__div__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__mod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_20__mod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_20__mod__.doc = __pyx_doc_7cgtypes_4mat3_20__mod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_20__mod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__neg__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_22__neg__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_22__neg__.doc = __pyx_doc_7cgtypes_4mat3_22__neg__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_22__neg__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__iadd__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_26__iadd__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_26__iadd__.doc = __pyx_doc_7cgtypes_4mat3_26__iadd__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_26__iadd__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_28__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_28__isub__.doc = __pyx_doc_7cgtypes_4mat3_28__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_28__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__imul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_30__imul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_30__imul__.doc = __pyx_doc_7cgtypes_4mat3_30__imul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_30__imul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__idiv__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_32__idiv__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_32__idiv__.doc = __pyx_doc_7cgtypes_4mat3_32__idiv__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_32__idiv__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__imod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_34__imod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_34__imod__.doc = __pyx_doc_7cgtypes_4mat3_34__imod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_34__imod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_36__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_36__len__.doc = __pyx_doc_7cgtypes_4mat3_36__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_36__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_38__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_38__getitem__.doc = __pyx_doc_7cgtypes_4mat3_38__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_38__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat3, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat3_40__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat3_40__setitem__.doc = __pyx_doc_7cgtypes_4mat3_40__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat3_40__setitem__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "mat3", (PyObject *)&__pyx_type_7cgtypes_mat3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_mat3 = &__pyx_type_7cgtypes_mat3;
  if (PyType_Ready(&__pyx_type_7cgtypes_mat4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_mat4.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__add__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_12__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_12__add__.doc = __pyx_doc_7cgtypes_4mat4_12__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_12__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_14__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_14__sub__.doc = __pyx_doc_7cgtypes_4mat4_14__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_14__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__mul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_16__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_16__mul__.doc = __pyx_doc_7cgtypes_4mat4_16__mul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_16__mul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__div__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_18__div__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_18__div__.doc = __pyx_doc_7cgtypes_4mat4_18__div__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_18__div__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__mod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_20__mod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_20__mod__.doc = __pyx_doc_7cgtypes_4mat4_20__mod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_20__mod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__neg__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_22__neg__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_22__neg__.doc = __pyx_doc_7cgtypes_4mat4_22__neg__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_22__neg__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__pos__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_24__pos__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_24__pos__.doc = __pyx_doc_7cgtypes_4mat4_24__pos__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_24__pos__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__iadd__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_26__iadd__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_26__iadd__.doc = __pyx_doc_7cgtypes_4mat4_26__iadd__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_26__iadd__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_28__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_28__isub__.doc = __pyx_doc_7cgtypes_4mat4_28__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_28__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__imul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_30__imul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_30__imul__.doc = __pyx_doc_7cgtypes_4mat4_30__imul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_30__imul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__idiv__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_32__idiv__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_32__idiv__.doc = __pyx_doc_7cgtypes_4mat4_32__idiv__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_32__idiv__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__imod__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_34__imod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_34__imod__.doc = __pyx_doc_7cgtypes_4mat4_34__imod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_34__imod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__len__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_36__len__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_36__len__.doc = __pyx_doc_7cgtypes_4mat4_36__len__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_36__len__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__getitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_38__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_38__getitem__.doc = __pyx_doc_7cgtypes_4mat4_38__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_38__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_mat4, "__setitem__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4mat4_40__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4mat4_40__setitem__.doc = __pyx_doc_7cgtypes_4mat4_40__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4mat4_40__setitem__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "mat4", (PyObject *)&__pyx_type_7cgtypes_mat4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_mat4 = &__pyx_type_7cgtypes_mat4;
  if (PyType_Ready(&__pyx_type_7cgtypes_vec3iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_vec3iter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "vec3iter", (PyObject *)&__pyx_type_7cgtypes_vec3iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_vec3iter = &__pyx_type_7cgtypes_vec3iter;
  if (PyType_Ready(&__pyx_type_7cgtypes_vec4iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_vec4iter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "vec4iter", (PyObject *)&__pyx_type_7cgtypes_vec4iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_vec4iter = &__pyx_type_7cgtypes_vec4iter;
  if (PyType_Ready(&__pyx_type_7cgtypes_mat3iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_mat3iter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "mat3iter", (PyObject *)&__pyx_type_7cgtypes_mat3iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_mat3iter = &__pyx_type_7cgtypes_mat3iter;
  if (PyType_Ready(&__pyx_type_7cgtypes_mat4iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_mat4iter.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "mat4iter", (PyObject *)&__pyx_type_7cgtypes_mat4iter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_mat4iter = &__pyx_type_7cgtypes_mat4iter;
  if (PyType_Ready(&__pyx_type_7cgtypes_quat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7cgtypes_quat.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__add__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_10__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_10__add__.doc = __pyx_doc_7cgtypes_4quat_10__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_10__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__sub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_12__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_12__sub__.doc = __pyx_doc_7cgtypes_4quat_12__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_12__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__mul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_14__mul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_14__mul__.doc = __pyx_doc_7cgtypes_4quat_14__mul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_14__mul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__div__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_16__div__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_16__div__.doc = __pyx_doc_7cgtypes_4quat_16__div__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_16__div__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__pow__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_18__pow__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_18__pow__.doc = __pyx_doc_7cgtypes_4quat_18__pow__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_18__pow__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__neg__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_20__neg__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_20__neg__.doc = __pyx_doc_7cgtypes_4quat_20__neg__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_20__neg__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__pos__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_22__pos__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_22__pos__.doc = __pyx_doc_7cgtypes_4quat_22__pos__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_22__pos__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__iadd__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_24__iadd__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_24__iadd__.doc = __pyx_doc_7cgtypes_4quat_24__iadd__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_24__iadd__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__isub__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_26__isub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_26__isub__.doc = __pyx_doc_7cgtypes_4quat_26__isub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_26__isub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__imul__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_28__imul__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_28__imul__.doc = __pyx_doc_7cgtypes_4quat_28__imul__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_28__imul__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__idiv__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_30__idiv__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_30__idiv__.doc = __pyx_doc_7cgtypes_4quat_30__idiv__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_30__idiv__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_7cgtypes_quat, "__abs__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_7cgtypes_4quat_36__abs__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_7cgtypes_4quat_36__abs__.doc = __pyx_doc_7cgtypes_4quat_36__abs__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_7cgtypes_4quat_36__abs__;
    }
  }
  #endif
  if (PyObject_SetAttrString(__pyx_m, "quat", (PyObject *)&__pyx_type_7cgtypes_quat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cgtypes_quat = &__pyx_type_7cgtypes_quat;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "cgtypes.pyx":27
 * # Threshold for comparisons
 * cdef double eps
 * eps = 1E-16             # <<<<<<<<<<<<<<
 * 
 * # Forward declarations
 */
  __pyx_v_7cgtypes_eps = 1E-16;

  /* "cgtypes.pyx":49
 * 
 * # setEpsilon
 * def setEpsilon(e):             # <<<<<<<<<<<<<<
 *     """Sets a new epsilon threshold value.
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_1setEpsilon, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setEpsilon, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":61
 * 
 * # getEpsilon
 * def getEpsilon():             # <<<<<<<<<<<<<<
 *     """Return the epsilon threshold which is used for doing comparisons."""
 *     return eps
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_3getEpsilon, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getEpsilon, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":5055
 * 
 * 
 * def slerp(double t, quat q0, quat q1):             # <<<<<<<<<<<<<<
 *     """Spherical linear interpolation between two quaternions.
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_5slerp, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_slerp, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":5074
 *     return q0*a + q1*b
 * 
 * def squad(double t, quat a, quat b, quat c, quat d):             # <<<<<<<<<<<<<<
 *     """Spherical cubic interpolation."""
 *     return slerp(2*t*(1.0-t), slerp(t,a,d), slerp(t,b,c))
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_7squad, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_squad, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":5080
 * ######################################################################
 * 
 * import sys             # <<<<<<<<<<<<<<
 * if sys.version_info[0] >= 3:
 *     import copyreg as copy_reg
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cgtypes.pyx":5081
 * 
 * import sys
 * if sys.version_info[0] >= 3:             # <<<<<<<<<<<<<<
 *     import copyreg as copy_reg
 * else:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5081; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cgtypes.pyx":5082
 * import sys
 * if sys.version_info[0] >= 3:
 *     import copyreg as copy_reg             # <<<<<<<<<<<<<<
 * else:
 *     import copy_reg
 */
    __pyx_t_2 = __Pyx_Import(__pyx_n_s_copyreg, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy_reg, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "cgtypes.pyx":5084
 *     import copyreg as copy_reg
 * else:
 *     import copy_reg             # <<<<<<<<<<<<<<
 * 
 * def _vec3construct(x,y,z):
 */
    __pyx_t_2 = __Pyx_Import(__pyx_n_s_copy_reg, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy_reg, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L2:;

  /* "cgtypes.pyx":5086
 *     import copy_reg
 * 
 * def _vec3construct(x,y,z):             # <<<<<<<<<<<<<<
 *     return vec3(x,y,z)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_9_vec3construct, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vec3construct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5089
 *     return vec3(x,y,z)
 * 
 * def _vec4construct(x,y,z,w):             # <<<<<<<<<<<<<<
 *     return vec4(x,y,z,w)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_11_vec4construct, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vec4construct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5092
 *     return vec4(x,y,z,w)
 * 
 * def _mat3construct(b1,b2,b3):             # <<<<<<<<<<<<<<
 *     return mat3(b1,b2,b3)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_13_mat3construct, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mat3construct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5095
 *     return mat3(b1,b2,b3)
 * 
 * def _mat4construct(b1,b2,b3,b4):             # <<<<<<<<<<<<<<
 *     return mat4(b1,b2,b3,b4)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_15_mat4construct, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mat4construct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5095; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5098
 *     return mat4(b1,b2,b3,b4)
 * 
 * def _quatconstruct(w,x,y,z):             # <<<<<<<<<<<<<<
 *     return quat(w,x,y,z)
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7cgtypes_17_quatconstruct, NULL, __pyx_n_s_cgtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_quatconstruct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5101
 *     return quat(w,x,y,z)
 * 
 * copy_reg.constructor(_vec3construct)             # <<<<<<<<<<<<<<
 * copy_reg.constructor(_vec4construct)
 * copy_reg.constructor(_mat3construct)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy_reg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constructor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_vec3construct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5102
 * 
 * copy_reg.constructor(_vec3construct)
 * copy_reg.constructor(_vec4construct)             # <<<<<<<<<<<<<<
 * copy_reg.constructor(_mat3construct)
 * copy_reg.constructor(_mat4construct)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy_reg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_constructor); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_vec4construct); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5103
 * copy_reg.constructor(_vec3construct)
 * copy_reg.constructor(_vec4construct)
 * copy_reg.constructor(_mat3construct)             # <<<<<<<<<<<<<<
 * copy_reg.constructor(_mat4construct)
 * copy_reg.constructor(_quatconstruct)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy_reg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_constructor); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_mat3construct); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5104
 * copy_reg.constructor(_vec4construct)
 * copy_reg.constructor(_mat3construct)
 * copy_reg.constructor(_mat4construct)             # <<<<<<<<<<<<<<
 * copy_reg.constructor(_quatconstruct)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy_reg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_constructor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_mat4construct); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":5105
 * copy_reg.constructor(_mat3construct)
 * copy_reg.constructor(_mat4construct)
 * copy_reg.constructor(_quatconstruct)             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy_reg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constructor); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_quatconstruct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cgtypes.pyx":1
 * # -*- coding: utf-8 -*-             # <<<<<<<<<<<<<<
 * ######################################################################
 * # cgtypes - vec3, vec4, mat3, mat4, quat
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___add___line_258, __pyx_kp_u_Vector_addition_a_vec3_1_0_0_5_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___sub___line_273, __pyx_kp_u_Vector_subtraction_a_vec3_1_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___mul___line_288, __pyx_kp_u_Multiplication_with_a_scalar_or) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___div___line_340, __pyx_kp_u_Division_by_scalar_a_vec3_1_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___mod___line_365, __pyx_kp_u_Modulo_component_wise_a_vec3_3_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___neg___line_400, __pyx_kp_u_Negation_a_vec3_3_0_2_5_1_8_prin) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___pos___line_414, __pyx_kp_u_a_vec3_3_0_2_5_1_8_print_a_3_00) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___iadd___line_428, __pyx_kp_u_Inline_vector_addition_a_vec3_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___isub___line_442, __pyx_kp_u_Inline_vector_subtraction_a_vec3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___imul___line_456, __pyx_kp_u_Inline_multiplication_only_with) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___idiv___line_475, __pyx_kp_u_Inline_division_with_scalar_a_ve) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___imod___line_496, __pyx_kp_u_Inline_modulo_a_vec3_3_0_2_5_1_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___abs___line_531, __pyx_kp_u_Return_the_length_of_the_vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___getitem___line_568, __pyx_kp_u_Return_a_component_by_index_0_ba) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3___setitem___line_592, __pyx_kp_u_Set_a_component_by_index_0_based) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_cross_line_613, __pyx_kp_u_Cross_product_a_vec3_1_0_0_5_1_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_length_line_633, __pyx_kp_u_Return_the_length_of_the_vector_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_normalize_line_646, __pyx_kp_u_Return_normalized_vector_a_vec3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_angle_line_666, __pyx_kp_u_Return_angle_in_radians_between) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_reflect_line_693, __pyx_kp_u_Return_the_reflection_vector_N_i) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_refract_line_712, __pyx_kp_u_Return_the_transmitted_vector_N) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec3_ortho_line_744, __pyx_kp_u_Returns_an_orthogonal_vector_Ret) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___add___line_1008, __pyx_kp_u_Vector_addition_a_vec4_1_0_0_5_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___sub___line_1024, __pyx_kp_u_Vector_subtraction_a_vec4_1_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___mul___line_1040, __pyx_kp_u_Multiplication_with_a_scalar_or_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___div___line_1091, __pyx_kp_u_Division_by_scalar_a_vec4_1_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___mod___line_1118, __pyx_kp_u_Modulo_component_wise_a_vec4_3_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___neg___line_1156, __pyx_kp_u_Negation_a_vec4_3_0_2_5_1_8_0_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___pos___line_1171, __pyx_kp_u_a_vec4_3_0_2_5_1_8_0_2_print_a) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___iadd___line_1185, __pyx_kp_u_Inline_vector_addition_a_vec4_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___isub___line_1200, __pyx_kp_u_Inline_vector_subtraction_a_vec4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___imul___line_1215, __pyx_kp_u_Inline_multiplication_only_with_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___idiv___line_1235, __pyx_kp_u_Inline_division_with_scalar_a_ve_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___imod___line_1257, __pyx_kp_u_Inline_modulo_a_vec4_3_0_2_5_1_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___abs___line_1295, __pyx_kp_u_Return_the_length_of_the_vector_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___getitem___line_1336, __pyx_kp_u_Return_a_component_by_index_0_ba_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4___setitem___line_1363, __pyx_kp_u_Set_a_component_by_index_0_based_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4_length_line_1385, __pyx_kp_u_Return_the_length_of_the_vector_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_vec4_normalize_line_1398, __pyx_kp_u_Return_normalized_vector_a_vec4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___add___line_2821, __pyx_kp_u_Matrix_addition_M_mat4_1_2_3_4_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___sub___line_2851, __pyx_kp_u_Matrix_subtraction_M_mat4_1_2_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___mul___line_2881, __pyx_kp_u_Multiplication_M_mat4_1_2_3_4_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___div___line_3038, __pyx_kp_u_Division_M_mat4_1_2_3_4_5_6_7_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___mod___line_3079, __pyx_kp_u_Modulo_M_mat4_1_2_3_4_5_6_7_8_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___neg___line_3152, __pyx_kp_u_Negation_M_mat4_1_2_3_4_5_6_7_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4___pos___line_3182, __pyx_kp_u_M_mat4_1_2_3_4_5_6_7_8_9_10_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4_toList_line_3669, __pyx_kp_u_Return_a_list_containing_the_mat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4_identity_line_3694, __pyx_kp_u_Return_identity_matrix_print_mat) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4_transpose_line_3723, __pyx_kp_u_Return_transpose_matrix_M_mat4_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4_determinant_line_3753, __pyx_kp_u_Return_determinant_M_mat4_2_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_mat4_inverse_line_3825, __pyx_kp_u_Return_inverse_matrix_M_mat4_0_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___add___line_4526, __pyx_kp_u_Addition_q_quat_0_9689_0_2160_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___sub___line_4541, __pyx_kp_u_Subtraction_q_quat_0_9689_0_2160) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___mul___line_4556, __pyx_kp_u_Multiplication_q_quat_0_9689_0_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___div___line_4607, __pyx_kp_u_Division_q_quat_0_9689_0_2160_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___neg___line_4641, __pyx_kp_u_Negation_q_quat_0_9689_0_2160_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___pos___line_4656, __pyx_kp_u_q_quat_0_9689_0_2160_0_1080_0_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat___abs___line_4764, __pyx_kp_u_Return_magnitude_q_quat_0_9689_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat_conjugate_line_4775, __pyx_kp_u_Return_conjugate_q_quat_0_9689_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat_normalize_line_4790, __pyx_kp_u_Return_normalized_quaternion_q_q) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat_inverse_line_4815, __pyx_kp_u_Return_inverse_q_quat_0_9_0_5_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_quat_toAngleAxis_line_4836, __pyx_kp_u_Return_angle_in_radians_and_rota) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init cgtypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cgtypes");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY
    float_value = PyNumber_Float(obj);
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return -1;
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        func_type value = func_value;                                     \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                if (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
