46. 演習3
46
ofApp.h
class ofApp : public ofBaseApp{
・・・
static const int NUM = 100;
float radius[NUM];
float loc_x[NUM];
float loc_y[NUM];
};
int red[NUM];
int green[NUM];
int blue[NUM];
int alpha[NUM];
円の数101個
大きさ、位置がう
円に色を塗る
109. 109
ofApp.cpp
void ofApp::drawPointCloud(){
int w = 640;
int h = 480;
ofMesh mesh;
mesh.setMode(OF_PRIMITIVE_POINTS);
int step = 2; //ポイントの間隔
for(int y = 0; y < h; y += step) {
for(int x = 0; x < w; x += step) {
if(kinect.getDistanceAt(x, y) > 0) {
mesh.addColor(kinect.getColorAt(x,y));
mesh.addVertex(kinect.getWorldCoordinateAt(x, y));
}
}
}
延長戦