ISPLANE Check if input is a plane. B = isPlane(PLANE) where PLANE should be a plane or multiple planes Example isPlane([... 0 0 0 1 0 0 0 1 0;... 0 0 0 1 0 0 -1 0 0;... 0 0 0 1i 0 0 -1 0 0;... 0 0 0 nan 0 0 0 1 0;... 0 0 0 inf 0 0 0 1 0]) See also createPlane3d ------ Author: oqilipo Created: 2017-07-09 Copyright 2017
0001 function d = isPlane(plane) 0002 %ISPLANE Check if input is a plane. 0003 % 0004 % B = isPlane(PLANE) where PLANE should be a plane or multiple planes 0005 % 0006 % Example 0007 % isPlane([... 0008 % 0 0 0 1 0 0 0 1 0;... 0009 % 0 0 0 1 0 0 -1 0 0;... 0010 % 0 0 0 1i 0 0 -1 0 0;... 0011 % 0 0 0 nan 0 0 0 1 0;... 0012 % 0 0 0 inf 0 0 0 1 0]) 0013 % 0014 % See also 0015 % createPlane3d 0016 % 0017 % ------ 0018 % Author: oqilipo 0019 % Created: 2017-07-09 0020 % Copyright 2017 0021 0022 narginchk(1,1) 0023 0024 if size(plane,2)~=9 0025 d=false(size(plane,1),1); 0026 return 0027 end 0028 0029 a = ~any(isnan(plane),2); 0030 b = ~any(isinf(plane),2); 0031 c = ~isParallel3d(plane(:,4:6), plane(:,7:9)); 0032 0033 d = a & b & c; 0034 0035 end