- def match_score_diag(match, q_min, s_min, q_max, s_max)
- dist1 = (match.q_beg - match.s_beg).abs
- dist2 = ((match.q_end - match.q_end).abs - dist1).abs
+ def match_score_diag(match, space)
+ if space.q_dim >= space.s_dim # s_dim is the narrow end
+ dist_beg = Math.dist_point2line(match.q_beg,
+ match.s_beg,
+ space.q_min,
+ space.s_min,
+ space.q_min + space.s_dim,
+ space.s_min + space.s_dim)
+
+ dist_end = Math.dist_point2line( match.q_beg,
+ match.s_beg,
+ space.q_max - space.s_dim,
+ space.s_max - space.s_dim,
+ space.q_max,
+ space.s_max)
+ else
+ dist_beg = Math.dist_point2line( match.q_beg,
+ match.s_beg,
+ space.q_min,
+ space.s_min,
+ space.q_min + space.q_dim,
+ space.s_min + space.q_dim)
+
+ dist_end = Math.dist_point2line( match.q_beg,
+ match.s_beg,
+ space.q_max - space.q_dim,
+ space.s_max - space.q_dim,
+ space.q_max,
+ space.s_max)
+ end