I have to draw Lines which has bigger double values like (3000.00,4500.45).
CImg<unsigned char> img(800,800,1,3,20);
img.draw_line( 3000.00, 4500.45, 3478.567, 4500.45, RED);
But i want to keep my screen size limited to 800x800
I thought to take Modulus of the Point's coordinates within 800 Like
3000.00%800=600
I can fit 600 in my Screen . But the problem is , CPP does not support modulus of double value .
double a = 3000.00;
printf("%lf",a%800.0); //Expected 600 but exception
**Invalid operand of type double,double to binary operator%**
How can I fit these large points in my screen using CImg ?
All depend on what you want to perform actually :
CImg<T>::draw_line()
method implements clipping and it will do this automatically for you.int
, then use the%
operator afterwards :img.draw_line( ((int)x0)%800, ((int)y0)%800, ((int)x1)%800, ((int)y1)%800, RED);
but be aware that the line that will be drawn has nothing to do with the original line: doing modulos is not a clipping method for drawing lines.