\h1\Using Vectors\h1\
\lo \
\-\ \url #Initialization \Initialization\ url\\list switch\
\--\ \url #initialization-with-no-arguments \with no arguments\ url\
\--\ \url #Initialization-with-a-single-number \with single number\ url\
\--\ \url #Initializing-all-components-with-numbers \all components with numbers\ url\
\--\ \url #Copying-a-vector \copying a vector\ url\
\--\ \url #Initializing-vectors-with-larger-vectors \with larger vectors\ url\
\--\ \url #Constructing-vectors-from-other-vectors-and-numbers \with vectors and numbers\ url\
\--\ \url #lists-and-other-iterables \Lists (and other iterables)\ url\
\--\ \url #objects-that-support-the-buffer-protocol-numpy-bytes \Buffer protocol (numpy, bytes)\ url\\list switch\
\-\ \url #Members \Members\ url\
\-\ \url #Methods \Methods\ url\\list switch\
\--\ \url #the-copy-protocol \The copy protocol\ url\
\--\ \url #pickling \Pickling\ url\
\--\ \url #to-list--tuple \To list / tuple\ url\
\--\ \url #to-and-from-bytes \To and from bytes\ url\\list switch\
\-\ \url #Operators \Operators\ url\\list switch\
\--\ \url #add--operator \add\ url\
\--\ \url #sub--operator \sub\ url\
\--\ \url #mul--operator \mul\ url\
\--\ \url #matmul--operator \matmul\ url\
\--\ \url #div--operator \div\ url\
\--\ \url #mod--operator \mod\ url\
\--\ \url #floordiv--operator \floordiv\ url\
\--\ \url #divmod \divmod\ url\
\--\ \url #lshift--operator \lshift\ url\
\--\ \url #rshift--operator \rshift\ url\
\--\ \url #and--operator \and\ url\
\--\ \url #or--operator \or\ url\
\--\ \url #xor--operator \xor\ url\
\--\ \url #pow--operator \pow\ url\
\--\ \url #len \len\ url\
\--\ \url #getitem-and-setitem--operator \getitem and setitem\ url\
\--\ \url #contains-in-operator \contains\ url\
\--\ \url #richcompare-eg--operator \richcompare\ url\
\--\ \url #iter \iter\ url\
\--\ \url #hash\hash\url\
\ list\
\h2\Initialization\h2\
There are dozens of ways of constructing a vector.  
For simplicity, if the same initialization process applies to all vector types, it will only be shown for \code\glm.vec2\code\.
\h4\Initialization with no arguments\h4\
Initializing a vector without any additional arguments will set all of it's components to zero (of the respective type).  
i.e. \code\glm.vec2()\code\ returns vector \code\(0.0, 0.0)\code\.  
A boolean vector would also be initialized with zero (or \code\False\code\ if you will).
\h4\Initialization with a single number\h4\
Initializing a vector with a number will set all of it's components to the given number (which may be converted if necessary).  
i.e. \code\glm.vec2(2.43)\code\ returns vector \code\(2.43, 2.43)\code\.  
\h4\Initializing all components with numbers\h4\
A vector \code\vecN\code\ can be initialized with \i\N\i\ numbers, which will be copied (or may be converted) to their components.  
i.e. \code\glm.vec2(1, 2)\code\ returns vector \code\(1.0, 2.0)\code\  
\code\glm.vec3(4, 5, 6)\code\ returns vector \code\(4.0, 5.0, 6.0)\code\  
\code\glm.ivec4(9, 8, 7, 6)\code\ returns vector \code\(9, 8, 7, 6)\code\
\h4\Copying a vector\h4\
A copy of a vector can be obtained by initializing a vector with an instance of a vector.  
i.e. \code\glm.vec2(glm.vec2(3, 2))\code\ returns vector \code\(3.0, 2.0)\code\  
This is what's known as the copy constructor.
\h4\Initializing vectors with larger vectors\h4\
You can initialize any vector with a larger vector (which will discard any values that don't fit into the new vector).  
i.e. \code\glm.vec1(glm.vec3(1, 2, 3))\code\ returns vector \code\(1.0)\code\  
likewise \code\glm.vec2(glm.vec4(5, 6, 7, 8))\code\ returns vector \code\(5.0, 6.0)\code\
\h4\Constructing vectors from other vectors and numbers\h4\
As long as you don't use any \code\vec1\code\s in your equation, you can construct any vector from a combination of vectors and / or numbers if their sum equals the length of the target vector.  
i.e. \code\glm.vec4(glm.vec2(1, 2), 3, 4)\code\ returns vector \code\(1.0, 2.0, 3.0, 4.0)\code\  
likewise \code\glm.vec3(5, glm.vec2(4, 3))\code\ returns vector \code\(5.0, 4.0, 3.0)\code\  

but \code\glm.vec2(glm.vec1(1), 2)\code\ doesn't work.  
\code\glm.vec3(glm.vec2(1, 2), glm.vec2(3, 4))\code\ also doesn't work.
\h3\Lists (and other iterables)\h3\
Instead of using vectors to initialize vectors, you can also use lists and other iterables.  
e.g. \code\glm.vec2([1, 2])\code\ returns vector \code\(1.0, 2.0)\code\  
or \code\glm.vec3((3, 4), 5)\code\ returns vector \code\(3.0, 4.0, 5.0)\code\  

\h3\Objects that support the buffer protocol (numpy, bytes)\h3\
A few objects in Python support a functionality called the buffer protocol.  
One such example would be the Python \code\bytes\code\ type or \code\numpy.array\code\.  
PyGLM also supports this protocol and thus can be converted to or from any other object that supports it, granted it's in a fitting format.  
e.g. \code\bytes(glm.u8vec2(1,2))\code\ returns \code\b'\\x01\\x02'\code\  
and \code\glm.u8vec2(b'\\x01\\x02')\code\ returns an 8-bit unsigned integer vector \code\(1, 2)\code\

or \code\glm.vec3(numpy.array([4,5,6]))\code\ returns vector \code\(4.0, 5.0, 6.0)\code\  
and \code\numpy.array(glm.vec3(4, 5, 6))\code\ returns \code\array([4., 5., 6.], dtype=float32)\code\  

\i\Note: objects that use the buffer protocol \i\may\i\ request a reference instead of a copy of the object, meaning that if you change the 'copy', you'll also change the original.\i\

\h2\Members\h2\
A vector has a member for each of it's values.  
\code\vec1\code\ has members: \code\(x)\code\  
\code\vec2\code\ has members: \code\(x, y)\code\  
\code\vec3\code\ has members: \code\(x, y, z)\code\  
\code\vec4\code\ has members: \code\(x, y, z, w)\code\  

Using swizzling, you can also construct vectors from up to four members:
\code Python \
v  = vec4(1, 2, 3, 4)
v2 = v.xy             # returns vec2(1, 2)
v3 = v.zw             # returns vec2(3, 4)
v4 = v.xxxw           # returns vec4(1, 1, 1, 4)
\ code\

\h2\Methods\h2\
Any vector type implements the following methods:

\h3\The copy protocol\h3\
Vectors support the copy protocol (see \url https://docs.python.org/3/library/copy.html \here\ url\).  
You can use \code\copy.copy(<vector>)\code\ or \code\copy.deepcopy(<vector>)\code\ to get a copy of a vector.

\h3\Pickling\h3\
Vectors support \url https://docs.python.org/3/library/pickle.html#module-interface \pickling\url\ (as of PyGLM 2.0.0), which is Python's serialization method.

\h3\To list / tuple\h3\
Any vector type has a \code\to_list()\code\ and a \code\to_tuple()\code\ function, which return's the vector's data represented as a list or tuple respectively.

\h3\To and from bytes\h3\
All vectors have a \code\to_bytes()\code\ and a \code\from_bytes()\code\ method, which allows for conversion of the vector's data to and from bytes strings.

\h2\Operators\h2\
Vector types support a \i\lot\i\ of operators.
\h3\add (\code\+\code\ operator)\h3\
Vectors support addition with other vectors and numbers.  
\code Python \
sum1 = vec2(1, 2) + vec2(4, 0) # returns vec2(5, 2)
sum2 = vec2(1, 2) + 4          # returns vec2(5, 6)
\ code\
\h3\sub (\code\-\code\ operator)\h3\
Vectors support subtraction with other vectors and numbers.  
\code Python \
diff1 = vec2(1, 2) - vec2(4, 0) # returns vec2(-3,  2)
diff2 = vec2(1, 2) - 4          # returns vec2(-3, -2)
\ code\
\h3\mul (\code\*\code\ operator)\h3\
Vectors support multiplication with other vectors and numbers.  
\code Python \
prod1 = vec2(1, 2) * vec2(4, 0) # returns vec2(4, 0)
prod2 = vec2(1, 2) * 4          # returns vec2(4, 8)
\ code\
\h3 \matmul (\code\@\code\ operator)\ h3\
Has the same effects as the \code\*\code\ operator, but with the arguments switched.
I.e. \code\a * b == b @ a\code\
\h3\div (\code\/\code\ operator)\h3\
Vectors support division with other vectors and numbers.  
\code Python \
quot1 = vec2(1, 2) / vec2(4, 0.5) # returns vec2(0.25, 4  )
quot2 = vec2(1, 2) / 4            # returns vec2(0.25, 0.5)
\ code\
\h3\mod (\code\%\code\ operator)\h3\
Vectors support modulo operations with other vectors and numbers.  
\code Python \
mod1 = vec2(1, 2) % vec2(4, 2) # returns vec2(1, 0)
mod2 = vec2(1, 2) % 4            # returns vec2(1, 2)
\ code\
\h3\floordiv (\code\//\code\ operator)\h3\
Vectors support floored division with other vectors and numbers.  
\code Python \
fquot1 = vec2(1, 2) // vec2(4, 0.5) # returns vec2(0, 4)
fquot2 = vec2(1, 2) // 4            # returns vec2(0, 0)
\ code\
\h3\divmod\h3\
Vectors support combined floor division and modulo operations with other vectors and numbers.  
\code Python \
divmod1 = divmod(vec2(1, 2), vec2(4, 2)) # returns (vec2(0, 1), vec2(1, 0))
divmod2 = divmod(vec2(1, 2), 4)          # returns (vec2(0, 0), vec2(1, 2))
\ code\
\h3\lshift (\code\<<\code\ operator)\h3\
Integer vectors support the bitwise left shift operator.  
\code Python \
>>> ivec3(1, 2, 3) << 4
ivec3( 16, 32, 48 )
>>> uvec3(1, 2, 3) << uvec3(1, 2, 3)
uvec3( 2, 8, 24 )
\ code\
\h3\rshift (\code\>>\code\ operator)\h3\
Integer vectors support the bitwise right shift operator.  
\code Python \
>>> ivec3(16, 32, 48) >> 4
ivec3( 1, 2, 3 )
>>> uvec3(2, 8, 24) >> uvec3(1, 2, 3)
uvec3( 1, 2, 3 )
\ code\
\h3\and (\code\&\code\ operator)\h3\
Integer vectors support the bitwise and operator.  
\code Python \
>>> ivec3(1, 2, 3) & 2
ivec3( 0, 2, 2 )
>>> uvec3(1, 2, 3) & uvec3(3, 2, 1)
uvec3( 1, 2, 1 )
\ code\
\h3\or (\code\|\code\ operator)\h3\
Integer vectors support the bitwise or operator.  
\code Python \
>>> ivec3(1, 2, 3) | 2
ivec3( 3, 2, 3 )
>>> uvec3(1, 2, 3) | uvec3(6, 5, 4)
uvec3( 7, 7, 7 )
\ code\
\h3\xor (\code\^\code\ operator)\h3\
Integer vectors support the bitwise xor operator.  
\code Python \
>>> ivec3(1, 2, 3) ^ 2
ivec3( 3, 0, 1 )
>>> uvec3(1, 2, 3) ^ uvec3(3, 2, 1)
uvec3( 2, 0, 2 )
\ code\
\h3\pow (\code\**\code\ operator)\h3\
Vectors support pow operations with other vectors and numbers.  
\code Python \
pow1 = vec2(1, 2) ** vec2(4, 2) # returns vec2(1,  4)
pow2 = vec2(1, 2) ** 4          # returns vec2(1, 16)
\ code\
\h3\len\h3\
The length of a vector can be queried using \code\len()\code\.
\code Python \
vec_length = len(vec2()) # returns 2
\ code\
\h3\getitem and setitem (\code\[]\code\ operator)\h3\
You can get the values of a vector using indices.
\code Python \
v = vec2(1, 2)
print(v[0]) # prints 1.0
print(v[1]) # prints 2.0
\ code\
Likewise you can set the values.
\code Python \
v    = vec2(1, 2)
v[0] = 9
print(v.x) # prints 9.0
\ code\
\h3\contains (\code\in\code\ operator)\h3\
You can query wether or not a value is contained by a vector using the \code\in\code\ operator.
\code Python \
v     = vec2(1, 2)
true  = 2    in v
false = 2.01 in v
\ code\
\h3\richcompare (e.g. \code\==\code\ operator)\h3\
You can compare vectors using the richcompare operators:
\code Python \
vec2(1, 2) == vec2(1, 2)    # True
vec2(1, 2) == vec2(2, 2)    # False
vec2(1, 2) == vec3(1, 2, 3) # False

vec2(1, 2) != vec2(1, 2)    # False
vec2(1, 2) != vec2(2, 2)    # True
vec2(1, 2) != vec3(1, 2, 3) # True

vec2(1, 2) < vec2(5, 5)     # vec2(1, 1)
vec2(1, 2) < vec2(2, 2)     # vec2(1, 0)
vec2(1, 2) < vec2(0, 0)     # vec2(0, 0)

vec2(1, 2) <= vec2(5, 5)    # vec2(1, 1)
vec2(1, 2) <= vec2(2, 2)    # vec2(1, 1)
vec2(1, 2) <= vec2(0, 0)    # vec2(0, 0)

vec2(1, 2) > vec2(5, 5)     # vec2(0, 0)
vec2(1, 2) > vec2(2, 2)     # vec2(0, 0)
vec2(1, 2) > vec2(0, 0)     # vec2(1, 1)

vec2(1, 2) >= vec2(5, 5)    # vec2(0, 0)
vec2(1, 2) >= vec2(2, 2)    # vec2(0, 1)
vec2(1, 2) >= vec2(0, 0)    # vec2(1, 1)
\ code\
\h3\iter\h3\
You can generate an iterable from vectors using \code\iter()\code\.
\code Python \
v  = vec2(1, 2)
it = iter(v)
print(next(it)) # prints 1.0
print(next(it)) # prints 2.0
\ code\

\h3\hash\h3\
You can generate a hash value for vectors using \code\hash()\code\
Example:
\code Python\
>>> v = vec2()
>>> hash(v)
-1952026010959490761
>>> v2 = vec2(1, 2)
>>> hash(v2)
8639716006723752019
>>> v3 = v2 * 0
>>> hash(v3)
-1952026010959490761
\code\