distance is 0-n, I need to convert the distance to 0-255. If I could I would do it like this for example:
increasement=256/max_distance;
for(x=0;x<max_distance;x++)
color=makecol(r+=increasement,g+=inc..,b+=...);
|
But I can''t in this case. I need it to be somehow check with the current distance. Here''s what I''m trying to do with a circle:
if(x<sqrt(rad*rad-(y*y))) //if the current coordinate is within the circle (adjustable center not implemented yet, it''s 0,0 currently)
{
dist=(int)(sqrt((float)(y*y+x*x))); //dinstance from 0,0
red+= 255 - //<-distance modifier here = distance somehow converted to 0-255
// 255 - might also be 0 + depending on the way that the distance is converted
// I thought it would be easier to make it so that the dist. modifier would be 255 when distance is the max_distance(=the radius of the circle), hence 255 - dist_mod
|
I know this is an easy question, but my brains are seriously jammed atm and I can''t figure out it by myself right now. So any help would be appritiated. thank you
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-