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

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 % E-mail: david.legland@inrae.fr
0024 % Created: 2003-04-06
0025 % Copyright 2003-2024 INRA - TPV URPOI - BIA IMASTE
0026 
0027 line = createLine(edge(:,1:2), edge(:,3:4));
0028 theta = lineAngle(line);

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022