Code cleanup: spelling fix, Tesselection->tesselation
[blender.git] / source / blender / python / mathutils / mathutils_Vector.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  *
22  * Contributor(s): Willian P. Germano, Joseph Gilbert, Ken Hughes, Alex Fraser, Campbell Barton
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/python/mathutils/mathutils_Vector.c
28  *  \ingroup pymathutils
29  */
30
31
32 #include <Python.h>
33
34 #include "mathutils.h"
35
36 #include "BLI_math.h"
37 #include "BLI_utildefines.h"
38 #include "BLI_dynstr.h"
39
40 #define MAX_DIMENSIONS 4
41
42 /* Swizzle axes get packed into a single value that is used as a closure. Each
43    axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is
44    used as a sentinel: if it is unset, the axis is not valid. */
45 #define SWIZZLE_BITS_PER_AXIS 3
46 #define SWIZZLE_VALID_AXIS 0x4
47 #define SWIZZLE_AXIS       0x3
48
49 static PyObject *Vector_copy(VectorObject *self);
50 static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits);
51 static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat);
52
53 /* Supports 2D, 3D, and 4D vector objects both int and float values
54  * accepted. Mixed float and int values accepted. Ints are parsed to float
55  */
56 static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds))
57 {
58         float *vec = NULL;
59         int size = 3; /* default to a 3D vector */
60
61         switch (PyTuple_GET_SIZE(args)) {
62         case 0:
63                 vec = PyMem_Malloc(size * sizeof(float));
64
65                 if (vec == NULL) {
66                         PyErr_SetString(PyExc_MemoryError,
67                                                         "Vector(): "
68                                                         "problem allocating pointer space");
69                         return NULL;
70                 }
71
72                 fill_vn_fl(vec, size, 0.0f);
73                 break;
74         case 1:
75                 if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
76                         if (vec) {
77                                 PyMem_Free(vec);
78                         }
79                         return NULL;
80                 }
81                 break;
82         default:
83                 PyErr_SetString(PyExc_TypeError,
84                                 "mathutils.Vector(): "
85                                 "more then a single arg given");
86                 return NULL;
87         }
88         return Vector_CreatePyObject(vec, size, Py_NEW, type);
89 }
90
91 static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self)
92 {
93         PyObject *ret = Vector_copy(self);
94         PyObject *ret_dummy = vec_func(ret);
95         if (ret_dummy) {
96                 Py_DECREF(ret_dummy);
97                 return (PyObject *)ret;
98         }
99         else { /* error */
100                 Py_DECREF(ret);
101                 return NULL;
102         }
103 }
104
105 /*-----------------------CLASS-METHODS----------------------------*/
106 PyDoc_STRVAR(C_Vector_Fill_doc,
107 ".. classmethod:: Fill(size, fill=0.0)\n"
108 "\n"
109 "   Create a vector of length size with all values set to fill.\n"
110 "\n"
111 "   :arg size: The length of the vector to be created.\n"
112 "   :type size: int\n"
113 "   :arg fill: The value used to fill the vector.\n"
114 "   :type fill: float\n"
115 );
116 static PyObject *C_Vector_Fill(PyObject *cls, PyObject *args)
117 {
118         float *vec;
119         int size;
120         float fill = 0.0f;
121
122         if (!PyArg_ParseTuple(args, "i|f:Vector.Fill", &size, &fill)) {
123                 return NULL;
124         }
125
126         if (size < 2) {
127                 PyErr_SetString(PyExc_RuntimeError,
128                                 "Vector(): invalid size");
129                 return NULL;
130         }
131
132         vec = PyMem_Malloc(size * sizeof(float));
133
134         if (vec == NULL) {
135                 PyErr_SetString(PyExc_MemoryError,
136                                                 "Vector.Fill(): "
137                                 "problem allocating pointer space");
138                 return NULL;
139         }
140
141         fill_vn_fl(vec, size, fill);
142
143         return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
144 }
145
146 PyDoc_STRVAR(C_Vector_Range_doc,
147 ".. classmethod:: Range(start=0, stop, step=1)\n"
148 "\n"
149 "   Create a filled with a range of values.\n"
150 "\n"
151 "   :arg start: The start of the range used to fill the vector.\n"
152 "   :type start: int\n"
153 "   :arg stop: The end of the range used to fill the vector.\n"
154 "   :type stop: int\n"
155 "   :arg step: The step between successive values in the vector.\n"
156 "   :type step: int\n"
157 );
158 static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
159 {
160         float *vec;
161         int stop, size;
162         int start = 0;
163         int step = 1;
164
165         if (!PyArg_ParseTuple(args, "i|ii:Vector.Range", &start, &stop, &step)) {
166                 return NULL;
167         }
168
169         switch (PyTuple_GET_SIZE(args)) {
170         case 1:
171                 size = start;
172                 start = 0;
173                 break;
174         case 2:
175                 if (start >= stop) {
176                         PyErr_SetString(PyExc_RuntimeError,
177                                         "Start value is larger "
178                                         "than the stop value");
179                         return NULL;
180                 }
181
182                 size = stop - start;
183                 break;
184         default:
185                 if (start >= stop) {
186                         PyErr_SetString(PyExc_RuntimeError,
187                                         "Start value is larger "
188                                         "than the stop value");
189                         return NULL;
190                 }
191
192                 size = (stop - start);
193
194                 if ((size % step) != 0)
195                         size += step;
196
197                 size /= step;
198
199                 break;
200         }
201
202         if (size < 2) {
203                 PyErr_SetString(PyExc_RuntimeError,
204                                 "Vector(): invalid size");
205                 return NULL;
206         }
207
208         vec = PyMem_Malloc(size * sizeof(float));
209
210         if (vec == NULL) {
211                 PyErr_SetString(PyExc_MemoryError,
212                                 "Vector.Range(): "
213                                 "problem allocating pointer space");
214                 return NULL;
215         }
216
217         range_vn_fl(vec, size, (float)start, (float)step);
218
219         return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
220 }
221
222 PyDoc_STRVAR(C_Vector_Linspace_doc,
223 ".. classmethod:: Linspace(start, stop, size)\n"
224 "\n"
225 "   Create a vector of the specified size which is filled with linearly spaced values between start and stop values.\n"
226 "\n"
227 "   :arg start: The start of the range used to fill the vector.\n"
228 "   :type start: int\n"
229 "   :arg stop: The end of the range used to fill the vector.\n"
230 "   :type stop: int\n"
231 "   :arg size: The size of the vector to be created.\n"
232 "   :type size: int\n"
233 );
234 static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
235 {
236         float *vec;
237         int size;
238         float start, end, step;
239
240         if (!PyArg_ParseTuple(args, "ffi:Vector.Linspace", &start, &end, &size)) {
241                 return NULL;
242         }
243
244         if (size < 2) {
245                 PyErr_SetString(PyExc_RuntimeError,
246                                 "Vector.Linspace(): invalid size");
247                 return NULL;
248         }
249
250         step = (end - start)/(float)(size-1);
251
252         vec = PyMem_Malloc(size * sizeof(float));
253
254         if (vec == NULL) {
255                 PyErr_SetString(PyExc_MemoryError,
256                                 "Vector.Linspace(): "
257                                 "problem allocating pointer space");
258                 return NULL;
259         }
260
261         range_vn_fl(vec, size, start, step);
262
263         return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
264 }
265
266 PyDoc_STRVAR(C_Vector_Repeat_doc,
267 ".. classmethod:: Repeat(vector, size)\n"
268 "\n"
269 "   Create a vector by repeating the values in vector until the required size is reached.\n"
270 "\n"
271 "   :arg tuple: The vector to draw values from.\n"
272 "   :type tuple: :class:`mathutils.Vector`\n"
273 "   :arg size: The size of the vector to be created.\n"
274 "   :type size: int\n"
275 );
276 static PyObject *C_Vector_Repeat(PyObject *cls, PyObject *args)
277 {
278         float *vec;
279         float *iter_vec = NULL;
280         int i, size, value_size;
281         PyObject *value;
282
283         if (!PyArg_ParseTuple(args, "Oi:Vector.Repeat", &value, &size)) {
284                 return NULL;
285         }
286
287         if (size < 2) {
288                 PyErr_SetString(PyExc_RuntimeError,
289                                 "Vector.Repeat(): invalid size");
290                 return NULL;
291         }
292
293         if ((value_size = mathutils_array_parse_alloc(&iter_vec, 2, value,
294                                                       "Vector.Repeat(vector, size), invalid 'vector' arg")) == -1)
295         {
296                 PyMem_Free(iter_vec);
297                 return NULL;
298         }
299
300         if (iter_vec == NULL) {
301                 PyErr_SetString(PyExc_MemoryError,
302                                 "Vector.Repeat(): "
303                                 "problem allocating pointer space");
304                 return NULL;
305         }
306
307         vec = PyMem_Malloc(size * sizeof(float));
308
309         if (vec == NULL) {
310                 PyErr_SetString(PyExc_MemoryError,
311                                 "Vector.Repeat(): "
312                                 "problem allocating pointer space");
313                 return NULL;
314         }
315
316         i = 0;
317         while (i < size) {
318                 vec[i] = iter_vec[i % value_size];
319                 i++;
320         }
321
322         PyMem_Free(iter_vec);
323
324         return Vector_CreatePyObject_alloc(vec, size, (PyTypeObject *)cls);
325 }
326
327 /*-----------------------------METHODS---------------------------- */
328 PyDoc_STRVAR(Vector_zero_doc,
329 ".. method:: zero()\n"
330 "\n"
331 "   Set all values to zero.\n"
332 );
333 static PyObject *Vector_zero(VectorObject *self)
334 {
335         fill_vn_fl(self->vec, self->size, 0.0f);
336
337         if (BaseMath_WriteCallback(self) == -1)
338                 return NULL;
339
340         Py_RETURN_NONE;
341 }
342
343 PyDoc_STRVAR(Vector_normalize_doc,
344 ".. method:: normalize()\n"
345 "\n"
346 "   Normalize the vector, making the length of the vector always 1.0.\n"
347 "\n"
348 "   .. warning:: Normalizing a vector where all values are zero has no effect.\n"
349 "\n"
350 "   .. note:: Normalize works for vectors of all sizes,\n"
351 "      however 4D Vectors w axis is left untouched.\n"
352 );
353 static PyObject *Vector_normalize(VectorObject *self)
354 {
355         int size = (self->size == 4 ? 3 : self->size);
356         if (BaseMath_ReadCallback(self) == -1)
357                 return NULL;
358
359         normalize_vn(self->vec, size);
360
361         (void)BaseMath_WriteCallback(self);
362         Py_RETURN_NONE;
363 }
364 PyDoc_STRVAR(Vector_normalized_doc,
365 ".. method:: normalized()\n"
366 "\n"
367 "   Return a new, normalized vector.\n"
368 "\n"
369 "   :return: a normalized copy of the vector\n"
370 "   :rtype: :class:`Vector`\n"
371 );
372 static PyObject *Vector_normalized(VectorObject *self)
373 {
374         return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self);
375 }
376
377 PyDoc_STRVAR(Vector_resize_doc,
378 ".. method:: resize(size=3)\n"
379 "\n"
380 "   Resize the vector to have size number of elements.\n"
381 "\n"
382 "   :return: an instance of itself\n"
383 "   :rtype: :class:`Vector`\n"
384 );
385 static PyObject *Vector_resize(VectorObject *self, PyObject *value)
386 {
387         int size;
388
389         if (self->wrapped == Py_WRAP) {
390                 PyErr_SetString(PyExc_TypeError,
391                                 "Vector.resize(): "
392                                 "cannot resize wrapped data - only python vectors");
393                 return NULL;
394         }
395         if (self->cb_user) {
396                 PyErr_SetString(PyExc_TypeError,
397                                 "Vector.resize(): "
398                                 "cannot resize a vector that has an owner");
399                 return NULL;
400         }
401
402         if ((size = PyLong_AsLong(value)) == -1) {
403                 PyErr_SetString(PyExc_TypeError,
404                                 "Vector.resize(size): "
405                                 "expected size argument to be an integer");
406                 return NULL;
407         }
408
409         if (size < 2) {
410                 PyErr_SetString(PyExc_RuntimeError,
411                                 "Vector.resize(): invalid size");
412                 return NULL;
413         }
414
415         self->vec = PyMem_Realloc(self->vec, (size * sizeof(float)));
416         if (self->vec == NULL) {
417                 PyErr_SetString(PyExc_MemoryError,
418                                                 "Vector.resize(): "
419                                 "problem allocating pointer space");
420                 return NULL;
421         }
422
423         /* If the vector has increased in length, set all new elements to 0.0f */
424         if (size > self->size) {
425                 fill_vn_fl(self->vec + self->size, size - self->size, 0.0f);
426         }
427
428         self->size = size;
429         Py_RETURN_NONE;
430 }
431
432 PyDoc_STRVAR(Vector_resized_doc,
433 ".. method:: resized(size=3)\n"
434 "\n"
435 "   Return a resized copy of the vector with size number of elements.\n"
436 "\n"
437 "   :return: a new vector\n"
438 "   :rtype: :class:`Vector`\n"
439 );
440 static PyObject *Vector_resized(VectorObject *self, PyObject *value)
441 {
442         int size;
443         float *vec;
444
445         /*if (!PyArg_ParseTuple(args, "i:resize", &size))
446                 return NULL;*/
447         if ((size = PyLong_AsLong(value)) == -1) {
448                 return NULL;
449         }
450
451         if (size < 2) {
452                 PyErr_SetString(PyExc_RuntimeError,
453                                 "Vector.resized(): invalid size");
454                 return NULL;
455         }
456
457         vec = PyMem_Malloc(size * sizeof(float));
458
459         if (vec == NULL) {
460                 PyErr_SetString(PyExc_MemoryError,
461                                 "Vector.resized(): "
462                                 "problem allocating pointer space");
463                 return NULL;
464         }
465
466         fill_vn_fl(vec, size, 0.0f);
467         memcpy(vec, self->vec, self->size * sizeof(float));
468
469         return Vector_CreatePyObject_alloc(vec, size, NULL);
470 }
471
472 PyDoc_STRVAR(Vector_resize_2d_doc,
473 ".. method:: resize_2d()\n"
474 "\n"
475 "   Resize the vector to 2D  (x, y).\n"
476 "\n"
477 "   :return: an instance of itself\n"
478 "   :rtype: :class:`Vector`\n"
479 );
480 static PyObject *Vector_resize_2d(VectorObject *self)
481 {
482         if (self->wrapped == Py_WRAP) {
483                 PyErr_SetString(PyExc_TypeError,
484                                 "Vector.resize_2d(): "
485                                 "cannot resize wrapped data - only python vectors");
486                 return NULL;
487         }
488         if (self->cb_user) {
489                 PyErr_SetString(PyExc_TypeError,
490                                 "Vector.resize_2d(): "
491                                 "cannot resize a vector that has an owner");
492                 return NULL;
493         }
494
495         self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2));
496         if (self->vec == NULL) {
497                 PyErr_SetString(PyExc_MemoryError,
498                                 "Vector.resize_2d(): "
499                                 "problem allocating pointer space");
500                 return NULL;
501         }
502
503         self->size = 2;
504         Py_RETURN_NONE;
505 }
506
507 PyDoc_STRVAR(Vector_resize_3d_doc,
508 ".. method:: resize_3d()\n"
509 "\n"
510 "   Resize the vector to 3D  (x, y, z).\n"
511 "\n"
512 "   :return: an instance of itself\n"
513 "   :rtype: :class:`Vector`\n"
514 );
515 static PyObject *Vector_resize_3d(VectorObject *self)
516 {
517         if (self->wrapped == Py_WRAP) {
518                 PyErr_SetString(PyExc_TypeError,
519                                 "Vector.resize_3d(): "
520                                 "cannot resize wrapped data - only python vectors");
521                 return NULL;
522         }
523         if (self->cb_user) {
524                 PyErr_SetString(PyExc_TypeError,
525                                 "Vector.resize_3d(): "
526                                 "cannot resize a vector that has an owner");
527                 return NULL;
528         }
529
530         self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3));
531         if (self->vec == NULL) {
532                 PyErr_SetString(PyExc_MemoryError,
533                                 "Vector.resize_3d(): "
534                                 "problem allocating pointer space");
535                 return NULL;
536         }
537
538         if (self->size == 2)
539                 self->vec[2] = 0.0f;
540
541         self->size = 3;
542         Py_RETURN_NONE;
543 }
544
545 PyDoc_STRVAR(Vector_resize_4d_doc,
546 ".. method:: resize_4d()\n"
547 "\n"
548 "   Resize the vector to 4D (x, y, z, w).\n"
549 "\n"
550 "   :return: an instance of itself\n"
551 "   :rtype: :class:`Vector`\n"
552 );
553 static PyObject *Vector_resize_4d(VectorObject *self)
554 {
555         if (self->wrapped == Py_WRAP) {
556                 PyErr_SetString(PyExc_TypeError,
557                                 "Vector.resize_4d(): "
558                                 "cannot resize wrapped data - only python vectors");
559                 return NULL;
560         }
561         if (self->cb_user) {
562                 PyErr_SetString(PyExc_TypeError,
563                                 "Vector.resize_4d(): "
564                                 "cannot resize a vector that has an owner");
565                 return NULL;
566         }
567
568         self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4));
569         if (self->vec == NULL) {
570                 PyErr_SetString(PyExc_MemoryError,
571                                 "Vector.resize_4d(): "
572                                 "problem allocating pointer space");
573                 return NULL;
574         }
575
576         if (self->size == 2) {
577                 self->vec[2] = 0.0f;
578                 self->vec[3] = 1.0f;
579         }
580         else if (self->size == 3) {
581                 self->vec[3] = 1.0f;
582         }
583         self->size = 4;
584         Py_RETURN_NONE;
585 }
586 PyDoc_STRVAR(Vector_to_2d_doc,
587 ".. method:: to_2d()\n"
588 "\n"
589 "   Return a 2d copy of the vector.\n"
590 "\n"
591 "   :return: a new vector\n"
592 "   :rtype: :class:`Vector`\n"
593 );
594 static PyObject *Vector_to_2d(VectorObject *self)
595 {
596         if (BaseMath_ReadCallback(self) == -1)
597                 return NULL;
598
599         return Vector_CreatePyObject(self->vec, 2, Py_NEW, Py_TYPE(self));
600 }
601 PyDoc_STRVAR(Vector_to_3d_doc,
602 ".. method:: to_3d()\n"
603 "\n"
604 "   Return a 3d copy of the vector.\n"
605 "\n"
606 "   :return: a new vector\n"
607 "   :rtype: :class:`Vector`\n"
608 );
609 static PyObject *Vector_to_3d(VectorObject *self)
610 {
611         float tvec[3] = {0.0f};
612
613         if (BaseMath_ReadCallback(self) == -1)
614                 return NULL;
615
616         memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3));
617         return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(self));
618 }
619 PyDoc_STRVAR(Vector_to_4d_doc,
620 ".. method:: to_4d()\n"
621 "\n"
622 "   Return a 4d copy of the vector.\n"
623 "\n"
624 "   :return: a new vector\n"
625 "   :rtype: :class:`Vector`\n"
626 );
627 static PyObject *Vector_to_4d(VectorObject *self)
628 {
629         float tvec[4] = {0.0f, 0.0f, 0.0f, 1.0f};
630
631         if (BaseMath_ReadCallback(self) == -1)
632                 return NULL;
633
634         memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 4));
635         return Vector_CreatePyObject(tvec, 4, Py_NEW, Py_TYPE(self));
636 }
637
638 PyDoc_STRVAR(Vector_to_tuple_doc,
639 ".. method:: to_tuple(precision=-1)\n"
640 "\n"
641 "   Return this vector as a tuple with.\n"
642 "\n"
643 "   :arg precision: The number to round the value to in [-1, 21].\n"
644 "   :type precision: int\n"
645 "   :return: the values of the vector rounded by *precision*\n"
646 "   :rtype: tuple\n"
647 );
648 /* note: BaseMath_ReadCallback must be called beforehand */
649 static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
650 {
651         PyObject *ret;
652         int i;
653
654         ret = PyTuple_New(self->size);
655
656         if (ndigits >= 0) {
657                 for (i = 0; i < self->size; i++) {
658                         PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->vec[i], ndigits)));
659                 }
660         }
661         else {
662                 for (i = 0; i < self->size; i++) {
663                         PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->vec[i]));
664                 }
665         }
666
667         return ret;
668 }
669
670 static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args)
671 {
672         int ndigits = 0;
673
674         if (!PyArg_ParseTuple(args, "|i:to_tuple", &ndigits))
675                 return NULL;
676
677         if (ndigits > 22 || ndigits < 0) {
678                 PyErr_SetString(PyExc_ValueError,
679                                 "Vector.to_tuple(ndigits): "
680                                 "ndigits must be between 0 and 21");
681                 return NULL;
682         }
683
684         if (PyTuple_GET_SIZE(args) == 0)
685                 ndigits = -1;
686
687         if (BaseMath_ReadCallback(self) == -1)
688                 return NULL;
689
690         return Vector_to_tuple_ext(self, ndigits);
691 }
692
693 PyDoc_STRVAR(Vector_to_track_quat_doc,
694 ".. method:: to_track_quat(track, up)\n"
695 "\n"
696 "   Return a quaternion rotation from the vector and the track and up axis.\n"
697 "\n"
698 "   :arg track: Track axis in ['X', 'Y', 'Z', '-X', '-Y', '-Z'].\n"
699 "   :type track: string\n"
700 "   :arg up: Up axis in ['X', 'Y', 'Z'].\n"
701 "   :type up: string\n"
702 "   :return: rotation from the vector and the track and up axis.\n"
703 "   :rtype: :class:`Quaternion`\n"
704 );
705 static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
706 {
707         float vec[3], quat[4];
708         const char *strack, *sup;
709         short track = 2, up = 1;
710
711         if (!PyArg_ParseTuple(args, "|ss:to_track_quat", &strack, &sup))
712                 return NULL;
713
714         if (self->size != 3) {
715                 PyErr_SetString(PyExc_TypeError,
716                                 "Vector.to_track_quat(): "
717                                 "only for 3D vectors");
718                 return NULL;
719         }
720
721         if (BaseMath_ReadCallback(self) == -1)
722                 return NULL;
723
724         if (strack) {
725                 const char *axis_err_msg = "only X, -X, Y, -Y, Z or -Z for track axis";
726
727                 if (strlen(strack) == 2) {
728                         if (strack[0] == '-') {
729                                 switch (strack[1]) {
730                                         case 'X':
731                                                 track = 3;
732                                                 break;
733                                         case 'Y':
734                                                 track = 4;
735                                                 break;
736                                         case 'Z':
737                                                 track = 5;
738                                                 break;
739                                         default:
740                                                 PyErr_SetString(PyExc_ValueError, axis_err_msg);
741                                                 return NULL;
742                                 }
743                         }
744                         else {
745                                 PyErr_SetString(PyExc_ValueError, axis_err_msg);
746                                 return NULL;
747                         }
748                 }
749                 else if (strlen(strack) == 1) {
750                         switch (strack[0]) {
751                         case '-':
752                         case 'X':
753                                 track = 0;
754                                 break;
755                         case 'Y':
756                                 track = 1;
757                                 break;
758                         case 'Z':
759                                 track = 2;
760                                 break;
761                         default:
762                                 PyErr_SetString(PyExc_ValueError, axis_err_msg);
763                                 return NULL;
764                         }
765                 }
766                 else {
767                         PyErr_SetString(PyExc_ValueError, axis_err_msg);
768                         return NULL;
769                 }
770         }
771
772         if (sup) {
773                 const char *axis_err_msg = "only X, Y or Z for up axis";
774                 if (strlen(sup) == 1) {
775                         switch (*sup) {
776                         case 'X':
777                                 up = 0;
778                                 break;
779                         case 'Y':
780                                 up = 1;
781                                 break;
782                         case 'Z':
783                                 up = 2;
784                                 break;
785                         default:
786                                 PyErr_SetString(PyExc_ValueError, axis_err_msg);
787                                 return NULL;
788                         }
789                 }
790                 else {
791                         PyErr_SetString(PyExc_ValueError, axis_err_msg);
792                         return NULL;
793                 }
794         }
795
796         if (track == up) {
797                 PyErr_SetString(PyExc_ValueError,
798                                 "Can't have the same axis for track and up");
799                 return NULL;
800         }
801
802         /*
803                 flip vector around, since vectoquat expect a vector from target to tracking object
804                 and the python function expects the inverse (a vector to the target).
805         */
806         negate_v3_v3(vec, self->vec);
807
808         vec_to_quat(quat, vec, track, up);
809
810         return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
811 }
812
813 /*
814  * Vector.reflect(mirror): return a reflected vector on the mirror normal
815  *  vec - ((2 * DotVecs(vec, mirror)) * mirror)
816  */
817 PyDoc_STRVAR(Vector_reflect_doc,
818 ".. method:: reflect(mirror)\n"
819 "\n"
820 "   Return the reflection vector from the *mirror* argument.\n"
821 "\n"
822 "   :arg mirror: This vector could be a normal from the reflecting surface.\n"
823 "   :type mirror: :class:`Vector`\n"
824 "   :return: The reflected vector matching the size of this vector.\n"
825 "   :rtype: :class:`Vector`\n"
826 );
827 static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
828 {
829         int value_size;
830         float mirror[3], vec[3];
831         float reflect[3] = {0.0f};
832         float tvec[MAX_DIMENSIONS];
833
834         if (BaseMath_ReadCallback(self) == -1)
835                 return NULL;
836
837         if ((value_size = mathutils_array_parse(tvec, 2, 4, value, "Vector.reflect(other), invalid 'other' arg")) == -1)
838                 return NULL;
839
840         if (self->size < 2 || self->size > 4) {
841                 PyErr_SetString(PyExc_ValueError,
842                                 "Vector must be 2D, 3D or 4D");
843                 return NULL;
844         }
845
846         mirror[0] = tvec[0];
847         mirror[1] = tvec[1];
848         if (value_size > 2)             mirror[2] = tvec[2];
849         else                                    mirror[2] = 0.0;
850
851         vec[0] = self->vec[0];
852         vec[1] = self->vec[1];
853         if (self->size > 2)             vec[2] = self->vec[2];
854         else                                    vec[2] = 0.0;
855
856         normalize_v3(mirror);
857         reflect_v3_v3v3(reflect, vec, mirror);
858
859         return Vector_CreatePyObject(reflect, self->size, Py_NEW, Py_TYPE(self));
860 }
861
862 PyDoc_STRVAR(Vector_cross_doc,
863 ".. method:: cross(other)\n"
864 "\n"
865 "   Return the cross product of this vector and another.\n"
866 "\n"
867 "   :arg other: The other vector to perform the cross product with.\n"
868 "   :type other: :class:`Vector`\n"
869 "   :return: The cross product.\n"
870 "   :rtype: :class:`Vector`\n"
871 "\n"
872 "   .. note:: both vectors must be 3D\n"
873 );
874 static PyObject *Vector_cross(VectorObject *self, PyObject *value)
875 {
876         VectorObject *ret;
877         float tvec[MAX_DIMENSIONS];
878
879         if (BaseMath_ReadCallback(self) == -1)
880                 return NULL;
881
882         if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.cross(other), invalid 'other' arg") == -1)
883                 return NULL;
884
885         if (self->size != 3) {
886                 PyErr_SetString(PyExc_ValueError,
887                                 "Vector must be 3D");
888                 return NULL;
889         }
890
891         ret = (VectorObject *)Vector_CreatePyObject(NULL, 3, Py_NEW, Py_TYPE(self));
892         cross_v3_v3v3(ret->vec, self->vec, tvec);
893         return (PyObject *)ret;
894 }
895
896 PyDoc_STRVAR(Vector_dot_doc,
897 ".. method:: dot(other)\n"
898 "\n"
899 "   Return the dot product of this vector and another.\n"
900 "\n"
901 "   :arg other: The other vector to perform the dot product with.\n"
902 "   :type other: :class:`Vector`\n"
903 "   :return: The dot product.\n"
904 "   :rtype: :class:`Vector`\n"
905 );
906 static PyObject *Vector_dot(VectorObject *self, PyObject *value)
907 {
908         float *tvec;
909
910         if (BaseMath_ReadCallback(self) == -1)
911                 return NULL;
912
913         if (mathutils_array_parse_alloc(&tvec, self->size, value, "Vector.dot(other), invalid 'other' arg") == -1) {
914                 goto cleanup;
915         }
916
917         return PyFloat_FromDouble(dot_vn_vn(self->vec, tvec, self->size));
918
919 cleanup:
920         PyMem_Free(tvec);
921         return NULL;
922 }
923
924 PyDoc_STRVAR(Vector_angle_doc,
925 ".. function:: angle(other, fallback)\n"
926 "\n"
927 "   Return the angle between two vectors.\n"
928 "\n"
929 "   :arg other: another vector to compare the angle with\n"
930 "   :type other: :class:`Vector`\n"
931 "   :arg fallback: return this value when the angle cant be calculated\n"
932 "      (zero length vector)\n"
933 "   :type fallback: any\n"
934 "   :return: angle in radians or fallback when given\n"
935 "   :rtype: float\n"
936 "\n"
937 "   .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"
938 );
939 static PyObject *Vector_angle(VectorObject *self, PyObject *args)
940 {
941         const int size = MIN2(self->size, 3); /* 4D angle makes no sense */
942         float tvec[MAX_DIMENSIONS];
943         PyObject *value;
944         double dot = 0.0f, dot_self = 0.0f, dot_other = 0.0f;
945         int x;
946         PyObject *fallback = NULL;
947
948         if (!PyArg_ParseTuple(args, "O|O:angle", &value, &fallback))
949                 return NULL;
950
951         if (BaseMath_ReadCallback(self) == -1)
952                 return NULL;
953
954         /* don't use clamped size, rule of thumb is vector sizes must match,
955          * even though n this case 'w' is ignored */
956         if (mathutils_array_parse(tvec, self->size, self->size, value, "Vector.angle(other), invalid 'other' arg") == -1)
957                 return NULL;
958
959         if (self->size > 4) {
960                 PyErr_SetString(PyExc_ValueError,
961                                 "Vector must be 2D, 3D or 4D");
962                 return NULL;
963         }
964
965         for (x = 0; x < size; x++) {
966                 dot_self  += (double)self->vec[x] * (double)self->vec[x];
967                 dot_other += (double)tvec[x]      * (double)tvec[x];
968                 dot       += (double)self->vec[x] * (double)tvec[x];
969         }
970
971         if (!dot_self || !dot_other) {
972                 /* avoid exception */
973                 if (fallback) {
974                         Py_INCREF(fallback);
975                         return fallback;
976                 }
977                 else {
978                         PyErr_SetString(PyExc_ValueError,
979                                         "Vector.angle(other): "
980                                         "zero length vectors have no valid angle");
981                         return NULL;
982                 }
983         }
984
985         return PyFloat_FromDouble(saacos(dot / (sqrt(dot_self) * sqrt(dot_other))));
986 }
987
988 PyDoc_STRVAR(Vector_rotation_difference_doc,
989 ".. function:: rotation_difference(other)\n"
990 "\n"
991 "   Returns a quaternion representing the rotational difference between this\n"
992 "   vector and another.\n"
993 "\n"
994 "   :arg other: second vector.\n"
995 "   :type other: :class:`Vector`\n"
996 "   :return: the rotational difference between the two vectors.\n"
997 "   :rtype: :class:`Quaternion`\n"
998 "\n"
999 "   .. note:: 2D vectors raise an :exc:`AttributeError`.\n"
1000 );
1001 static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
1002 {
1003         float quat[4], vec_a[3], vec_b[3];
1004
1005         if (self->size < 3 || self->size > 4) {
1006                 PyErr_SetString(PyExc_ValueError,
1007                                 "vec.difference(value): "
1008                                 "expects both vectors to be size 3 or 4");
1009                 return NULL;
1010         }
1011
1012         if (BaseMath_ReadCallback(self) == -1)
1013                 return NULL;
1014
1015         if (mathutils_array_parse(vec_b, 3, MAX_DIMENSIONS, value, "Vector.difference(other), invalid 'other' arg") == -1)
1016                 return NULL;
1017
1018         normalize_v3_v3(vec_a, self->vec);
1019         normalize_v3(vec_b);
1020
1021         rotation_between_vecs_to_quat(quat, vec_a, vec_b);
1022
1023         return Quaternion_CreatePyObject(quat, Py_NEW, NULL);
1024 }
1025
1026 PyDoc_STRVAR(Vector_project_doc,
1027 ".. function:: project(other)\n"
1028 "\n"
1029 "   Return the projection of this vector onto the *other*.\n"
1030 "\n"
1031 "   :arg other: second vector.\n"
1032 "   :type other: :class:`Vector`\n"
1033 "   :return: the parallel projection vector\n"
1034 "   :rtype: :class:`Vector`\n"
1035 );
1036 static PyObject *Vector_project(VectorObject *self, PyObject *value)
1037 {
1038         const int size = self->size;
1039         float tvec[MAX_DIMENSIONS];
1040         float vec[MAX_DIMENSIONS];
1041         double dot = 0.0f, dot2 = 0.0f;
1042         int x;
1043
1044         if (BaseMath_ReadCallback(self) == -1)
1045                 return NULL;
1046
1047         if (mathutils_array_parse(tvec, size, size, value, "Vector.project(other), invalid 'other' arg") == -1)
1048                 return NULL;
1049
1050         if (self->size > 4) {
1051                 PyErr_SetString(PyExc_ValueError,
1052                                 "Vector must be 2D, 3D or 4D");
1053                 return NULL;
1054         }
1055
1056         if (BaseMath_ReadCallback(self) == -1)
1057                 return NULL;
1058
1059         //get dot products
1060         for (x = 0; x < size; x++) {
1061                 dot += (double)(self->vec[x] * tvec[x]);
1062                 dot2 += (double)(tvec[x] * tvec[x]);
1063         }
1064         //projection
1065         dot /= dot2;
1066         for (x = 0; x < size; x++) {
1067                 vec[x] = (float)dot * tvec[x];
1068         }
1069         return Vector_CreatePyObject(vec, size, Py_NEW, Py_TYPE(self));
1070 }
1071
1072 PyDoc_STRVAR(Vector_lerp_doc,
1073 ".. function:: lerp(other, factor)\n"
1074 "\n"
1075 "   Returns the interpolation of two vectors.\n"
1076 "\n"
1077 "   :arg other: value to interpolate with.\n"
1078 "   :type other: :class:`Vector`\n"
1079 "   :arg factor: The interpolation value in [0.0, 1.0].\n"
1080 "   :type factor: float\n"
1081 "   :return: The interpolated rotation.\n"
1082 "   :rtype: :class:`Vector`\n"
1083 );
1084 static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
1085 {
1086         const int size = self->size;
1087         PyObject *value = NULL;
1088         float fac, ifac;
1089         float *tvec, *vec;
1090         int x;
1091
1092         if (!PyArg_ParseTuple(args, "Of:lerp", &value, &fac))
1093                 return NULL;
1094
1095         if (mathutils_array_parse_alloc(&tvec, size, value, "Vector.lerp(other), invalid 'other' arg") == -1) {
1096                 goto cleanup;
1097         }
1098
1099         if (BaseMath_ReadCallback(self) == -1) {
1100                 goto cleanup;
1101         }
1102
1103         vec = PyMem_Malloc(size * sizeof(float));
1104         if (vec == NULL) {
1105                 PyErr_SetString(PyExc_MemoryError,
1106                                 "Vector.lerp(): "
1107                                 "problem allocating pointer space");
1108                 return NULL;
1109         }
1110
1111         ifac = 1.0f - fac;
1112
1113         for (x = 0; x < size; x++) {
1114                 vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
1115         }
1116
1117         PyMem_Free(tvec);
1118
1119         return Vector_CreatePyObject_alloc(vec, size, Py_TYPE(self));
1120
1121 cleanup:
1122         PyMem_Free(tvec);
1123         return NULL;
1124 }
1125
1126 PyDoc_STRVAR(Vector_rotate_doc,
1127 ".. function:: rotate(other)\n"
1128 "\n"
1129 "   Return vector by a rotation value.\n"
1130 "\n"
1131 "   :arg other: rotation component of mathutils value\n"
1132 "   :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
1133 );
1134 static PyObject *Vector_rotate(VectorObject *self, PyObject *value)
1135 {
1136         float other_rmat[3][3];
1137
1138         if (BaseMath_ReadCallback(self) == -1)
1139                 return NULL;
1140
1141         if (mathutils_any_to_rotmat(other_rmat, value, "Vector.rotate(value)") == -1)
1142                 return NULL;
1143
1144         if (self->size < 3 || self->size > 4) {
1145                 PyErr_SetString(PyExc_ValueError,
1146                                 "Vector must be 3D or 4D");
1147                 return NULL;
1148         }
1149
1150         mul_m3_v3(other_rmat, self->vec);
1151
1152         (void)BaseMath_WriteCallback(self);
1153         Py_RETURN_NONE;
1154 }
1155
1156 PyDoc_STRVAR(Vector_copy_doc,
1157 ".. function:: copy()\n"
1158 "\n"
1159 "   Returns a copy of this vector.\n"
1160 "\n"
1161 "   :return: A copy of the vector.\n"
1162 "   :rtype: :class:`Vector`\n"
1163 "\n"
1164 "   .. note:: use this to get a copy of a wrapped vector with\n"
1165 "      no reference to the original data.\n"
1166 );
1167 static PyObject *Vector_copy(VectorObject *self)
1168 {
1169         if (BaseMath_ReadCallback(self) == -1)
1170                 return NULL;
1171
1172         return Vector_CreatePyObject(self->vec, self->size, Py_NEW, Py_TYPE(self));
1173 }
1174
1175 static PyObject *Vector_repr(VectorObject *self)
1176 {
1177         PyObject *ret, *tuple;
1178
1179         if (BaseMath_ReadCallback(self) == -1)
1180                 return NULL;
1181
1182         tuple = Vector_to_tuple_ext(self, -1);
1183         ret = PyUnicode_FromFormat("Vector(%R)", tuple);
1184         Py_DECREF(tuple);
1185         return ret;
1186 }
1187
1188 static PyObject *Vector_str(VectorObject *self)
1189 {
1190         int i;
1191
1192         DynStr *ds;
1193
1194         if (BaseMath_ReadCallback(self) == -1)
1195                 return NULL;
1196
1197         ds = BLI_dynstr_new();
1198
1199         BLI_dynstr_append(ds, "<Vector (");
1200
1201         for (i = 0; i < self->size; i++) {
1202                 BLI_dynstr_appendf(ds, i ? ", %.4f" : "%.4f", self->vec[i]);
1203         }
1204
1205         BLI_dynstr_append(ds, ")>");
1206
1207         return mathutils_dynstr_to_py(ds); /* frees ds */
1208 }
1209
1210
1211 /* Sequence Protocol */
1212 /* sequence length len(vector) */
1213 static int Vector_len(VectorObject *self)
1214 {
1215         return self->size;
1216 }
1217 /* sequence accessor (get): vector[index] */
1218 static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr)
1219 {
1220         if (i < 0)      i = self->size-i;
1221
1222         if (i < 0 || i >= self->size) {
1223                 if (is_attr)    {
1224                         PyErr_Format(PyExc_AttributeError,
1225                                      "Vector.%c: unavailable on %dd vector",
1226                                      *(((char *)"xyzw") + i), self->size);
1227                 }
1228                 else {
1229                         PyErr_SetString(PyExc_IndexError,
1230                                         "vector[index]: out of range");
1231                 }
1232                 return NULL;
1233         }
1234
1235         if (BaseMath_ReadIndexCallback(self, i) == -1)
1236                 return NULL;
1237
1238         return PyFloat_FromDouble(self->vec[i]);
1239 }
1240
1241 static PyObject *Vector_item(VectorObject *self, int i)
1242 {
1243         return vector_item_internal(self, i, FALSE);
1244 }
1245 /* sequence accessor (set): vector[index] = value */
1246 static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value, const int is_attr)
1247 {
1248         float scalar;
1249         if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
1250                 PyErr_SetString(PyExc_TypeError,
1251                                 "vector[index] = x: "
1252                                 "index argument not a number");
1253                 return -1;
1254         }
1255
1256         if (i < 0)      i = self->size-i;
1257
1258         if (i < 0 || i >= self->size) {
1259                 if (is_attr) {
1260                         PyErr_Format(PyExc_AttributeError,
1261                                      "Vector.%c = x: unavailable on %dd vector",
1262                                      *(((char *)"xyzw") + i), self->size);
1263                 }
1264                 else {
1265                         PyErr_SetString(PyExc_IndexError,
1266                                         "vector[index] = x: "
1267                                         "assignment index out of range");
1268                 }
1269                 return -1;
1270         }
1271         self->vec[i] = scalar;
1272
1273         if (BaseMath_WriteIndexCallback(self, i) == -1)
1274                 return -1;
1275         return 0;
1276 }
1277
1278 static int Vector_ass_item(VectorObject *self, int i, PyObject *value)
1279 {
1280         return vector_ass_item_internal(self, i, value, FALSE);
1281 }
1282
1283 /* sequence slice (get): vector[a:b] */
1284 static PyObject *Vector_slice(VectorObject *self, int begin, int end)
1285 {
1286         PyObject *tuple;
1287         int count;
1288
1289         if (BaseMath_ReadCallback(self) == -1)
1290                 return NULL;
1291
1292         CLAMP(begin, 0, self->size);
1293         if (end < 0) end = self->size + end + 1;
1294         CLAMP(end, 0, self->size);
1295         begin = MIN2(begin, end);
1296
1297         tuple = PyTuple_New(end - begin);
1298         for (count = begin; count < end; count++) {
1299                 PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count]));
1300         }
1301
1302         return tuple;
1303 }
1304 /* sequence slice (set): vector[a:b] = value */
1305 static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *seq)
1306 {
1307         int size = 0;
1308         float *vec = NULL;
1309
1310         if (BaseMath_ReadCallback(self) == -1)
1311                 return -1;
1312
1313         CLAMP(begin, 0, self->size);
1314         CLAMP(end, 0, self->size);
1315         begin = MIN2(begin, end);
1316
1317         size = (end - begin);
1318         if (mathutils_array_parse_alloc(&vec, size, seq, "vector[begin:end] = [...]") == -1) {
1319                 goto cleanup;
1320         }
1321
1322         if (vec == NULL) {
1323                 PyErr_SetString(PyExc_MemoryError,
1324                                                 "vec[:] = seq: "
1325                                 "problem allocating pointer space");
1326                 return -1;
1327         }
1328
1329         /*parsed well - now set in vector*/
1330         memcpy(self->vec + begin, vec, size * sizeof(float));
1331
1332         if (BaseMath_WriteCallback(self) == -1)
1333                 return -1;
1334
1335         PyMem_Free(vec);
1336
1337         return 0;
1338
1339 cleanup:
1340         PyMem_Free(vec);
1341         return -1;
1342 }
1343
1344 /* Numeric Protocols */
1345 /* addition: obj + obj */
1346 static PyObject *Vector_add(PyObject *v1, PyObject *v2)
1347 {
1348         VectorObject *vec1 = NULL, *vec2 = NULL;
1349         float *vec = NULL;
1350
1351         if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
1352                 PyErr_Format(PyExc_AttributeError,
1353                              "Vector addition: (%s + %s) "
1354                              "invalid type for this operation",
1355                              Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1356                 return NULL;
1357         }
1358         vec1 = (VectorObject*)v1;
1359         vec2 = (VectorObject*)v2;
1360
1361         if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
1362                 return NULL;
1363
1364         /*VECTOR + VECTOR*/
1365         if (vec1->size != vec2->size) {
1366                 PyErr_SetString(PyExc_AttributeError,
1367                                 "Vector addition: "
1368                                 "vectors must have the same dimensions for this operation");
1369                 return NULL;
1370         }
1371
1372         vec = PyMem_Malloc(vec1->size * sizeof(float));
1373
1374         if (vec == NULL) { /*allocation failure*/
1375                 PyErr_SetString(PyExc_MemoryError,
1376                                 "Vector(): "
1377                                 "problem allocating pointer space");
1378                 return NULL;
1379         }
1380
1381         add_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
1382
1383         return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
1384 }
1385
1386 /* addition in-place: obj += obj */
1387 static PyObject *Vector_iadd(PyObject *v1, PyObject *v2)
1388 {
1389         VectorObject *vec1 = NULL, *vec2 = NULL;
1390
1391         if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
1392                 PyErr_Format(PyExc_AttributeError,
1393                              "Vector addition: (%s += %s) "
1394                              "invalid type for this operation",
1395                              Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1396                 return NULL;
1397         }
1398         vec1 = (VectorObject*)v1;
1399         vec2 = (VectorObject*)v2;
1400
1401         if (vec1->size != vec2->size) {
1402                 PyErr_SetString(PyExc_AttributeError,
1403                                 "Vector addition: "
1404                                 "vectors must have the same dimensions for this operation");
1405                 return NULL;
1406         }
1407
1408         if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
1409                 return NULL;
1410
1411         add_vn_vn(vec1->vec, vec2->vec, vec1->size);
1412
1413         (void)BaseMath_WriteCallback(vec1);
1414         Py_INCREF(v1);
1415         return v1;
1416 }
1417
1418 /* subtraction: obj - obj */
1419 static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
1420 {
1421         VectorObject *vec1 = NULL, *vec2 = NULL;
1422         float *vec;
1423
1424         if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
1425                 PyErr_Format(PyExc_AttributeError,
1426                              "Vector subtraction: (%s - %s) "
1427                              "invalid type for this operation",
1428                              Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1429                 return NULL;
1430         }
1431         vec1 = (VectorObject*)v1;
1432         vec2 = (VectorObject*)v2;
1433
1434         if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
1435                 return NULL;
1436
1437         if (vec1->size != vec2->size) {
1438                 PyErr_SetString(PyExc_AttributeError,
1439                                 "Vector subtraction: "
1440                                 "vectors must have the same dimensions for this operation");
1441                 return NULL;
1442         }
1443
1444         vec = PyMem_Malloc(vec1->size * sizeof(float));
1445
1446         if (vec == NULL) { /*allocation failure*/
1447                 PyErr_SetString(PyExc_MemoryError,
1448                                 "Vector(): "
1449                                 "problem allocating pointer space");
1450                 return NULL;
1451         }
1452
1453         sub_vn_vnvn(vec, vec1->vec, vec2->vec, vec1->size);
1454
1455         return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
1456 }
1457
1458 /* subtraction in-place: obj -= obj */
1459 static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
1460 {
1461         VectorObject *vec1 = NULL, *vec2 = NULL;
1462
1463         if (!VectorObject_Check(v1) || !VectorObject_Check(v2)) {
1464                 PyErr_Format(PyExc_AttributeError,
1465                              "Vector subtraction: (%s -= %s) "
1466                              "invalid type for this operation",
1467                              Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1468                 return NULL;
1469         }
1470         vec1 = (VectorObject*)v1;
1471         vec2 = (VectorObject*)v2;
1472
1473         if (vec1->size != vec2->size) {
1474                 PyErr_SetString(PyExc_AttributeError,
1475                                 "Vector subtraction: "
1476                                 "vectors must have the same dimensions for this operation");
1477                 return NULL;
1478         }
1479
1480         if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
1481                 return NULL;
1482
1483         sub_vn_vn(vec1->vec, vec2->vec, vec1->size);
1484
1485         (void)BaseMath_WriteCallback(vec1);
1486         Py_INCREF(v1);
1487         return v1;
1488 }
1489
1490 /*------------------------obj * obj------------------------------
1491   mulplication*/
1492
1493
1494 /* COLUMN VECTOR Multiplication (Matrix X Vector)
1495  * [1][4][7]   [a]
1496  * [2][5][8] * [b]
1497  * [3][6][9]   [c]
1498  *
1499  * note: vector/matrix multiplication IS NOT COMMUTATIVE!!!!
1500  * note: assume read callbacks have been done first.
1501  */
1502 int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
1503 {
1504         float vec_cpy[MAX_DIMENSIONS];
1505         int row, col, z = 0;
1506
1507         if (mat->num_col != vec->size) {
1508                 if (mat->num_col == 4 && vec->size == 3) {
1509                         vec_cpy[3] = 1.0f;
1510                 }
1511                 else {
1512                         PyErr_SetString(PyExc_TypeError,
1513                                         "matrix * vector: "
1514                                                         "len(matrix.col) and len(vector) must be the same, "
1515                                         "except for 4x4 matrix * 3D vector.");
1516                         return -1;
1517                 }
1518         }
1519
1520         memcpy(vec_cpy, vec->vec, vec->size * sizeof(float));
1521
1522         r_vec[3] = 1.0f;
1523
1524         for (row = 0; row < mat->num_row; row++) {
1525                 double dot = 0.0f;
1526                 for (col = 0; col < mat->num_col; col++) {
1527                         dot += (double)(MATRIX_ITEM(mat, row, col) * vec_cpy[col]);
1528                 }
1529                 r_vec[z++] = (float)dot;
1530         }
1531
1532         return 0;
1533 }
1534
1535 static PyObject *vector_mul_float(VectorObject *vec, const float scalar)
1536 {
1537         float *tvec = PyMem_Malloc(vec->size * sizeof(float));
1538
1539         if (tvec == NULL) { /*allocation failure*/
1540                 PyErr_SetString(PyExc_MemoryError,
1541                                 "vec * float: "
1542                                 "problem allocating pointer space");
1543                 return NULL;
1544         }
1545
1546         mul_vn_vn_fl(tvec, vec->vec, vec->size, scalar);
1547         return Vector_CreatePyObject_alloc(tvec, vec->size, Py_TYPE(vec));
1548 }
1549
1550 static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
1551 {
1552         VectorObject *vec1 = NULL, *vec2 = NULL;
1553         float scalar;
1554         int vec_size;
1555
1556         if VectorObject_Check(v1) {
1557                 vec1 = (VectorObject *)v1;
1558                 if (BaseMath_ReadCallback(vec1) == -1)
1559                         return NULL;
1560         }
1561         if VectorObject_Check(v2) {
1562                 vec2 = (VectorObject *)v2;
1563                 if (BaseMath_ReadCallback(vec2) == -1)
1564                         return NULL;
1565         }
1566
1567
1568         /* make sure v1 is always the vector */
1569         if (vec1 && vec2) {
1570                 if (vec1->size != vec2->size) {
1571                         PyErr_SetString(PyExc_ValueError,
1572                                         "Vector multiplication: "
1573                                         "vectors must have the same dimensions for this operation");
1574                         return NULL;
1575                 }
1576
1577                 /*dot product*/
1578                 return PyFloat_FromDouble(dot_vn_vn(vec1->vec, vec2->vec, vec1->size));
1579         }
1580         else if (vec1) {
1581                 if (MatrixObject_Check(v2)) {
1582                         /* VEC * MATRIX */
1583                         float tvec[MAX_DIMENSIONS];
1584
1585                         if (BaseMath_ReadCallback((MatrixObject *)v2) == -1)
1586                                 return NULL;
1587                         if (row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1) {
1588                                 return NULL;
1589                         }
1590
1591                         if (((MatrixObject *)v2)->num_row == 4 && vec1->size == 3) {
1592                                 vec_size = 3;
1593                         }
1594                         else {
1595                                 vec_size = ((MatrixObject *)v2)->num_col;
1596                         }
1597
1598                         return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(vec1));
1599                 }
1600                 else if (QuaternionObject_Check(v2)) {
1601                         /* VEC * QUAT */
1602 /* ------ to be removed ------*/
1603 #if 1
1604                         PyErr_SetString(PyExc_ValueError,
1605                                         "(Vector * Quat) is now removed, reverse the "
1606                                         "order (promoted to an Error for Debug builds)");
1607                         return NULL;
1608 #else
1609                         QuaternionObject *quat2 = (QuaternionObject*)v2;
1610                         float tvec[3];
1611
1612                         if (vec1->size != 3) {
1613                                 PyErr_SetString(PyExc_ValueError,
1614                                                 "Vector multiplication: "
1615                                                 "only 3D vector rotations (with quats) currently supported");
1616                                 return NULL;
1617                         }
1618                         if (BaseMath_ReadCallback(quat2) == -1) {
1619                                 return NULL;
1620                         }
1621
1622                         copy_v3_v3(tvec, vec1->vec);
1623                         mul_qt_v3(quat2->quat, tvec);
1624                         return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec1));
1625 #endif
1626 /* ------ to be removed ------*/
1627                 }
1628                 else if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC * FLOAT */
1629                         return vector_mul_float(vec1, scalar);
1630                 }
1631         }
1632         else if (vec2) {
1633                 if (((scalar = PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred()) == 0) { /* FLOAT * VEC */
1634                         return vector_mul_float(vec2, scalar);
1635                 }
1636         }
1637         else {
1638                 BLI_assert(!"internal error");
1639         }
1640
1641         PyErr_Format(PyExc_TypeError,
1642                      "Vector multiplication: "
1643                      "not supported between '%.200s' and '%.200s' types",
1644                      Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1645         return NULL;
1646 }
1647
1648 /* mulplication in-place: obj *= obj */
1649 static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
1650 {
1651         VectorObject *vec = (VectorObject *)v1;
1652         float scalar;
1653
1654         if (BaseMath_ReadCallback(vec) == -1)
1655                 return NULL;
1656
1657         /* only support vec*=float and vec*=mat
1658            vec*=vec result is a float so that wont work */
1659         if (MatrixObject_Check(v2)) {
1660 /* ------ to be removed ------*/
1661 #if 1
1662                 PyErr_SetString(PyExc_ValueError,
1663                                                 "(Vector *= Matrix) is now removed, reverse the "
1664                                                 "order (promoted to an Error for Debug builds) "
1665                                                 "and uses the non in-place multiplication.");
1666                 return NULL;
1667 #else
1668                 float rvec[MAX_DIMENSIONS];
1669                 if (BaseMath_ReadCallback((MatrixObject *)v2) == -1)
1670                         return NULL;
1671
1672                 if (column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1)
1673                         return NULL;
1674
1675                 memcpy(vec->vec, rvec, sizeof(float) * vec->size);
1676 #endif
1677 /* ------ to be removed ------*/
1678         }
1679         else if (QuaternionObject_Check(v2)) {
1680                 /* VEC *= QUAT */
1681
1682 /* ------ to be removed ------*/
1683 #if 1
1684                 PyErr_SetString(PyExc_ValueError,
1685                                                 "(Vector *= Quat) is now removed, reverse the "
1686                                                 "order (promoted to an Error for Debug builds) "
1687                                                 "and uses the non in-place multiplication.");
1688                 return NULL;
1689 #else
1690                 QuaternionObject *quat2 = (QuaternionObject*)v2;
1691
1692                 if (vec->size != 3) {
1693                         PyErr_SetString(PyExc_ValueError,
1694                                         "Vector multiplication: "
1695                                         "only 3D vector rotations (with quats) currently supported");
1696                         return NULL;
1697                 }
1698
1699                 if (BaseMath_ReadCallback(quat2) == -1) {
1700                         return NULL;
1701                 }
1702
1703                 mul_qt_v3(quat2->quat, vec->vec);
1704 #endif
1705 /* ------ to be removed ------*/
1706         }
1707         else if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* VEC *= FLOAT */
1708                 mul_vn_fl(vec->vec, vec->size, scalar);
1709         }
1710         else {
1711                 PyErr_Format(PyExc_TypeError,
1712                              "Vector multiplication: (%s *= %s) "
1713                              "invalid type for this operation",
1714                              Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
1715                 return NULL;
1716         }
1717
1718         (void)BaseMath_WriteCallback(vec);
1719         Py_INCREF(v1);
1720         return v1;
1721 }
1722
1723 /* divid: obj / obj */
1724 static PyObject *Vector_div(PyObject *v1, PyObject *v2)
1725 {
1726         float *vec = NULL, scalar;
1727         VectorObject *vec1 = NULL;
1728
1729         if (!VectorObject_Check(v1)) { /* not a vector */
1730                 PyErr_SetString(PyExc_TypeError,
1731                                 "Vector division: "
1732                                 "Vector must be divided by a float");
1733                 return NULL;
1734         }
1735         vec1 = (VectorObject *)v1; /* vector */
1736
1737         if (BaseMath_ReadCallback(vec1) == -1)
1738                 return NULL;
1739
1740         if ((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
1741                 PyErr_SetString(PyExc_TypeError,
1742                                 "Vector division: "
1743                                 "Vector must be divided by a float");
1744                 return NULL;
1745         }
1746
1747         if (scalar == 0.0f) {
1748                 PyErr_SetString(PyExc_ZeroDivisionError,
1749                                 "Vector division: "
1750                                 "divide by zero error");
1751                 return NULL;
1752         }
1753
1754         vec = PyMem_Malloc(vec1->size * sizeof(float));
1755
1756         if (vec == NULL) { /*allocation failure*/
1757                 PyErr_SetString(PyExc_MemoryError,
1758                                 "vec / value: "
1759                                 "problem allocating pointer space");
1760                 return NULL;
1761         }
1762
1763         mul_vn_vn_fl(vec, vec1->vec, vec1->size, 1.0f / scalar);
1764
1765         return Vector_CreatePyObject_alloc(vec, vec1->size, Py_TYPE(v1));
1766 }
1767
1768 /* divide in-place: obj /= obj */
1769 static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
1770 {
1771         float scalar;
1772         VectorObject *vec1 = (VectorObject*)v1;
1773
1774         if (BaseMath_ReadCallback(vec1) == -1)
1775                 return NULL;
1776
1777         if ((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
1778                 PyErr_SetString(PyExc_TypeError,
1779                                 "Vector division: "
1780                                 "Vector must be divided by a float");
1781                 return NULL;
1782         }
1783
1784         if (scalar == 0.0f) {
1785                 PyErr_SetString(PyExc_ZeroDivisionError,
1786                                 "Vector division: "
1787                                 "divide by zero error");
1788                 return NULL;
1789         }
1790
1791         mul_vn_fl(vec1->vec, vec1->size, 1.0f / scalar);
1792
1793         (void)BaseMath_WriteCallback(vec1);
1794
1795         Py_INCREF(v1);
1796         return v1;
1797 }
1798
1799 /* -obj
1800   returns the negative of this object*/
1801 static PyObject *Vector_neg(VectorObject *self)
1802 {
1803         float *tvec;
1804
1805         if (BaseMath_ReadCallback(self) == -1)
1806                 return NULL;
1807
1808         tvec = PyMem_Malloc(self->size * sizeof(float));
1809         negate_vn_vn(tvec, self->vec, self->size);
1810         return Vector_CreatePyObject_alloc(tvec, self->size, Py_TYPE(self));
1811 }
1812
1813 /*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
1814 static double vec_magnitude_nosqrt(float *data, int size)
1815 {
1816         /*return (double)sqrt(dot);*/
1817         /* warning, line above removed because we are not using the length,
1818            rather the comparing the sizes and for this we do not need the sqrt
1819            for the actual length, the dot must be sqrt'd */
1820         return dot_vn_vn(data, data, size);
1821 }
1822
1823
1824 /*------------------------tp_richcmpr
1825   returns -1 execption, 0 false, 1 true */
1826 static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
1827 {
1828         VectorObject *vecA = NULL, *vecB = NULL;
1829         int result = 0;
1830         double epsilon = .000001f;
1831         double lenA, lenB;
1832
1833         if (!VectorObject_Check(objectA) || !VectorObject_Check(objectB)) {
1834                 if (comparison_type == Py_NE) {
1835                         Py_RETURN_TRUE;
1836                 }
1837                 else {
1838                         Py_RETURN_FALSE;
1839                 }
1840         }
1841         vecA = (VectorObject*)objectA;
1842         vecB = (VectorObject*)objectB;
1843
1844         if (BaseMath_ReadCallback(vecA) == -1 || BaseMath_ReadCallback(vecB) == -1)
1845                 return NULL;
1846
1847         if (vecA->size != vecB->size) {
1848                 if (comparison_type == Py_NE) {
1849                         Py_RETURN_TRUE;
1850                 }
1851                 else {
1852                         Py_RETURN_FALSE;
1853                 }
1854         }
1855
1856         switch (comparison_type) {
1857                 case Py_LT:
1858                         lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
1859                         lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
1860                         if (lenA < lenB) {
1861                                 result = 1;
1862                         }
1863                         break;
1864                 case Py_LE:
1865                         lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
1866                         lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
1867                         if (lenA < lenB) {
1868                                 result = 1;
1869                         }
1870                         else {
1871                                 result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
1872                         }
1873                         break;
1874                 case Py_EQ:
1875                         result = EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
1876                         break;
1877                 case Py_NE:
1878                         result = !EXPP_VectorsAreEqual(vecA->vec, vecB->vec, vecA->size, 1);
1879                         break;
1880                 case Py_GT:
1881                         lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
1882                         lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
1883                         if (lenA > lenB) {
1884                                 result = 1;
1885                         }
1886                         break;
1887                 case Py_GE:
1888                         lenA = vec_magnitude_nosqrt(vecA->vec, vecA->size);
1889                         lenB = vec_magnitude_nosqrt(vecB->vec, vecB->size);
1890                         if (lenA > lenB) {
1891                                 result = 1;
1892                         }
1893                         else {
1894                                 result = (((lenA + epsilon) > lenB) && ((lenA - epsilon) < lenB));
1895                         }
1896                         break;
1897                 default:
1898                         printf("The result of the comparison could not be evaluated");
1899                         break;
1900         }
1901         if (result == 1) {
1902                 Py_RETURN_TRUE;
1903         }
1904         else {
1905                 Py_RETURN_FALSE;
1906         }
1907 }
1908
1909 /*-----------------PROTCOL DECLARATIONS--------------------------*/
1910 static PySequenceMethods Vector_SeqMethods = {
1911         (lenfunc) Vector_len,                           /* sq_length */
1912         (binaryfunc) NULL,                                      /* sq_concat */
1913         (ssizeargfunc) NULL,                            /* sq_repeat */
1914         (ssizeargfunc) Vector_item,                     /* sq_item */
1915         NULL,                                                           /* py3 deprecated slice func */
1916         (ssizeobjargproc) Vector_ass_item,      /* sq_ass_item */
1917         NULL,                                                           /* py3 deprecated slice assign func */
1918         (objobjproc) NULL,                                      /* sq_contains */
1919         (binaryfunc) NULL,                                      /* sq_inplace_concat */
1920         (ssizeargfunc) NULL,                            /* sq_inplace_repeat */
1921 };
1922
1923 static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
1924 {
1925         if (PyIndex_Check(item)) {
1926                 Py_ssize_t i;
1927                 i = PyNumber_AsSsize_t(item, PyExc_IndexError);
1928                 if (i == -1 && PyErr_Occurred())
1929                         return NULL;
1930                 if (i < 0)
1931                         i += self->size;
1932                 return Vector_item(self, i);
1933         }
1934         else if (PySlice_Check(item)) {
1935                 Py_ssize_t start, stop, step, slicelength;
1936
1937                 if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
1938                         return NULL;
1939
1940                 if (slicelength <= 0) {
1941                         return PyTuple_New(0);
1942                 }
1943                 else if (step == 1) {
1944                         return Vector_slice(self, start, stop);
1945                 }
1946                 else {
1947                         PyErr_SetString(PyExc_IndexError,
1948                                         "slice steps not supported with vectors");
1949                         return NULL;
1950                 }
1951         }
1952         else {
1953                 PyErr_Format(PyExc_TypeError,
1954                              "vector indices must be integers, not %.200s",
1955                              Py_TYPE(item)->tp_name);
1956                 return NULL;
1957         }
1958 }
1959
1960 static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *value)
1961 {
1962         if (PyIndex_Check(item)) {
1963                 Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
1964                 if (i == -1 && PyErr_Occurred())
1965                         return -1;
1966                 if (i < 0)
1967                         i += self->size;
1968                 return Vector_ass_item(self, i, value);
1969         }
1970         else if (PySlice_Check(item)) {
1971                 Py_ssize_t start, stop, step, slicelength;
1972
1973                 if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
1974                         return -1;
1975
1976                 if (step == 1)
1977                         return Vector_ass_slice(self, start, stop, value);
1978                 else {
1979                         PyErr_SetString(PyExc_IndexError,
1980                                         "slice steps not supported with vectors");
1981                         return -1;
1982                 }
1983         }
1984         else {
1985                 PyErr_Format(PyExc_TypeError,
1986                              "vector indices must be integers, not %.200s",
1987                              Py_TYPE(item)->tp_name);
1988                 return -1;
1989         }
1990 }
1991
1992 static PyMappingMethods Vector_AsMapping = {
1993         (lenfunc)Vector_len,
1994         (binaryfunc)Vector_subscript,
1995         (objobjargproc)Vector_ass_subscript
1996 };
1997
1998
1999 static PyNumberMethods Vector_NumMethods = {
2000         (binaryfunc)    Vector_add,     /*nb_add*/
2001         (binaryfunc)    Vector_sub,     /*nb_subtract*/
2002         (binaryfunc)    Vector_mul,     /*nb_multiply*/
2003         NULL,                                                   /*nb_remainder*/
2004         NULL,                                                   /*nb_divmod*/
2005         NULL,                                                   /*nb_power*/
2006         (unaryfunc)     Vector_neg,     /*nb_negative*/
2007         (unaryfunc)     NULL,   /*tp_positive*/
2008         (unaryfunc)     NULL,   /*tp_absolute*/
2009         (inquiry)       NULL,   /*tp_bool*/
2010         (unaryfunc)     NULL,   /*nb_invert*/
2011         NULL,                           /*nb_lshift*/
2012         (binaryfunc)NULL,       /*nb_rshift*/
2013         NULL,                           /*nb_and*/
2014         NULL,                           /*nb_xor*/
2015         NULL,                           /*nb_or*/
2016         NULL,                           /*nb_int*/
2017         NULL,                           /*nb_reserved*/
2018         NULL,                           /*nb_float*/
2019         Vector_iadd,    /* nb_inplace_add */
2020         Vector_isub,    /* nb_inplace_subtract */
2021         Vector_imul,    /* nb_inplace_multiply */
2022         NULL,                           /* nb_inplace_remainder */
2023         NULL,                           /* nb_inplace_power */
2024         NULL,                           /* nb_inplace_lshift */
2025         NULL,                           /* nb_inplace_rshift */
2026         NULL,                           /* nb_inplace_and */
2027         NULL,                           /* nb_inplace_xor */
2028         NULL,                           /* nb_inplace_or */
2029         NULL,                           /* nb_floor_divide */
2030         Vector_div,             /* nb_true_divide */
2031         NULL,                           /* nb_inplace_floor_divide */
2032         Vector_idiv,    /* nb_inplace_true_divide */
2033         NULL,                   /* nb_index */
2034 };
2035
2036 /*------------------PY_OBECT DEFINITION--------------------------*/
2037
2038 /* vector axis, vector.x/y/z/w */
2039
2040 PyDoc_STRVAR(Vector_axis_x_doc, "Vector X axis.\n\n:type: float");
2041 PyDoc_STRVAR(Vector_axis_y_doc, "Vector Y axis.\n\n:type: float");
2042 PyDoc_STRVAR(Vector_axis_z_doc, "Vector Z axis (3D Vectors only).\n\n:type: float");
2043 PyDoc_STRVAR(Vector_axis_w_doc, "Vector W axis (4D Vectors only).\n\n:type: float");
2044
2045 static PyObject *Vector_axis_get(VectorObject *self, void *type)
2046 {
2047         return vector_item_internal(self, GET_INT_FROM_POINTER(type), TRUE);
2048 }
2049
2050 static int Vector_axis_set(VectorObject *self, PyObject *value, void *type)
2051 {
2052         return vector_ass_item_internal(self, GET_INT_FROM_POINTER(type), value, TRUE);
2053 }
2054
2055 /* vector.length */
2056
2057 PyDoc_STRVAR(Vector_length_doc,
2058 "Vector Length.\n\n:type: float"
2059 );
2060 static PyObject *Vector_length_get(VectorObject *self, void *UNUSED(closure))
2061 {
2062         if (BaseMath_ReadCallback(self) == -1)
2063                 return NULL;
2064
2065         return PyFloat_FromDouble(sqrt(dot_vn_vn(self->vec, self->vec, self->size)));
2066 }
2067
2068 static int Vector_length_set(VectorObject *self, PyObject *value)
2069 {
2070         double dot = 0.0f, param;
2071
2072         if (BaseMath_ReadCallback(self) == -1)
2073                 return -1;
2074
2075         if ((param = PyFloat_AsDouble(value)) == -1.0 && PyErr_Occurred()) {
2076                 PyErr_SetString(PyExc_TypeError,
2077                                 "length must be set to a number");
2078                 return -1;
2079         }
2080
2081         if (param < 0.0) {
2082                 PyErr_SetString(PyExc_ValueError,
2083                                 "cannot set a vectors length to a negative value");
2084                 return -1;
2085         }
2086         if (param == 0.0) {
2087                 fill_vn_fl(self->vec, self->size, 0.0f);
2088                 return 0;
2089         }
2090
2091         dot = dot_vn_vn(self->vec, self->vec, self->size);
2092
2093         if (!dot) /* cant sqrt zero */
2094                 return 0;
2095
2096         dot = sqrt(dot);
2097
2098         if (dot == param)
2099                 return 0;
2100
2101         dot = dot / param;
2102
2103         mul_vn_fl(self->vec, self->size, 1.0 / dot);
2104
2105         (void)BaseMath_WriteCallback(self); /* checked already */
2106
2107         return 0;
2108 }
2109
2110 /* vector.length_squared */
2111 PyDoc_STRVAR(Vector_length_squared_doc,
2112 "Vector length squared (v.dot(v)).\n\n:type: float"
2113 );
2114 static PyObject *Vector_length_squared_get(VectorObject *self, void *UNUSED(closure))
2115 {
2116         if (BaseMath_ReadCallback(self) == -1)
2117                 return NULL;
2118
2119         return PyFloat_FromDouble(dot_vn_vn(self->vec, self->vec, self->size));
2120 }
2121
2122 /* Get a new Vector according to the provided swizzle. This function has little
2123  * error checking, as we are in control of the inputs: the closure is set by us
2124  * in Vector_createSwizzleGetSeter. */
2125 static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
2126 {
2127         size_t axis_to;
2128         size_t axis_from;
2129         float vec[MAX_DIMENSIONS];
2130         unsigned int swizzleClosure;
2131
2132         if (BaseMath_ReadCallback(self) == -1)
2133                 return NULL;
2134
2135         /* Unpack the axes from the closure into an array. */
2136         axis_to = 0;
2137         swizzleClosure = GET_INT_FROM_POINTER(closure);
2138         while (swizzleClosure & SWIZZLE_VALID_AXIS) {
2139                 axis_from = swizzleClosure & SWIZZLE_AXIS;
2140                 if (axis_from >= self->size) {
2141                         PyErr_SetString(PyExc_AttributeError,
2142                                         "Vector swizzle: "
2143                                         "specified axis not present");
2144                         return NULL;
2145                 }
2146
2147                 vec[axis_to] = self->vec[axis_from];
2148                 swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
2149                 axis_to++;
2150         }
2151
2152         return Vector_CreatePyObject(vec, axis_to, Py_NEW, Py_TYPE(self));
2153 }
2154
2155 /* Set the items of this vector using a swizzle.
2156  * - If value is a vector or list this operates like an array copy, except that
2157  *   the destination is effectively re-ordered as defined by the swizzle. At
2158  *   most min(len(source), len(dest)) values will be copied.
2159  * - If the value is scalar, it is copied to all axes listed in the swizzle.
2160  * - If an axis appears more than once in the swizzle, the final occurrence is
2161  *   the one that determines its value.
2162
2163  * Returns 0 on success and -1 on failure. On failure, the vector will be
2164  * unchanged. */
2165 static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure)
2166 {
2167         size_t size_from;
2168         float scalarVal;
2169
2170         size_t axis_from;
2171         size_t axis_to;
2172
2173         unsigned int swizzleClosure;
2174
2175         float tvec[MAX_DIMENSIONS];
2176         float vec_assign[MAX_DIMENSIONS];
2177
2178         if (BaseMath_ReadCallback(self) == -1)
2179                 return -1;
2180
2181         /* Check that the closure can be used with this vector: even 2D vectors have
2182          * swizzles defined for axes z and w, but they would be invalid. */
2183         swizzleClosure = GET_INT_FROM_POINTER(closure);
2184         axis_from = 0;
2185
2186         while (swizzleClosure & SWIZZLE_VALID_AXIS) {
2187                 axis_to = swizzleClosure & SWIZZLE_AXIS;
2188                 if (axis_to >= self->size) {
2189                         PyErr_SetString(PyExc_AttributeError,
2190                                         "Vector swizzle: "
2191                                         "specified axis not present");
2192                         return -1;
2193                 }
2194                 swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
2195                 axis_from++;
2196         }
2197
2198         if (((scalarVal = PyFloat_AsDouble(value)) == -1 && PyErr_Occurred()) == 0) {
2199                 int i;
2200
2201                 for (i = 0; i < MAX_DIMENSIONS; i++) {
2202                         vec_assign[i] = scalarVal;
2203                 }
2204
2205                 size_from = axis_from;
2206         }
2207         else if ( (PyErr_Clear()), /* run but ignore the result */
2208                   (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
2209                                                    "mathutils.Vector.**** = swizzle assignment")) == -1)
2210         {
2211                 return -1;
2212         }
2213
2214         if (axis_from != size_from) {
2215                 PyErr_SetString(PyExc_AttributeError,
2216                                 "Vector swizzle: size does not match swizzle");
2217                 return -1;
2218         }
2219
2220         /* Copy vector contents onto swizzled axes. */
2221         axis_from = 0;
2222         swizzleClosure = GET_INT_FROM_POINTER(closure);
2223
2224         while (swizzleClosure & SWIZZLE_VALID_AXIS)     {
2225                 axis_to = swizzleClosure & SWIZZLE_AXIS;
2226                 tvec[axis_to] = vec_assign[axis_from];
2227                 swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
2228                 axis_from++;
2229         }
2230
2231         memcpy(self->vec, tvec, axis_from * sizeof(float));
2232         /* continue with BaseMathObject_WriteCallback at the end */
2233
2234         if (BaseMath_WriteCallback(self) == -1)
2235                 return -1;
2236         else
2237                 return 0;
2238 }
2239
2240 /*****************************************************************************/
2241 /* Python attributes get/set structure:                                      */
2242 /*****************************************************************************/
2243 static PyGetSetDef Vector_getseters[] = {
2244         {(char *)"x", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_x_doc, (void *)0},
2245         {(char *)"y", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_y_doc, (void *)1},
2246         {(char *)"z", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_z_doc, (void *)2},
2247         {(char *)"w", (getter)Vector_axis_get, (setter)Vector_axis_set, Vector_axis_w_doc, (void *)3},
2248         {(char *)"length", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
2249         {(char *)"length_squared", (getter)Vector_length_squared_get, (setter)NULL, Vector_length_squared_doc, NULL},
2250         {(char *)"magnitude", (getter)Vector_length_get, (setter)Vector_length_set, Vector_length_doc, NULL},
2251         {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
2252         {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
2253
2254         /* autogenerated swizzle attrs, see python script below */
2255         {(char *)"xx",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
2256         {(char *)"xxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 292
2257         {(char *)"xxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2340
2258         {(char *)"xxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2852
2259         {(char *)"xxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3364
2260         {(char *)"xxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3876
2261         {(char *)"xxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 356
2262         {(char *)"xxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2404
2263         {(char *)"xxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2916
2264         {(char *)"xxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3428
2265         {(char *)"xxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3940
2266         {(char *)"xxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 420
2267         {(char *)"xxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2468
2268         {(char *)"xxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2980
2269         {(char *)"xxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3492
2270         {(char *)"xxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4004
2271         {(char *)"xxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 484
2272         {(char *)"xxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2532
2273         {(char *)"xxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3044
2274         {(char *)"xxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3556
2275         {(char *)"xxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4068
2276         {(char *)"xy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 44
2277         {(char *)"xyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 300
2278         {(char *)"xyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2348
2279         {(char *)"xyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2860
2280         {(char *)"xyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3372
2281         {(char *)"xyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3884
2282         {(char *)"xyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 364
2283         {(char *)"xyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2412
2284         {(char *)"xyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2924
2285         {(char *)"xyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3436
2286         {(char *)"xyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3948
2287         {(char *)"xyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 428
2288         {(char *)"xyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2476
2289         {(char *)"xyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2988
2290         {(char *)"xyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3500
2291         {(char *)"xyzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4012
2292         {(char *)"xyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 492
2293         {(char *)"xywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2540
2294         {(char *)"xywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3052
2295         {(char *)"xywz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3564
2296         {(char *)"xyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4076
2297         {(char *)"xz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 52
2298         {(char *)"xzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 308
2299         {(char *)"xzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2356
2300         {(char *)"xzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2868
2301         {(char *)"xzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3380
2302         {(char *)"xzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3892
2303         {(char *)"xzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 372
2304         {(char *)"xzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2420
2305         {(char *)"xzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2932
2306         {(char *)"xzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3444
2307         {(char *)"xzyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3956
2308         {(char *)"xzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 436
2309         {(char *)"xzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2484
2310         {(char *)"xzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2996
2311         {(char *)"xzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3508
2312         {(char *)"xzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4020
2313         {(char *)"xzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 500
2314         {(char *)"xzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2548
2315         {(char *)"xzwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3060
2316         {(char *)"xzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3572
2317         {(char *)"xzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4084
2318         {(char *)"xw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 60
2319         {(char *)"xwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 316
2320         {(char *)"xwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2364
2321         {(char *)"xwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2876
2322         {(char *)"xwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3388
2323         {(char *)"xwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3900
2324         {(char *)"xwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 380
2325         {(char *)"xwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2428
2326         {(char *)"xwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2940
2327         {(char *)"xwyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3452
2328         {(char *)"xwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3964
2329         {(char *)"xwz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 444
2330         {(char *)"xwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2492
2331         {(char *)"xwzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3004
2332         {(char *)"xwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3516
2333         {(char *)"xwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4028
2334         {(char *)"xww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 508
2335         {(char *)"xwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2556
2336         {(char *)"xwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3068
2337         {(char *)"xwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3580
2338         {(char *)"xwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4092
2339         {(char *)"yx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 37
2340         {(char *)"yxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 293
2341         {(char *)"yxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2341
2342         {(char *)"yxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2853
2343         {(char *)"yxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3365
2344         {(char *)"yxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3877
2345         {(char *)"yxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 357
2346         {(char *)"yxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2405
2347         {(char *)"yxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2917
2348         {(char *)"yxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3429
2349         {(char *)"yxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3941
2350         {(char *)"yxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 421
2351         {(char *)"yxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2469
2352         {(char *)"yxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2981
2353         {(char *)"yxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3493
2354         {(char *)"yxzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4005
2355         {(char *)"yxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 485
2356         {(char *)"yxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2533
2357         {(char *)"yxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3045
2358         {(char *)"yxwz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3557
2359         {(char *)"yxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4069
2360         {(char *)"yy",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 45
2361         {(char *)"yyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 301
2362         {(char *)"yyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2349
2363         {(char *)"yyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2861
2364         {(char *)"yyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3373
2365         {(char *)"yyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3885
2366         {(char *)"yyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 365
2367         {(char *)"yyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2413
2368         {(char *)"yyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2925
2369         {(char *)"yyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3437
2370         {(char *)"yyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3949
2371         {(char *)"yyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 429
2372         {(char *)"yyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2477
2373         {(char *)"yyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2989
2374         {(char *)"yyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3501
2375         {(char *)"yyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4013
2376         {(char *)"yyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 493
2377         {(char *)"yywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2541
2378         {(char *)"yywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3053
2379         {(char *)"yywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3565
2380         {(char *)"yyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4077
2381         {(char *)"yz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 53
2382         {(char *)"yzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 309
2383         {(char *)"yzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2357
2384         {(char *)"yzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2869
2385         {(char *)"yzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3381
2386         {(char *)"yzxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3893
2387         {(char *)"yzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 373
2388         {(char *)"yzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2421
2389         {(char *)"yzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2933
2390         {(char *)"yzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3445
2391         {(char *)"yzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3957
2392         {(char *)"yzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 437
2393         {(char *)"yzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2485
2394         {(char *)"yzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2997
2395         {(char *)"yzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3509
2396         {(char *)"yzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4021
2397         {(char *)"yzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 501
2398         {(char *)"yzwx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2549
2399         {(char *)"yzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3061
2400         {(char *)"yzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3573
2401         {(char *)"yzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4085
2402         {(char *)"yw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 61
2403         {(char *)"ywx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 317
2404         {(char *)"ywxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2365
2405         {(char *)"ywxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2877
2406         {(char *)"ywxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3389
2407         {(char *)"ywxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3901
2408         {(char *)"ywy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 381
2409         {(char *)"ywyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2429
2410         {(char *)"ywyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2941
2411         {(char *)"ywyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3453
2412         {(char *)"ywyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3965
2413         {(char *)"ywz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 445
2414         {(char *)"ywzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2493
2415         {(char *)"ywzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3005
2416         {(char *)"ywzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3517
2417         {(char *)"ywzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4029
2418         {(char *)"yww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 509
2419         {(char *)"ywwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2557
2420         {(char *)"ywwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3069
2421         {(char *)"ywwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3581
2422         {(char *)"ywww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4093
2423         {(char *)"zx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 38
2424         {(char *)"zxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 294
2425         {(char *)"zxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2342
2426         {(char *)"zxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2854
2427         {(char *)"zxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3366
2428         {(char *)"zxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3878
2429         {(char *)"zxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 358
2430         {(char *)"zxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2406
2431         {(char *)"zxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2918
2432         {(char *)"zxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3430
2433         {(char *)"zxyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3942
2434         {(char *)"zxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 422
2435         {(char *)"zxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2470
2436         {(char *)"zxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2982
2437         {(char *)"zxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3494
2438         {(char *)"zxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4006
2439         {(char *)"zxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 486
2440         {(char *)"zxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2534
2441         {(char *)"zxwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3046
2442         {(char *)"zxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3558
2443         {(char *)"zxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4070
2444         {(char *)"zy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 46
2445         {(char *)"zyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 302
2446         {(char *)"zyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2350
2447         {(char *)"zyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2862
2448         {(char *)"zyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3374
2449         {(char *)"zyxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3886
2450         {(char *)"zyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 366
2451         {(char *)"zyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2414
2452         {(char *)"zyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2926
2453         {(char *)"zyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3438
2454         {(char *)"zyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3950
2455         {(char *)"zyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 430
2456         {(char *)"zyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2478
2457         {(char *)"zyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2990
2458         {(char *)"zyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3502
2459         {(char *)"zyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4014
2460         {(char *)"zyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 494
2461         {(char *)"zywx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2542
2462         {(char *)"zywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3054
2463         {(char *)"zywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3566
2464         {(char *)"zyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4078
2465         {(char *)"zz",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 54
2466         {(char *)"zzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 310
2467         {(char *)"zzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2358
2468         {(char *)"zzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2870
2469         {(char *)"zzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3382
2470         {(char *)"zzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3894
2471         {(char *)"zzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 374
2472         {(char *)"zzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2422
2473         {(char *)"zzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2934
2474         {(char *)"zzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3446
2475         {(char *)"zzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3958
2476         {(char *)"zzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 438
2477         {(char *)"zzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2486
2478         {(char *)"zzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2998
2479         {(char *)"zzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3510
2480         {(char *)"zzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4022
2481         {(char *)"zzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 502
2482         {(char *)"zzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2550
2483         {(char *)"zzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3062
2484         {(char *)"zzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3574
2485         {(char *)"zzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4086
2486         {(char *)"zw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 62
2487         {(char *)"zwx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 318
2488         {(char *)"zwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2366
2489         {(char *)"zwxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2878
2490         {(char *)"zwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3390
2491         {(char *)"zwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3902
2492         {(char *)"zwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 382
2493         {(char *)"zwyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2430
2494         {(char *)"zwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2942
2495         {(char *)"zwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3454
2496         {(char *)"zwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3966
2497         {(char *)"zwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 446
2498         {(char *)"zwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2494
2499         {(char *)"zwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3006
2500         {(char *)"zwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3518
2501         {(char *)"zwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4030
2502         {(char *)"zww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 510
2503         {(char *)"zwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2558
2504         {(char *)"zwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3070
2505         {(char *)"zwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3582
2506         {(char *)"zwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4094
2507         {(char *)"wx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 39
2508         {(char *)"wxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 295
2509         {(char *)"wxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2343
2510         {(char *)"wxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2855
2511         {(char *)"wxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3367
2512         {(char *)"wxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3879
2513         {(char *)"wxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 359
2514         {(char *)"wxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2407
2515         {(char *)"wxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2919
2516         {(char *)"wxyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3431
2517         {(char *)"wxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3943
2518         {(char *)"wxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 423
2519         {(char *)"wxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2471
2520         {(char *)"wxzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2983
2521         {(char *)"wxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3495
2522         {(char *)"wxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4007
2523         {(char *)"wxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 487
2524         {(char *)"wxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2535
2525         {(char *)"wxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3047
2526         {(char *)"wxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3559
2527         {(char *)"wxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4071
2528         {(char *)"wy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 47
2529         {(char *)"wyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 303
2530         {(char *)"wyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2351
2531         {(char *)"wyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2863
2532         {(char *)"wyxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3375
2533         {(char *)"wyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3887
2534         {(char *)"wyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 367
2535         {(char *)"wyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2415
2536         {(char *)"wyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2927
2537         {(char *)"wyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3439
2538         {(char *)"wyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3951
2539         {(char *)"wyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 431
2540         {(char *)"wyzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2479
2541         {(char *)"wyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2991
2542         {(char *)"wyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3503
2543         {(char *)"wyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4015
2544         {(char *)"wyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 495
2545         {(char *)"wywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2543
2546         {(char *)"wywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3055
2547         {(char *)"wywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3567
2548         {(char *)"wyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4079
2549         {(char *)"wz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 55
2550         {(char *)"wzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 311
2551         {(char *)"wzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2359
2552         {(char *)"wzxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2871
2553         {(char *)"wzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3383
2554         {(char *)"wzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3895
2555         {(char *)"wzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 375
2556         {(char *)"wzyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2423
2557         {(char *)"wzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2935
2558         {(char *)"wzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3447
2559         {(char *)"wzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3959
2560         {(char *)"wzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 439
2561         {(char *)"wzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2487
2562         {(char *)"wzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2999
2563         {(char *)"wzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3511
2564         {(char *)"wzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4023
2565         {(char *)"wzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 503
2566         {(char *)"wzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2551
2567         {(char *)"wzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3063
2568         {(char *)"wzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3575
2569         {(char *)"wzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4087
2570         {(char *)"ww",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 63
2571         {(char *)"wwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 319
2572         {(char *)"wwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2367
2573         {(char *)"wwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2879
2574         {(char *)"wwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3391
2575         {(char *)"wwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3903
2576         {(char *)"wwy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 383
2577         {(char *)"wwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2431
2578         {(char *)"wwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2943
2579         {(char *)"wwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3455
2580         {(char *)"wwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3967
2581         {(char *)"wwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 447
2582         {(char *)"wwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2495
2583         {(char *)"wwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3007
2584         {(char *)"wwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3519
2585         {(char *)"wwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4031
2586         {(char *)"www",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 511
2587         {(char *)"wwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2559
2588         {(char *)"wwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3071
2589         {(char *)"wwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3583
2590         {(char *)"wwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4095
2591         {NULL, NULL, NULL, NULL, NULL}  /* Sentinel */
2592 };
2593
2594 /* Python script used to make swizzle array */
2595 /*
2596 SWIZZLE_BITS_PER_AXIS = 3
2597 SWIZZLE_VALID_AXIS = 0x4
2598
2599 axis_dict = {}
2600 axis_pos = {'x':0, 'y':1, 'z':2, 'w':3}
2601 axises = 'xyzw'
2602 while len(axises) >= 2:
2603
2604         for axis_0 in axises:
2605                 axis_0_pos = axis_pos[axis_0]
2606                 for axis_1 in axises:
2607                         axis_1_pos = axis_pos[axis_1]
2608                         axis_dict[axis_0 + axis_1] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS))' % (axis_0_pos, axis_1_pos)
2609                         if len(axises)>2:
2610                                 for axis_2 in axises:
2611                                         axis_2_pos = axis_pos[axis_2]
2612                                         axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
2613                                         if len(axises)>3:
2614                                                 for axis_3 in axises:
2615                                                         axis_3_pos = axis_pos[axis_3]
2616                                                         axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
2617
2618         axises = axises[:-1]
2619
2620
2621 items = axis_dict.items()
2622 items.sort(key = lambda a: a[0].replace('x', '0').replace('y', '1').replace('z', '2').replace('w', '3'))
2623
2624 unique = set()
2625 for key, val in items:
2626         num = eval(val)
2627         set_str = 'Vector_setSwizzle' if (len(set(key)) == len(key)) else 'NULL'
2628         print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4-len(key))), set_str, axis_dict[key], num)
2629         unique.add(num)
2630
2631 if len(unique) != len(items):
2632         print "ERROR"
2633 */
2634
2635 /* ROW VECTOR Multiplication - Vector X Matrix
2636  * [x][y][z] * [1][4][7]
2637  *             [2][5][8]
2638  *             [3][6][9]
2639  * vector/matrix multiplication IS NOT COMMUTATIVE!!!! */
2640 static int row_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat)
2641 {
2642         float vec_cpy[MAX_DIMENSIONS];
2643         int row, col, z = 0, vec_size = vec->size;
2644
2645         if (mat->num_row != vec_size) {
2646                 if (mat->num_row == 4 && vec_size == 3) {
2647                         vec_cpy[3] = 1.0f;
2648                 }
2649                 else {
2650                         PyErr_SetString(PyExc_ValueError,
2651                                         "vector * matrix: matrix column size "
2652                                         "and the vector size must be the same");
2653                         return -1;
2654                 }
2655         }
2656
2657         if (BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1)
2658                 return -1;
2659
2660         memcpy(vec_cpy, vec->vec, vec_size * sizeof(float));
2661
2662         r_vec[3] = 1.0f;
2663         //muliplication
2664         for (col = 0; col < mat->num_col; col++) {
2665                 double dot = 0.0;
2666                 for (row = 0; row < mat->num_row; row++) {
2667                         dot += MATRIX_ITEM(mat, row, col) * vec_cpy[row];
2668                 }
2669                 r_vec[z++] = (float)dot;
2670         }
2671         return 0;
2672 }
2673
2674 /*----------------------------Vector.negate() -------------------- */
2675 PyDoc_STRVAR(Vector_negate_doc,
2676 ".. method:: negate()\n"
2677 "\n"
2678 "   Set all values to their negative.\n"
2679 "\n"
2680 "   :return: an instance of itself\n"
2681 "   :rtype: :class:`Vector`\n"
2682 );
2683 static PyObject *Vector_negate(VectorObject *self)
2684 {
2685         if (BaseMath_ReadCallback(self) == -1)
2686                 return NULL;
2687
2688         negate_vn(self->vec, self->size);
2689
2690         (void)BaseMath_WriteCallback(self); // already checked for error
2691         Py_RETURN_NONE;
2692 }
2693
2694 static struct PyMethodDef Vector_methods[] = {
2695         /* Class Methods */
2696         {"Fill", (PyCFunction) C_Vector_Fill, METH_VARARGS | METH_CLASS, C_Vector_Fill_doc},
2697         {"Range", (PyCFunction) C_Vector_Range, METH_VARARGS | METH_CLASS, C_Vector_Range_doc},
2698         {"Linspace", (PyCFunction) C_Vector_Linspace, METH_VARARGS | METH_CLASS, C_Vector_Linspace_doc},
2699         {"Repeat", (PyCFunction) C_Vector_Repeat, METH_VARARGS | METH_CLASS, C_Vector_Repeat_doc},
2700
2701         /* in place only */
2702         {"zero", (PyCFunction) Vector_zero, METH_NOARGS, Vector_zero_doc},
2703         {"negate", (PyCFunction) Vector_negate, METH_NOARGS, Vector_negate_doc},
2704
2705         /* operate on original or copy */
2706         {"normalize", (PyCFunction) Vector_normalize, METH_NOARGS, Vector_normalize_doc},
2707         {"normalized", (PyCFunction) Vector_normalized, METH_NOARGS, Vector_normalized_doc},
2708
2709         {"resize", (PyCFunction) Vector_resize, METH_O, Vector_resize_doc},
2710         {"resized", (PyCFunction) Vector_resized, METH_O, Vector_resized_doc},
2711         {"to_2d", (PyCFunction) Vector_to_2d, METH_NOARGS, Vector_to_2d_doc},
2712         {"resize_2d", (PyCFunction) Vector_resize_2d, METH_NOARGS, Vector_resize_2d_doc},
2713         {"to_3d", (PyCFunction) Vector_to_3d, METH_NOARGS, Vector_to_3d_doc},
2714         {"resize_3d", (PyCFunction) Vector_resize_3d, METH_NOARGS, Vector_resize_3d_doc},
2715         {"to_4d", (PyCFunction) Vector_to_4d, METH_NOARGS, Vector_to_4d_doc},
2716         {"resize_4d", (PyCFunction) Vector_resize_4d, METH_NOARGS, Vector_resize_4d_doc},
2717         {"to_tuple", (PyCFunction) Vector_to_tuple, METH_VARARGS, Vector_to_tuple_doc},
2718         {"to_track_quat", (PyCFunction) Vector_to_track_quat, METH_VARARGS, Vector_to_track_quat_doc},
2719
2720         /* operation between 2 or more types  */
2721         {"reflect", (PyCFunction) Vector_reflect, METH_O, Vector_reflect_doc},
2722         {"cross", (PyCFunction) Vector_cross, METH_O, Vector_cross_doc},
2723         {"dot", (PyCFunction) Vector_dot, METH_O, Vector_dot_doc},
2724         {"angle", (PyCFunction) Vector_angle, METH_VARARGS, Vector_angle_doc},
2725         {"rotation_difference", (PyCFunction) Vector_rotation_difference, METH_O, Vector_rotation_difference_doc},
2726         {"project", (PyCFunction) Vector_project, METH_O, Vector_project_doc},
2727         {"lerp", (PyCFunction) Vector_lerp, METH_VARARGS, Vector_lerp_doc},
2728         {"rotate", (PyCFunction) Vector_rotate, METH_O, Vector_rotate_doc},
2729
2730         {"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
2731         {"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, NULL},
2732         {NULL, NULL, 0, NULL}
2733 };
2734
2735
2736 /* Note
2737  Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
2738  but this means for eg that
2739  vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
2740 */
2741
2742 PyDoc_STRVAR(vector_doc,
2743 "This object gives access to Vectors in Blender."
2744 );
2745 PyTypeObject vector_Type = {
2746         PyVarObject_HEAD_INIT(NULL, 0)
2747         /*  For printing, in format "<module>.<name>" */
2748         "mathutils.Vector",             /* char *tp_name; */
2749         sizeof(VectorObject),         /* int tp_basicsize; */
2750         0,                          /* tp_itemsize;  For allocation */
2751
2752         /* Methods to implement standard operations */
2753
2754         (destructor) BaseMathObject_dealloc,/* destructor tp_dealloc; */
2755         NULL,                       /* printfunc tp_print; */
2756         NULL,                       /* getattrfunc tp_getattr; */
2757         NULL,                       /* setattrfunc tp_setattr; */
2758         NULL,   /* cmpfunc tp_compare; */
2759         (reprfunc)Vector_repr,     /* reprfunc tp_repr; */
2760
2761         /* Method suites for standard classes */
2762
2763         &Vector_NumMethods,                       /* PyNumberMethods *tp_as_number; */
2764         &Vector_SeqMethods,                       /* PySequenceMethods *tp_as_sequence; */
2765         &Vector_AsMapping,                       /* PyMappingMethods *tp_as_mapping; */
2766
2767         /* More standard operations (here for binary compatibility) */
2768
2769         NULL,                       /* hashfunc tp_hash; */
2770         NULL,                       /* ternaryfunc tp_call; */
2771         (reprfunc)Vector_str,       /* reprfunc tp_str; */
2772         NULL,                       /* getattrofunc tp_getattro; */
2773         NULL,                       /* setattrofunc tp_setattro; */
2774
2775         /* Functions to access object as input/output buffer */
2776         NULL,                       /* PyBufferProcs *tp_as_buffer; */
2777
2778   /*** Flags to define presence of optional/expanded features ***/
2779         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
2780         vector_doc,                       /*  char *tp_doc;  Documentation string */
2781   /*** Assigned meaning in release 2.0 ***/
2782
2783         /* call function for all accessible objects */
2784         (traverseproc)BaseMathObject_traverse,  //tp_traverse
2785
2786         /* delete references to contained objects */
2787         (inquiry)BaseMathObject_clear,  //tp_clear
2788
2789   /***  Assigned meaning in release 2.1 ***/
2790   /*** rich comparisons ***/
2791         (richcmpfunc)Vector_richcmpr,                       /* richcmpfunc tp_richcompare; */
2792
2793   /***  weak reference enabler ***/
2794         0,                          /* long tp_weaklistoffset; */
2795
2796   /*** Added in release 2.2 ***/
2797         /*   Iterators */
2798         NULL,                       /* getiterfunc tp_iter; */
2799         NULL,                       /* iternextfunc tp_iternext; */
2800
2801   /*** Attribute descriptor and subclassing stuff ***/
2802         Vector_methods,           /* struct PyMethodDef *tp_methods; */
2803         NULL,                       /* struct PyMemberDef *tp_members; */
2804         Vector_getseters,           /* struct PyGetSetDef *tp_getset; */
2805         NULL,                       /* struct _typeobject *tp_base; */
2806         NULL,                       /* PyObject *tp_dict; */
2807         NULL,                       /* descrgetfunc tp_descr_get; */
2808         NULL,                       /* descrsetfunc tp_descr_set; */
2809         0,                          /* long tp_dictoffset; */
2810         NULL,                       /* initproc tp_init; */
2811         NULL,                       /* allocfunc tp_alloc; */
2812         Vector_new,                 /* newfunc tp_new; */
2813         /*  Low-level free-memory routine */
2814         NULL,                       /* freefunc tp_free;  */
2815         /* For PyObject_IS_GC */
2816         NULL,                       /* inquiry tp_is_gc;  */
2817         NULL,                       /* PyObject *tp_bases; */
2818         /* method resolution order */
2819         NULL,                       /* PyObject *tp_mro;  */
2820         NULL,                       /* PyObject *tp_cache; */
2821         NULL,                       /* PyObject *tp_subclasses; */
2822         NULL,                       /* PyObject *tp_weaklist; */
2823         NULL
2824 };
2825
2826 /*------------------------Vector_CreatePyObject (internal)-------------
2827   creates a new vector object
2828   pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
2829  (i.e. it was allocated elsewhere by MEM_mallocN())
2830   pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
2831  (i.e. it must be created here with PyMEM_malloc())*/
2832 PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type)
2833 {
2834         VectorObject *self;
2835
2836         if (size < 2) {
2837                 PyErr_SetString(PyExc_RuntimeError,
2838                                 "Vector(): invalid size");
2839                 return NULL;
2840         }
2841
2842         self = base_type ? (VectorObject *)base_type->tp_alloc(base_type, 0) :
2843                            (VectorObject *)PyObject_GC_New(VectorObject, &vector_Type);
2844
2845         if (self) {
2846                 self->size = size;
2847
2848                 /* init callbacks as NULL */
2849                 self->cb_user = NULL;
2850                 self->cb_type = self->cb_subtype = 0;
2851
2852                 if (type == Py_WRAP) {
2853                         self->vec = vec;
2854                         self->wrapped = Py_WRAP;
2855                 }
2856                 else if (type == Py_NEW) {
2857                         self->vec = PyMem_Malloc(size * sizeof(float));
2858                         if (vec) {
2859                                 memcpy(self->vec, vec, size * sizeof(float));
2860                         }
2861                         else { /* new empty */
2862                                 fill_vn_fl(self->vec, size, 0.0f);
2863                                 if (size == 4) { /* do the homogenous thing */
2864                                         self->vec[3] = 1.0f;
2865                                 }
2866                         }
2867                         self->wrapped = Py_NEW;
2868                 }
2869                 else {
2870                         Py_FatalError("Vector(): invalid type!");
2871                 }
2872         }
2873         return (PyObject *) self;
2874 }
2875
2876 PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
2877 {
2878         float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
2879         VectorObject *self = (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
2880         if (self) {
2881                 Py_INCREF(cb_user);
2882                 self->cb_user =                 cb_user;
2883                 self->cb_type =                 (unsigned char)cb_type;
2884                 self->cb_subtype =              (unsigned char)cb_subtype;
2885                 PyObject_GC_Track(self);
2886         }
2887