Fix LinearityValidator for vertical lines

The recent changes to switch the linearity validator to use X vs Y
fitting, caused a regression for vertical lines.  The fitting
becomes unstable for vertical/near-vertical lines and the
validator ends up returning false negatives.

This CL fixes it, by fitting in both X vs Y and in Y vs X, then
checking to see which one fit better and using that value.

BUG=chromium:567221
TEST=manually tested, I drew many lines of various types and the
results looked correct on all of them.

Change-Id: I216d5c0ec0a09a757c462debe37a6da3d5312da3
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/317673
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
1 file changed