Home > SuperSegger > Internal > addBB.m

addBB

PURPOSE ^

addBB : creates a bounding box from the addition of two bounding boxes

SYNOPSIS ^

function bbResult = addBB( bb1, bb2 )

DESCRIPTION ^

 addBB : creates a bounding box from the addition of two bounding boxes

 INPUT : 
       bb1 : bounding box 1 
       bb2 : bounding box 2
 OUTPUT :
       bb : resulting bounding box


 Copyright (C) 2016 Wiggins Lab 
 Written by Paul Wiggins.
 University of Washington, 2016
 This file is part of SuperSegger.
 
 SuperSegger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 SuperSegger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bbResult = addBB( bb1, bb2 )
0002 % addBB : creates a bounding box from the addition of two bounding boxes
0003 %
0004 % INPUT :
0005 %       bb1 : bounding box 1
0006 %       bb2 : bounding box 2
0007 % OUTPUT :
0008 %       bb : resulting bounding box
0009 %
0010 %
0011 % Copyright (C) 2016 Wiggins Lab
0012 % Written by Paul Wiggins.
0013 % University of Washington, 2016
0014 % This file is part of SuperSegger.
0015 %
0016 % SuperSegger is free software: you can redistribute it and/or modify
0017 % it under the terms of the GNU General Public License as published by
0018 % the Free Software Foundation, either version 3 of the License, or
0019 % (at your option) any later version.
0020 %
0021 % SuperSegger is distributed in the hope that it will be useful,
0022 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 % GNU General Public License for more details.
0025 %
0026 % You should have received a copy of the GNU General Public License
0027 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0028 
0029 if isempty(bb1)
0030     bbResult = bb2;
0031 elseif isempty (bb2)
0032     bbResult = bb1;
0033 else
0034     ymin = min([bb1(2),bb2(2)]);
0035     xmin = min([bb1(1),bb2(1)]);
0036     ymax = max([bb1(2)+bb1(4),bb2(2)+bb2(4)]);
0037     xmax = max([bb1(1)+bb1(3),bb2(1)+bb2(3)]);    
0038     bbResult = [xmin, ymin, xmax-xmin, ymax-ymin];
0039 end
0040 
0041 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005