Jump to content
  • Advertisement
Sign in to follow this  
elektronjunge

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!