source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/lightspeed/graphics/draw_ellipse.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 658 bytes
Line 
1function h = draw_ellipse(x, c, outline_color, fill_color)
2% DRAW_ELLIPSE(x, c, outline_color, fill_color)
3%   Draws ellipses at centers x with covariance matrix c.
4%   x is a matrix of columns.  c is a positive definite matrix.
5%   outline_color and fill_color are optional.
6
7n = 40;                                 % resolution
8radians = [0:(2*pi)/(n-1):2*pi];
9unitC = [sin(radians); cos(radians)];
10r = chol(c)';
11
12if nargin < 3
13  outline_color = 'g';
14end
15
16h = [];
17for i=1:cols(x)
18  y = r*unitC + repmat(x(:, i), 1, n);
19  if nargin < 4
20    h = [h line(y(1,:), y(2,:), 'Color', outline_color)];
21  else
22    h = [h fill(y(1,:), y(2,:), fill_color, 'EdgeColor', outline_color)];
23  end
24end
Note: See TracBrowser for help on using the repository browser.