Changes

Jump to: navigation, search

Savy Cat

75 bytes added, 18:43, 25 March 2018
Rotate90
For any location at x & y, with width of image, height of image, z (number of colour channels):
<nowiki>
inline int idx(int x, int y, int w, int h, int z) {
return x + y * w + w * h * z;
}
</nowiki>
The first portion of the index equation should look familiar (x + y * w) for indexing a square 2D matrix. Adding the result of (w * h * z) enables this to work for a rectangular matrix of z (3) dimensions.
93
edits

Navigation menu