HOME

TheInfoList



OR:

In
computer graphics Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
, swizzles are a class of operations that transform vectors by rearranging components. Swizzles can also project from a vector of one dimensionality to a vector of another dimensionality, such as taking a three-dimensional vector and creating a two-dimensional or five-dimensional vector using components from the original vector. For example, if A = , where the components are x, y, z, and w respectively, you could compute B = A.wwxy, whereupon B would equal . Additionally, one could create a two-dimensional vector with A.wx or a five-dimensional vector with A.xyzwx. Combining vectors and swizzling can be employed in various ways. This is common in
GPGPU General-purpose computing on graphics processing units (GPGPU, or less often GPGP) is the use of a graphics processing unit (GPU), which typically handles computation only for computer graphics, to perform computation in applications traditiona ...
applications. (Relevant portion starts around 37min) In terms of
linear algebra Linear algebra is the branch of mathematics concerning linear equations such as :a_1x_1+\cdots +a_nx_n=b, linear maps such as :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matrix (mathemat ...
, this is equivalent to multiplying by a matrix whose rows are
standard basis In mathematics, the standard basis (also called natural basis or canonical basis) of a coordinate vector space (such as \mathbb^n or \mathbb^n) is the set of vectors, each of whose components are all zero, except one that equals 1. For exampl ...
vectors. If A=(1,2,3,4)^T, then swizzling A as above looks like :A.wwxy = \begin 0&0&0&1 \\ 0&0&0&1 \\ 1&0&0&0 \\ 0&1&0&0 \end\begin 1 \\ 2 \\ 3 \\ 4\end = \begin 4 \\ 4 \\ 1 \\ 2\end.


See also

Z-order curve


References


External links


OpenGL Vertex Program documentation
Swizzling {{Compu-graphics-stub