Home > matGeom > geom2d > parallelEdge.m

parallelEdge

PURPOSE ^

PARALLELEDGE Edge parallel to another edge.

SYNOPSIS ^

function res = parallelEdge(edge, dist)

DESCRIPTION ^

PARALLELEDGE Edge parallel to another edge.

   EDGE2 = parallelEdge(EDGE, DIST)
   Computes the edge parallel to the input edge EDGE and located at the
   given signed distance DIST.

   Example
     obox = [30 40 80 40 30];
     figure; hold on; axis equal;
     drawOrientedBox(obox, 'LineWidth', 2);
     edge1 = centeredEdgeToEdge(obox([1 2 3 5]));
     edge2 = centeredEdgeToEdge(obox([1 2 4 5])+[0 0 0 90]);
     drawEdge(edge1, 'LineWidth', 2, 'color', 'g');
     drawEdge(edge2, 'LineWidth', 2, 'color', 'g');
     drawEdge(parallelEdge(edge1, -30), 'LineWidth', 2, 'color', 'k');
     drawEdge(parallelEdge(edge2, -50), 'LineWidth', 2, 'color', 'k');

   See also
     edges2d, parallelLine, drawEdge, centeredEdgeToEdge, edgeToLine

 ------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 Created: 2012-07-31,    using Matlab 7.9.0.529 (R2009b)
 Copyright 2012 INRA - Cepia Software Platform.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function res = parallelEdge(edge, dist)
0002 %PARALLELEDGE Edge parallel to another edge.
0003 %
0004 %   EDGE2 = parallelEdge(EDGE, DIST)
0005 %   Computes the edge parallel to the input edge EDGE and located at the
0006 %   given signed distance DIST.
0007 %
0008 %   Example
0009 %     obox = [30 40 80 40 30];
0010 %     figure; hold on; axis equal;
0011 %     drawOrientedBox(obox, 'LineWidth', 2);
0012 %     edge1 = centeredEdgeToEdge(obox([1 2 3 5]));
0013 %     edge2 = centeredEdgeToEdge(obox([1 2 4 5])+[0 0 0 90]);
0014 %     drawEdge(edge1, 'LineWidth', 2, 'color', 'g');
0015 %     drawEdge(edge2, 'LineWidth', 2, 'color', 'g');
0016 %     drawEdge(parallelEdge(edge1, -30), 'LineWidth', 2, 'color', 'k');
0017 %     drawEdge(parallelEdge(edge2, -50), 'LineWidth', 2, 'color', 'k');
0018 %
0019 %   See also
0020 %     edges2d, parallelLine, drawEdge, centeredEdgeToEdge, edgeToLine
0021 %
0022 % ------
0023 % Author: David Legland
0024 % e-mail: david.legland@grignon.inra.fr
0025 % Created: 2012-07-31,    using Matlab 7.9.0.529 (R2009b)
0026 % Copyright 2012 INRA - Cepia Software Platform.
0027 
0028 % compute the line parallel to the supporting line of edge
0029 line = parallelLine(edgeToLine(edge), dist);
0030 
0031 % result edge is given by line positions 0 and 1.
0032 res = [line(:, 1:2) line(:, 1:2)+line(:, 3:4)];

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