BOX3DVOLUME Volume of a 3-dimensional box. V = box3dVolume(BOX) A box is represented as a set of limits in each direction: BOX = [XMIN XMAX YMIN YMAX ZMIN ZMAX]. Example [n e f] = createCubeOctahedron; box = boundingBox3d(n); vol = box3dVolume(box) vol = 8 See also boxes3d, boundingBox3d ------ Author: David Legland e-mail: david.legland@grignon.inra.fr Created: 2010-07-26, using Matlab 7.9.0.529 (R2009b) Copyright 2010 INRA - Cepia Software Platform.
0001 function vol = box3dVolume(box) 0002 %BOX3DVOLUME Volume of a 3-dimensional box. 0003 % 0004 % V = box3dVolume(BOX) 0005 % 0006 % A box is represented as a set of limits in each direction: 0007 % BOX = [XMIN XMAX YMIN YMAX ZMIN ZMAX]. 0008 % 0009 % Example 0010 % [n e f] = createCubeOctahedron; 0011 % box = boundingBox3d(n); 0012 % vol = box3dVolume(box) 0013 % vol = 0014 % 8 0015 % 0016 % 0017 % See also 0018 % boxes3d, boundingBox3d 0019 % 0020 % ------ 0021 % Author: David Legland 0022 % e-mail: david.legland@grignon.inra.fr 0023 % Created: 2010-07-26, using Matlab 7.9.0.529 (R2009b) 0024 % Copyright 2010 INRA - Cepia Software Platform. 0025 0026 vol = prod(box(:, 2:2:end) - box(:, 1:2:end), 2);