slopeOfLine method

dynamic slopeOfLine(
  1. Line l
)

this function returns the slope of a single word this can be very useful

Implementation

slopeOfLine(Line l) {
  var xRight = (l.cornerList![1].x + l.cornerList![2].x) / 2;
  var yRight = (l.cornerList![1].y + l.cornerList![2].y) / 2;
  var xLeft = (l.cornerList![0].x + l.cornerList![3].x) / 2;
  var yLeft = (l.cornerList![0].y + l.cornerList![3].y) / 2;
  var slope = (xLeft - xRight) / (yLeft - yRight);
  return slope;
}