dimanche 1 novembre 2020

How to compare a line with a point? [closed]

I want to compare a double c,d; with a line. Some of the point which are not on the line, looks on the line with this code. What is the wrong with this code?

while(1)  {              

scanf("%lf%lf",&c,&d);
      x=c; 
      y=d;
      slope=1;
//for y=x+6

 if( (y-2)<(1.0/slope)*(x+4)){...}
 
else if(y-2>(1.0slope)*(x+4)){..}

else if((y-2)-(-1slope)*(x-4)>epsilon
//if left side is equal to right side
    }

Aucun commentaire:

Enregistrer un commentaire