Home > matGeom > geom2d > edgeToLine.m

edgeToLine

PURPOSE ^

EDGETOLINE Convert an edge to a straight line.

SYNOPSIS ^

function line = edgeToLine(edge)

DESCRIPTION ^

EDGETOLINE Convert an edge to a straight line.

   LINE = edgeToLine(EDGE);
   Returns the straight line containing the edge EDGE.
   EDGE is represented as [X1 Y1  X2 Y2]
   LINE is represented as [X0 Y0  DX DY]

   Example
       edge = [2 3 4 5];
       line = edgeToLine(edge);
       figure(1); hold on; axis([0 10 0 10]);
       drawLine(line, 'color', 'g')
       drawEdge(edge, 'linewidth', 2)
   
   See also
   edges2d, lines2d, lineToEdge

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function line = edgeToLine(edge)
0002 %EDGETOLINE Convert an edge to a straight line.
0003 %
0004 %   LINE = edgeToLine(EDGE);
0005 %   Returns the straight line containing the edge EDGE.
0006 %   EDGE is represented as [X1 Y1  X2 Y2]
0007 %   LINE is represented as [X0 Y0  DX DY]
0008 %
0009 %   Example
0010 %       edge = [2 3 4 5];
0011 %       line = edgeToLine(edge);
0012 %       figure(1); hold on; axis([0 10 0 10]);
0013 %       drawLine(line, 'color', 'g')
0014 %       drawEdge(edge, 'linewidth', 2)
0015 %
0016 %   See also
0017 %   edges2d, lines2d, lineToEdge
0018 %
0019 
0020 % ------
0021 % Author: David Legland
0022 % e-mail: david.legland@inra.fr
0023 % Created: 2009-07-23,    using Matlab 7.7.0.471 (R2008b)
0024 % Copyright 2009 INRA - Cepia Software Platform.
0025 
0026 line = [edge(:, 1:2) edge(:, 3:4)-edge(:, 1:2)];

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