ofxHighDim
//--------------------------------------------------------------
void ofApp::draw(){
// 배경 검정색.
ofBackground(100, 100, 25);
ofPushMatrix();
// 마우스에 따라 이동
ofTranslate(-ofGetMouseX() * (scale - 0.5), -ofGetMouseY() * (scale - 0.5));
// 각 이미지 디스플레이
for (int i=0; i<imagePoints.size(); i++) {
float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());
// 이미지 디스플레이
ofSetColor(255,255,255);
images[i].draw(x, y, imageSize * images[i].getWidth(), imageSize * images[i].getHeight());
}
ofNoFill();
for (int i=0; i<imagePoints.size(); i++) {
float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());
// 테두리 그리기
if(imgType[i] == 0) {
ofSetColor(0,0,0); // 0 이면 흑색.
ofSetLineWidth(4);
ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
}else {
ofSetColor(255,255,255); // 1이면 백색
ofSetLineWidth(4);
ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
}
}
ofPopMatrix();
gui.draw();
}
void ofApp::draw(){
// 배경 검정색.
ofBackground(100, 100, 25);
ofPushMatrix();
// 마우스에 따라 이동
ofTranslate(-ofGetMouseX() * (scale - 0.5), -ofGetMouseY() * (scale - 0.5));
// 각 이미지 디스플레이
for (int i=0; i<imagePoints.size(); i++) {
float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());
// 이미지 디스플레이
ofSetColor(255,255,255);
images[i].draw(x, y, imageSize * images[i].getWidth(), imageSize * images[i].getHeight());
}
ofNoFill();
for (int i=0; i<imagePoints.size(); i++) {
float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());
// 테두리 그리기
if(imgType[i] == 0) {
ofSetColor(0,0,0); // 0 이면 흑색.
ofSetLineWidth(4);
ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
}else {
ofSetColor(255,255,255); // 1이면 백색
ofSetLineWidth(4);
ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
}
}
ofPopMatrix();
gui.draw();
}
edged T-SNE PLot
답글삭제