%=======================================================================
% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
% http://www.legi.grenoble-inp.fr
% Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
%
% This file is part of the toolbox UVMAT.
%
% UVMAT 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 2 of the license,
% or (at your option) any later version.
%
% UVMAT 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 (see LICENSE.txt) for more details.
%=======================================================================
function test = is3D(X),
Np = size(X,2);
%% Check for planarity of the structure:
X_mean = mean(X')';
Y = X - (X_mean*ones(1,Np));
YY = Y*Y';
[U,S,V] = svd(YY);
r = S(3,3)/S(2,2);
test = (r > 1e-3);