Open main menu

CDOT Wiki β

Changes

Savy Cat

2 bytes removed, 18:44, 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