📄 initphi.m
字号:
function phi = initphi( imsize, center, radius, isinside )% INITPHI Initialize the phi funcion% INITPHI( center, radius ) initializes the zero level level-set% of the phi function by the circle with the given center (x, y)% and radius. The size of phi is given by 'imsize'.% grab the requested size of phim = imsize( 1 ); n = imsize( 2 );% create a zero matrixphi = zeros( imsize );% go over each pixelfor i = 1 : m; for j = 1 : n; % get the sum of squares distance of the pixel from the center % of the circle distance = sqrt( sum( ( center - [ i, j ] ).^2 ) ); % set phi to be the signed distance from the pixel to the % circle's boundary, where the distance is positive for pixels % outside the boundary and negative for pixels inside the % boundary phi( i, j ) = distance - radius; if( isinside == 0 ) phi( i, j ) = -phi( i, j ); end endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -