function [theTriangle]=triangleObstacle(p1,p2,p3,points)
% function [theTriangle]=triangleObstacle(p1,p2,p3,points)
%
% This function generates a triangular obstacle.
%
% Input parameters:
% p1, p2, p3-> points defining the triangle's corners (shoud be
% 2D column vectors)
% points-> number of points generated on each segment of the triangle
% Output parameters:
% theTriangle-> points conforming the triangle shape (is a 2xn
% matrix, each column is a rectangle point)
%
% Author: Antonio C. DomÃnguez Brito (adominguez@iusiani.ulpgc.es)
% Institution: SIANI-ULPGC (www.iusiani.ulpgc.es)
% Date: April 15th 2008
if nargin<4 | points<=2
theTriangle=[p1 p2 p3];
else
points=points-1;
theTriangle=[p1 lineObstacle(p1,p2,points) ...
p2 lineObstacle(p2,p3,points) ...
p3 lineObstacle(p3,p1,points)];
end
plot(theTriangle(1,:),theTriangle(2,:),'or');
axis equal;