⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fittingfn_plane.m

📁 J-linkage 算法
💻 M
字号:
function [P] = fittingfn_plane(X)

  [rows,npts] = size(X);    
  
  if rows ~=3
    error('data is not 3D');
  end
  
  if npts < 3
    error('too few points to fit plane');
  end
  
  % Set up constraint equations of the form  AB = 0,
  % where B is a column vector of the plane coefficients
  % in the form   b(1)*X + b(2)*Y +b(3)*Z + b(4) = 0.
  
   o = mean(X');
   points_temp = X';

   for i = 1:size(points_temp, 1),
      points_temp(i, :) = points_temp(i, :) - o;
   end

   [v, d] = eig(points_temp' * points_temp);
   [m, i] = min(diag(d));

   P(1:3) = (v(:, i)' / norm(v(:, i)));
   P(4) = -sum(o .* P(1:3)); 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -