Coord3D OGL3DBase::GetPixelComponents(int nPixels) const { double maxMap = sqrt(xOrthoSpan * xOrthoSpan + yOrthoSpan * yOrthoSpan + zOrthoSpan * zOrthoSpan); // max diag of window int uVal = plotBase.plotUwidth; int vVal = plotBase.plotVheight; double windowDiag = sqrt(double(uVal * uVal) + double(vVal * vVal)); double pixelsPerAxes = maxMap / windowDiag * double(nPixels); // set output Coord3D outCoord(pixelsPerAxes); // adjust for axes scaling distortions Coord3D minCoord, maxCoord; GetTransformedLimits(minCoord, maxCoord); outCoord *= (maxCoord - minCoord); // adjust for axes length differences outCoord.cX /= xOrthoSpan; outCoord.cY /= yOrthoSpan; outCoord.cZ /= zOrthoSpan; return outCoord; }
//Apply this filter void evaluatePixel() { //Calculate block size float myblockcount = BlockCount/5.0; float BlockSize = 1.0/myblockcount; float2 temp = outCoord(); temp.x = temp.x/Width; temp.y = temp.y/Height; //Calculate block position and center float2 blockPos = floor(temp * myblockcount); float2 blockCenter = blockPos * BlockSize + BlockSize * 0.5; //Pixel distance from center float dist = length(temp - blockCenter) * myblockcount; //If pixel is inside inner circle //or outside outer circle then color //it with background color //otherwise color it with the color //of the pixel at the center if(dist < Min || dist > Max) { dst = color; } else { blockCenter.x = blockCenter.x * Width; blockCenter.y = blockCenter.y * Height; dst = sampleNearest(src, blockCenter); } }
//Apply for each pixel void evaluatePixel() { //Vector from circle center to current pixel float2 coord_for_this_pixel = outCoord() - center; //Length of the radius float cur_radius = length(coord_for_this_pixel); //Sample pixel and take shift into consideration float4 frontPixel = sampleNearest(frontImage, outCoord() - shift); //Background color if pixel is outside the circle if (cur_radius > radius) { dst = color; } //Otherwise keep the original color else { dst = frontPixel; } }