Reputation: 577
Is there a direct way to know if general path is a straight line? and the width of the general path?
Upvotes: 0
Views: 139
Reputation: 24192
assumming all points on the path are given in some (x,y)
notation, you could say that a straight line is a group of points all "heading in the same direction", meaning that for every 2 consecutive points i and j, the ratio (Xj-Xi)/(Yj-Yi)
(which is the slope) is the same, or close enough (be wary of rounding errors with floating numbers)
Upvotes: 1