Function circumcenter finds the radius R and the center of the circumscribed circle of a triangle in 3D space.
Function curvature calls circumcenter for every triplet P_i-1, P_i, P_i+1 of neighboring points along the curve. The curvature is defined as κ_i = 1/R_i. The curvature vector is k_i=ε_i/R, where ε_i is the unit vector in the direction from P_i to the center of the circle.
Note that this local calculation is sensitive to noise in the data.
The syntax is:
[L,R,K] = curvature(X)
X: array of column vectors for the curve coordinates. X may have two or three columns.
L: Arc length
R: Curvature radius
K: Curvature vector
Are Mjaavatten (2021). Curvature of a 1D curve in a 2D or 3D space (https://www.mathworks.com/matlabcentral/fileexchange/69452-curvature-of-a-1d-curve-in-a-2d-or-3d-space), MATLAB Central File Exchange. Retrieved .
Hi WJ: Sorry I did not see your comment earlier. The curvature vector K gives the size and direction of the curvature. It always points towards the concave side of the curve.
Hi Are, it seems that this analysis is unable to distinguish between curves that bend in opposite directions. Is that true? I'm only getting positive curvature values with dataset that consists of opposite bends. Please advise. Thanks.
Giuseppe Pontrelli: Handles1D curves only. The original title (Curvature of a 2D or 3D curve) was somewhat misleading.
Does the algorithm work also for concave 2D curves? how does the algorithm distinguish a convex and a concave point?
Matthew Wong: Three points are required to calculate the curvature and direction. Thus the arrays R and Kappa are not defined at the end points. I have chosen to use the value NaN at those points. I could have made the arrays smaller or used zeros, but NaN makes it easier to make nice plots.
I used parts of this function to solve the problem that initially inspired this function's creation. What does it mean if an 'e' value returns NaN? I believe that the sign of 'e' determines curve direction (either 1 or -1) but I'm not sure what the NaN means.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!