From: Vicente P. M. <vmi...@gm...> - 2010-04-23 16:09:28
|
Dear Micha, as suggested, let us continue the conversation via this list. Due to that mess in my posts, I do not know if you were able to see the link to an youtube video I just uploaded. One that shows the proble ocurring. Click here <http://www.youtube.com/watch?v=ut85B-w6iy4> if you have not seen it yet. I'll paste here again the codes I am using the update the 3D plot. Note that below are posted 3 methods. One of them is the SLOT that is responsible for the updating, which is the updt() method. The other two are only methods I used to organize the code itself, which are called by the updt() slot. A signal is emmited to this slot about every 0.5 seconds after some real hard processing done by the emmiting thread. /*This method set all scaling parameters the will be used to adjust the scales in the adjustScales() call.*/ void SurfacePlotter::setParameters(){ FieldROI *roi = info->getFieldROI(); numColumns = roi->getXNumPoints(); numRows = roi->getYNumPoints(); xMin = roi->getXFirst(); xMax = roi->getXLast(); yMin = roi->getYFirst(); yMax = roi->getYLast(); zMax = info->getSpPeak(); zMin = info->getSpMin(); int xDelta = xMax - xMin; int yDelta = yMax - yMin; double xS, yS; if(xDelta > yDelta){ xS = (double)xDelta / (double)yDelta; yS = 1.0; } else{ yS = (double)yDelta / (double)xDelta; xS = 1.0; } xScale = xS*1./(xMax-xMin); yScale = yS*1./(yMax-yMin); zScale = 2./(zMax-zMin); } /*This method adjust all scales that are needed to plot a visually correct 3D surface.*/ void SurfacePlotter::adjustScales(){ ParallelEpiped hull = this->hull(); d = (hull.maxVertex - hull.minVertex).length(); setScale(xScale, yScale, zScale); setZoom(d / (2*sqrt(3.0))); coords->axes[Z1].setTicLength(3*xScale, xScale); coords->axes[Z2].setTicLength(3*xScale, xScale); coords->axes[Z3].setTicLength(3*xScale, xScale); coords->axes[Z4].setTicLength(3*xScale, xScale); coords->axes[X1].setTicLength(3*yScale, yScale); coords->axes[X2].setTicLength(3*yScale, yScale); coords->axes[X3].setTicLength(3*yScale, yScale); coords->axes[X4].setTicLength(3*yScale, yScale); coords->axes[Y1].setTicLength(3*xScale, xScale); coords->axes[Y2].setTicLength(3*xScale, xScale); coords->axes[Y3].setTicLength(3*xScale, xScale); coords->axes[Y4].setTicLength(3*xScale, xScale); } /*This method updates the 3D plot with new data regarding the given instant of time. This is done by setting the scaling parameters, loading the data, adjusting the scales, and drawing.*/ void SurfacePlotter::updt(ResultsInfo *info){ this->info = info; this->setParameters(); this->loadFromData(info->getSpPowers(), numColumns, numRows, xMin, xMax, yMin, yMax); this->adjustScales(); this->updateGL(); saveLastImage(); } If you need any extra part of my code, such as the thread that emmits the signal, please let me know. Thank you very much in advance. -- Vicente Peruffo Minotto |