Skip to content

Instantly share code, notes, and snippets.

@ofZach
Created November 9, 2012 11:42
Show Gist options
  • Save ofZach/4045298 to your computer and use it in GitHub Desktop.
Save ofZach/4045298 to your computer and use it in GitHub Desktop.
calibration pattern
// useful for projection alignment, etc:
// http://i.imgur.com/rWJLE.jpg
int nbOfCol = ofGetWidth() / 25;
int boardWidth = ofGetWidth();
int boardHeight = ofGetHeight();
float squareSize = boardWidth / nbOfCol;
int nbOfRow = ceil(boardHeight / squareSize);
for (int colId = 0; colId < nbOfCol; colId++) {
for (int rowId = 0; rowId < nbOfRow; rowId++) {
if ((colId + rowId) % 2 == 0) {
ofSetColor(ofColor::white);
} else {
ofSetColor(ofColor::black);
}
if ((rowId) % 6 == 0) {
ofSetColor( ofColor::fromHsb( (rowId * 50) % 255 , 255, 255));
}
else if ((colId) % 6 == 0) {
ofSetColor( ofColor::fromHsb((colId * 50) % 255 , 255, 255));
}
ofRect(colId * squareSize, rowId * squareSize, squareSize, squareSize);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment