Home > matGeom > geom2d > edgeAngle.m

edgeAngle

PURPOSE ^

EDGEANGLE Return angle of edge.

SYNOPSIS ^

function theta = edgeAngle(edge)

DESCRIPTION ^

EDGEANGLE Return angle of edge.

   A = edgeAngle(EDGE)
   Returns the angle between horizontal, right-axis and the edge EDGE.
   Angle is given in radians, between 0 and 2*pi, in counter-clockwise
   direction. 
   Notation for edge is [x1 y1 x2 y2] (coordinates of starting and ending
   points).

   Example
   p1 = [10 20];
   p2 = [30 40];
   rad2deg(edgeAngle([p1 p2]))
   ans = 
       45

   See also
   edges2d, angles2d, edgeAngle, lineAngle, edgeLength

   ---------
   author : David Legland
   INRA - TPV URPOI - BIA IMASTE
   created the 06/04/2003.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function theta = edgeAngle(edge)
0002 %EDGEANGLE Return angle of edge.
0003 %
0004 %   A = edgeAngle(EDGE)
0005 %   Returns the angle between horizontal, right-axis and the edge EDGE.
0006 %   Angle is given in radians, between 0 and 2*pi, in counter-clockwise
0007 %   direction.
0008 %   Notation for edge is [x1 y1 x2 y2] (coordinates of starting and ending
0009 %   points).
0010 %
0011 %   Example
0012 %   p1 = [10 20];
0013 %   p2 = [30 40];
0014 %   rad2deg(edgeAngle([p1 p2]))
0015 %   ans =
0016 %       45
0017 %
0018 %   See also
0019 %   edges2d, angles2d, edgeAngle, lineAngle, edgeLength
0020 %
0021 %   ---------
0022 %   author : David Legland
0023 %   INRA - TPV URPOI - BIA IMASTE
0024 %   created the 06/04/2003.
0025 %
0026 
0027 line = createLine(edge(:,1:2), edge(:,3:4));
0028 theta = lineAngle(line);

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019