void BlackBoxApp::draw() { toogleRGB(); if(noEffects) return; ofPushMatrix(); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); switch (drawMethod) { case 1: rotationPointCloud += (kbControlEase - rotationPointCloud)/ease; ofRotateY(rotationPointCloud); zoom += (kbZoom - zoom) / ease; ofScale(400 * zoom, 400 * zoom, 400 * zoom); drawPointCloud(); break; case 2: zoom += (kbZoom - zoom) / ease; ofScale(400 * zoom, 400 * zoom, 400 * zoom); drawCircleCloud(); break; case 3: ofScale(400, 400, 400); drawParticlesCloud(); break; case 4: ofScale(1000, 1000, 1000); drawPixels(); break; case 5: drawTriangleLines(); break; case 6: drawLaser(); break; case 7: drawContour(); break; case 8: drawTriangleColor(); break; case 9: drawTriangleBlue(); break; } ofPopMatrix(); ofSetColor(255, 255, 255); string showrgbString = "showRGB: "+ofToString(showRGB, 2); }
QImage CurveTransform::transform() { for(unsigned int i = 0; i < image_width; i++) { for(unsigned int j = 0; j < image_height; j++) { CartesianPair coords = {i, j}; drawPixels(convertToPixels(convertToCartesian(convertToPolar(coords))),coords); //Lisp, eat your heart out } } return out_image; }
/************************************************ || RayCast() || Purpose: calculates the pixel position and then || calls the trace function and then || the draw pixel function. || This is what starts all the ray tracing. ************************************************/ void RayCast() { RGBColor Pixel[view.size][view.size]; //keep track of colors int row,col; GLdouble d,n; RGBColor color; Vector p, //point of intersection curPixel; //current pixel being calculated d = view.d; n = view.size; //number of pixels //For each pixel //printf("Entering pixel rows\n"); for(row=0; row < view.size; row++) { //printf("\n\nEntering row %d\n", row); for(col=0; col < view.size; col++) { //printf("\nEntering col %d\n", col); //Finding the center of the current pixel //printf("Finding x "); curPixel.x = -d + (d/n) + (((2*d)/n) * row); //printf("Finding y "); curPixel.y = - d + (d/n) + (((2*d)/n) * col); //printf("Placing z "); curPixel.z = 0; //printf("Placing w "); curPixel.w = 1; //Find color and store it //printf("Entering trace\n"); color= trace(ray_from_eye_through(curPixel)); Pixel[row][col].red = color.red; Pixel[row][col].green = color.green; Pixel[row][col].blue = color.blue; } } drawPixels(Pixel); //draw the results }
void mieVideoPixelSource::draw(){ drawPixels(vidGrabber->getPixels()); }