--- /dev/null
+% center : [x y]
+function draw_ellipses(axe, ellipses, plot_3d, plot_center)
+ if ~exist('plot_3d', 'var')
+ plot_3d = false;
+ end
+
+ if ~exist('plot_center', 'var')
+ plot_center = false;
+ end
+
+ hold on;
+
+ if plot_3d
+ z_space = [0 1];
+ else
+ z_space = [0];
+ end
+
+ for i = 1:length(ellipses)
+ e = ellipses{i};
+ transform_mat = [cos(e.alpha) -sin(e.alpha); sin(e.alpha) cos(e.alpha)];
+
+ p_previous = [];
+ for phi = linspace(0, 2 * pi, 36);
+ for z = z_space
+ p = [e.x0; e.y0] + transform_mat * [e.r1 * cos(phi); e.r2 * sin(phi)]; % p : [x y]
+ if ~isempty(p_previous)
+ line = plot3(axe, [p(1) p_previous(1)], [p(2) p_previous(2)], [z z], 'LineWidth', 1, 'Color', 'yellow');
+ line.Color(4) = 0.5;
+ end
+ if z == 1
+ line = plot3(axe, [p(1) p(1)], [p(2) p(2)], [0 1], 'LineWidth', 0.5, 'Color', 'yellow');
+ line.Color(4) = 0.5;
+ end
+ end
+ p_previous = p;
+ end
+
+ if plot_center
+ plot(e.x0, e.y0, 'r.', 'MarkerSize', 20);
+ end
+ end
+end
+