programer8
programer8

Reputation: 577

How to know if General Path is a Straight line or a curve?

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

Answers (1)

radai
radai

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

Related Questions