Home > matGeom > geom2d > angle3Points.m

angle3Points

PURPOSE ^

ANGLE3POINTS Compute oriented angle made by 3 points.

SYNOPSIS ^

function theta = angle3Points(varargin)

DESCRIPTION ^

ANGLE3POINTS Compute oriented angle made by 3 points.

   ALPHA = angle3Points(P1, P2, P3);
   Computes the angle between the points P1, P2 and P3.
   Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a 
   [N*1] array. The angle computed is the directed angle between line 
   (P2P1) and line (P2P3).
   Result is always given in radians, between 0 and 2*pi.

   See Also:
   points2d, angles2d, angle2points


   ---------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 created the 23/02/2004.
 Copyright 2010 INRA - Cepia Software Platform.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function theta = angle3Points(varargin)
0002 %ANGLE3POINTS Compute oriented angle made by 3 points.
0003 %
0004 %   ALPHA = angle3Points(P1, P2, P3);
0005 %   Computes the angle between the points P1, P2 and P3.
0006 %   Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a
0007 %   [N*1] array. The angle computed is the directed angle between line
0008 %   (P2P1) and line (P2P3).
0009 %   Result is always given in radians, between 0 and 2*pi.
0010 %
0011 %   See Also:
0012 %   points2d, angles2d, angle2points
0013 %
0014 %
0015 %   ---------
0016 % Author: David Legland
0017 % e-mail: david.legland@grignon.inra.fr
0018 % created the 23/02/2004.
0019 % Copyright 2010 INRA - Cepia Software Platform.
0020 
0021 
0022 %   HISTORY :
0023 %   25/09/2005 : enable single parameter
0024 
0025 if length(varargin)==3
0026     p1 = varargin{1};
0027     p2 = varargin{2};
0028     p3 = varargin{3};
0029 elseif length(varargin)==1
0030     var = varargin{1};
0031     p1 = var(1,:);
0032     p2 = var(2,:);
0033     p3 = var(3,:);
0034 end    
0035 
0036 % angle line (P2 P1)
0037 theta = lineAngle(createLine(p2, p1), createLine(p2, p3));
0038

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