% Chad Myers
% ELE 571
% File: generate_snake.m
% ------------------------
% The generate_snake function is part of the snakeGUI program for
% demonstrating SNAKE active contours. The function generates a set of x,y
% coordinates on circle given the number of points desired, the center and
% the radius of the circle.  This circle is used as the initial starting
% point for the SNAKE contour.

function snake = generate_snake(snake_len,center,radius)

 snake = zeros(snake_len,2);
 temp = (center(1) - radius):(2*radius)/(snake_len/2-1):(center(1) + radius);
 for i=1:(snake_len/2)
    snake(i,1) = temp(i);
    snake(i,2) = real((radius^2 - (snake(i,1)-center(1))^2)^.5 +center(2));
 end

 j = snake_len/2;
 for i=(snake_len/2 +1):snake_len
     snake(i,1) = snake(j,1);
     snake(i,2) = -snake(j,2);
     j = j-1;
 end
 
