Code covered by the BSD License  

Highlights from
2D Line Curvature and Normals

4.0

4.0 | 1 rating Rate this file 57 Downloads (last 30 days) File Size: 8.97 KB File ID: #32696
image thumbnail

2D Line Curvature and Normals

by Dirk-Jan Kroon

 

26 Aug 2011 (Updated 17 Oct 2011)

Accurate Curvature and Normals of a line/contour consisting of 2D points

| Watch this File

File Information
Description

LineCurvature2D, This function calculates the curvature of a 2D line. It first fits polygons to the points. Then calculates the analytical curvature from the polygons.
 
   K = LineCurvature2D(Vertices,Lines)
  
  inputs,
    Vertices : A M x 2 list of line points.
    (optional)
    Lines : A N x 2 list of line pieces, by indices of the vertices
          (if not set assume Lines=[1 2; 3 4 ; ... ; M-1 M])
 
  outputs,
    K : M x 1 Curvature values

.
.
LineNormals2D, This function calculates the normals, of the line. Using the neighbouring points of each line/contour point, and forward an backward differences on the end points

  N=LineNormals2D(V,L)
 
  inputs,
    V : List of points/vertices 2 x M
  (optional)
    Lines : A N x 2 list of line pieces, by indices of the vertices
          (if not set assume Lines=[1 2; 3 4 ; ... ; M-1 M])
 
  outputs,
    N : The normals of the Vertices 2 x M
 

MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
15 Oct 2011 Ravikiran Janardhana

I would like to point out a small typo:-
*****(correct)****
if(nargin<2)
    L=[(1:(size(V,1)-1))' (2:size(V,1))'];
end
*****
In the code I saw,the above was :-
*****(typo)*****
Lines=[(1:(size(Vertices,1)-1))' (2:size(Vertices,1))'];
*****

Please login to add a comment or rating.
Updates
17 Oct 2011

Corrected typo reported by Ravikiran Janardhana

Tag Activity for this File
Tag Applied By Date/Time
normals Dirk-Jan Kroon 26 Aug 2011 09:21:14
normal Dirk-Jan Kroon 26 Aug 2011 09:21:14
curvature Dirk-Jan Kroon 26 Aug 2011 09:21:14
2d Dirk-Jan Kroon 26 Aug 2011 09:21:14
line Dirk-Jan Kroon 26 Aug 2011 09:21:14
plot Dirk-Jan Kroon 26 Aug 2011 09:21:14
points Dirk-Jan Kroon 26 Aug 2011 09:21:14
vertices Dirk-Jan Kroon 26 Aug 2011 09:21:14
plane curves Dirk-Jan Kroon 26 Aug 2011 09:21:14
weighted Dirk-Jan Kroon 26 Aug 2011 09:21:14
polynomal Dirk-Jan Kroon 26 Aug 2011 09:21:14
fitting Dirk-Jan Kroon 26 Aug 2011 09:21:14
curves Dirk-Jan Kroon 26 Aug 2011 09:21:14
accurate Dirk-Jan Kroon 26 Aug 2011 09:21:14
curves Andy 29 May 2012 14:53:16
curvature Andy 29 May 2012 14:53:20

Contact us at files@mathworks.com