1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
\b\PyGLM\b\ brings a couple of types with it.
These types represent either \b\vectors\b\, \b\matrices\b\ or \b\quaternions\b\ or an \b\array\b\ containing the aforementioned.
\lo \
\-\ A \b\vector\b\ usually is an array of \b\1 to 4 numbers\b\ that serve as \b\positions\b\ or \b\directions\b\ in a
1 to 4 dimensional coordinate system (respectively).
They support a lot of operations necessary in \b\linear algebra\b\.
Vector types are expressed as \b\glm.vecN\b\ (\i\N\i\ being the length).
For example a \b\2D\b\ vector would be expressed as \code\glm.vec2\code\.
Refer to \url Using-vectors.md \using vectors\url\ for a complete type reference.
\-\ A \b\matrix\b\ is a \b\2 dimensional array\b\ of numbers ranging from \b\2x2\b\ (4 numbers) to \b\4x4\b\ (16 numbers).
They aid in a lot of complex vector manipulations.
Matrix types are expressed as \b\glm.matNxM\b\ (\i\N\i\ being the columns and \i\M\i\ being the rows).
So a \b\4x4\b\ matrix would be \code\glm.mat4x4\code\, or \code\glm.mat4\code\ for short (because \i\N\i\ and \i\M\i\ are equal).
Refer to \url Using-matrices.md \using matrices\url\ for a complete type reference.
Note: \i\Yes, columns and rows are not in the natural order - this is a flaw of glm.\i\
\-\ A \b\quaternion\b\ is an \b\array of 4 numbers\b\ that can be used for complex vector manipulations.
They are made up of a scalar part \code\(w)\code\ and a vector part \code\(x, y, z)\code\ and are sometimes displayed as
\code\(w + x*i + y*j + z*k)\code\, where \code\i\code\, \code\j\code\ and \code\k\code\ are imaginary numbers.
Quaternion types are simply expressed as \code\glm.quat\code\.
Refer to \url Using-quaternions.md \using quaternions\url\ for a complete type reference.
\-\A PyGLM \b\array\b\ (\code\glm.array\code\) is a simple way of storing a copy of multiple instances of one of the aforementioned types or numbers.
This array can then be used to \b\transfer that data over to external C functions\b\, such as \code\glBufferData\code\ from PyOpenGL.
Although PyGLM's arrays are a lot simpler than NumPy arrays, they're \b\quite a bit faster\b\.
Refer to \url Using-arrays.md \using arrays\url\ for a complete type reference.
\ lo\
PyGLM also provides simple access to \code\ctypes\code\ C datatypes, such as \code\c_float\code\, which can be accessed as \code\glm.c_float\code\ or \code\glm.float_\code\
(the underscore is only present for \code\float\code\ and \code\bool\code\ to accomodate for wildcard imports, which would override the builtin types).
\b\The following section is devoted to vectors, matrices and quaternions only.\b\
All of these types use \b\32-bit floating point numbers\b\ to store their values.
PyGLM does however provide \b\other data types\b\.
For \b \all of the aforementioned\ b\:
\table \
Data type \-\ Description \-\ Prefix
\b\double\b\ \-\ 64-bit floating point number \-\ \code\d\code\ or \code\f64\code\
\b\float\b\ \-\ 32-bit floating point number \-\ \code\f\code\ or \code\f32\code\ or none
\ table\
Additionally for \b \matrices\ b\ and \b \vectors\ b\:
\table \
Data type \-\ Description \-\ Prefix
\b\int\b\ \-\ 32-bit signed integer \-\ \code\i\code\ or \code\i32\code\
\b\uint\b\ \-\ 32-bit unsigned integer \-\ \code\u\code\ or \code\u32\code\
\ table\
And additionally for \b\vectors\b\:
\table \
Data type \-\ Description \-\ Prefix
\b\int64\b\ \-\ 64-bit signed integer \-\ \code\i64\code\
\b\int16\b\ \-\ 16-bit signed integer \-\ \code\i16\code\
\b\int8\b\ \-\ 8-bit signed integer \-\ \code\i8\code\
\b\uint64\b\ \-\ 64-bit unsigned integer \-\ \code\u64\code\
\b\uint16\b\ \-\ 16-bit unsigned integer \-\ \code\u16\code\
\b\uint8\b\ \-\ 8-bit unsigned integer \-\ \code\u8\code\
\b\bool\b\ \-\ boolean values \-\ \code\b\code\
\ table\
If for example you want to use a \b\2D int64\b\ vector, the type you want to use would be \code\glm.i64vec2\code\.
|