% Create points, edges, faces.
[p, e, f] = create_body( [0,0,0], 10, 7, 2, 10 );
% Draw wireframe to figure 1, 3.
draw_wireframe( 1, p, e, 'b' );
draw_wireframe( 3, p, e, 'k' );
% Draw solid to fihure 2.
draw_solid( 2, p, f, 'g' );

% Cut plane 1.
[ok, par] = x_plane_line( [0, 0, 2], [-0.2, 0, 1], [0, 1, 0],...
    p(:,e(:,1)), p(:,e(:,2)) );
% Get intersection points.
xp = get_x_point( p(:,e(:,1)), p(:,e(:,2)), ok, par );
% Draw intersection points to figure 1, 2, 3.
draw_point( 1, xp, 'rx' );
draw_point( 2, xp, 'rv' );
draw_point( 3, xp, 'bx' );
% Draw intersection lines with unsorted points to figure 3.
draw_closed_line( 3, xp, 'g' );
% Sort intersection points (convex version).
xps = sort_point_convex( xp );
% Draw intersection lines with sorted points to figure 1.
draw_closed_line( 1, xps, 'k:' );

% Cut plane 2.
[ok, par] = x_plane_line( [0, 0, 2], [1.7, 0, 1], [1, 1, 0.5],...
    p(:,e(:,1)), p(:,e(:,2)) );
% Get intersection points.
xp = get_x_point( p(:,e(:,1)), p(:,e(:,2)), ok, par );
% Draw intersection points to figure 1, 2, 3.
draw_point( 1, xp, 'gx' );
draw_point( 2, xp, 'b*' );
draw_point( 3, xp, 'rx' );
% Draw intersection lines with unsorted points to figure 3.
draw_closed_line( 3, xp, 'm' );
% Sort intersection points (convex version).
xps = sort_point_convex( xp );
% Draw intersection lines with sorted points to figure 1.
draw_closed_line( 1, xps, 'm--' );
