Home > vbmeg > functions > common > morphology > vb_make_inner_sphere.m

vb_make_inner_sphere

PURPOSE ^

vb_make_inner_sphere

SYNOPSIS ^

function [V,F,xx,X0] = vb_make_inner_sphere(Vox,Nvertex,mode,rate)

DESCRIPTION ^

 vb_make_inner_sphere
  [V,F,xx,X0] = vb_make_inner_sphere(Vox,Nvertex,mode)
 --- Input
 Vox : surface coordinate
 Nvertex : Number of sphere vertex to be made
 mode = 0 : min radius of Vox
      = 1 : mean radius of Vox
 rate : rate factor of radius
 --- Output
 V : vertex
 F : patch
 xx : normal vector of sphere
 X0 : center of sphere

 Made by M. Sato 2007-3-16

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [V,F,xx,X0] = vb_make_inner_sphere(Vox,Nvertex,mode,rate)
0002 % vb_make_inner_sphere
0003 %  [V,F,xx,X0] = vb_make_inner_sphere(Vox,Nvertex,mode)
0004 % --- Input
0005 % Vox : surface coordinate
0006 % Nvertex : Number of sphere vertex to be made
0007 % mode = 0 : min radius of Vox
0008 %      = 1 : mean radius of Vox
0009 % rate : rate factor of radius
0010 % --- Output
0011 % V : vertex
0012 % F : patch
0013 % xx : normal vector of sphere
0014 % X0 : center of sphere
0015 %
0016 % Made by M. Sato 2007-3-16
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 if ~exist('rate','var'), rate = 1; end;
0022 
0023 %
0024 %------- 球面作成
0025 %
0026 X0  = mean(Vox);    % 中心点
0027 
0028 % Radius of inner sphere
0029 R = (Vox(:,1)-X0(1)).^2 + (Vox(:,2)-X0(2)).^2 + (Vox(:,3)-X0(3)).^2;
0030 
0031 if ~exist('mode','var') | mode == 0,
0032     R = mean(sqrt(R))*rate;
0033 else
0034     R = sqrt(min(R))*rate;
0035 end
0036 
0037 % Unit sphere
0038 [F,xx] = vb_make_fullsphere(Nvertex);
0039 
0040 V = [R*xx(:,1)+X0(1), R*xx(:,2)+X0(2), R*xx(:,3)+X0(3)];

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005