I am very confused by this ... Here is an excerpt from my code.
float m = 0.0, c = 0.0; printf("toprightx = %d bottomrightx = %d toprighty = %d bottomrighty = %d\n", toprightx, bottomrightx, toprighty, bottomrighty); // find m and c for symmetry line if (toprightx == bottomrightx) { m = (-toprighty + bottomrighty); } else { m = (-toprighty + bottomrighty) / (toprightx - bottomrightx); } c = -toprighty - (m * toprightx); printf("m = %f and c = %f\n", m, c);
And here is the conclusion:
toprightx = 241 bottomrightx = 279 toprighty = 174 bottomrighty = 321 m = -3.000000 and c = 549.000000
Why rounding output m and c? I declared them floating, so I donβt understand why the code returns integers. The correct m value should be -3.8684.
(Note that toprightx, bottomrightx, toprighty, bottomrighty are declared as integers in the code.)
source share