Scaling

This topic is 3780 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

So I'm writing some visualization code for a tri-diagonal heat diffusion equation. To solve this I have an array with cells to calculate temperatures. Then use the temperature and render colors according to the temperature to the screen. The visualization software does this through a series of rectangles. Therefore I am limited in the accuracy of my calculation to the resolution of the screen. Is the there some way I could scale down the size of the array based on the width of the window and the number of segments in my array so I can render averages of the temperatures instead of the whole array. Anyway If the code is needed I will post it, but the this scaling equation would be generic because I will need it for the size of the graph. Thanks elektronjunge

Share on other sites
I assume your array is 2-dimensional and the software draws one rectangle for each cell of the array.

Ignore the screen size when you set up the array. You don't "scale down the size of the array"; you set the size of the rectangle drawn for each cell.

Details depend on exactly how the software is "drawing rectangles".

Share on other sites
Right the array is already setup and the visualization soft ware works but I can not render more rectangles then there are pixels on the screen. It is also a one dimensional array, and I am using opengl to render it, but I do nor want to change the perspective.

Share on other sites
If your temperature array resolution is larger than your screen pixels, you will need to average the contributing temperature array cells into the pixel cell. I suggest you create an array the size of the screen and do something like this:

double temp_array[ta_rows][ta_cols];
double pixel_array[pa_rows][pa_cols];

Get that smart-ass to do it ;-)

Share on other sites
void scaleVisualization()
{
int i;
for(i = 0; i < visSize; ++i) {
visData = data[myRound(i* ((double) size/ (double) visSize))];
}
}

Heres what I came up with that works. Thanks for the help! (Yes I know doing a weighted average would be better)

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 10
• 14
• 9
• 9
• 9
• Forum Statistics

• Total Topics
633331
• Total Posts
3011395
• Who's Online (See full list)

There are no registered users currently online

×