A
A
Anatoly602014-12-26 17:49:23
Mathematics
Anatoly60, 2014-12-26 17:49:23

How to determine the curvature of a line?

There is a set of points in two-dimensional space through which a line passes. How to determine that the line is not straight, i.e. determine a certain coefficient of curvature?
tFyBXM4.png

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Armenian Radio, 2014-12-26
@gbg

Calculate the Pearsen correlation coefficient between X and Y of this line. The closer its modulus is to 1, the more it looks like a straight line.

J
jcmvbkbc, 2014-12-26
@jcmvbkbc

Maybe in a simple way to compare the distance between the start and end points with the sum of the lengths of all segments of the polyline between them? If these values ​​are close, then it looks like a straight line from afar. If not, then the curve, and the stronger the difference, the more crooked.

R
Rsa97, 2014-12-26
@Rsa97

Let (x 0 , y 0 ) and (x 1 , y 1 ) be the extreme points of the segment. Then the coefficients of the general equation of the straight line
can be defined as
Distance from the point (x, y) to the line
Then it remains to determine the deviation metric, for example, the average distance from intermediate points to the segment, divided by the length of the segment

M
Mrrl, 2014-12-26
@Mrl

If you need to check the average deviation from the straight line, then you can calculate the covariance matrix:
xm=sum(x[i])/N; ym=sum(y[i])/N;
a=sum((x[i]-xm)^2); b=sum((x[i]-xm)*(y[i]-ym)); c=sum((y[i]-y0)^2);
and calculate the ratio of eigenvalues:
R=(a+c-sqrt((ac)^2+4*b^2)/(a+c+sqrt((ac)^2+4*b^2).
If R is small enough (say, less than 0.01), then we assume that it is a straight line.If
we need to check whether it is a straight line or an arc, then we take the extreme points (x0,y0) and (xn,yn) Let dx=xn-x0,dy= yn-y0
Calculate for all points
z[i]=((x[i]-x0)*dx+(y[i]-y0)*dy)/sqrt(dx^2+dy^2), w[i ]=((x[i]-x0)*dy-(y[i]-y0)*dx)/sqrt(dx^2+dy^2),
Now we approximate the dependence w(z) by a parabola (by the method of least squares): w=A*z^2+B*z+C. The value of A is proportional to the curvature of the arc along which the points go.

A
anatoly60, 2014-12-26
@anatoly60

Thank you all for your ideas and suggestions. At the moment, I decided to sequentially count the angle between 3 points. For the line on the left, the angle between any three points will be close to 180.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question