Created
November 9, 2012 11:42
-
-
Save ofZach/4045298 to your computer and use it in GitHub Desktop.
calibration pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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