title: Matlab: How to derive the vertices (coordinates) of polygons in voronoi diagram?
body: <p>I have a created function file in hand which is to draw lines in image,<code>[img]=drawline(point1,point2,color,img)</code>. It's used to connect any two points that are inside the image. I'm asked to create the voronoi diagram in image (not using plot function). For  the moment, i'm trying to show the lines in image, but i don't know how to get the vertices of the polygon edges.</p>
  
  <p>I've been using some test codes:</p>
  
  <pre><code>x=[50 70 70 30 40 ];% this is just some simple values for testing, 
  y=[50 30 90 30 80 ];% in further stage, i plan to use `x=rand(n,1)*200`.
  img=zeros(200,200,3);
  color=[255 0 0];
  [vx,vy]=voronoi(x,y); 
  </code></pre>
  
  <p>I only know till above, next i think i need to use <code>for loop</code> to line the vertices up. just no idea how to start.And i'm also stuck in how to solve the negative and infinite issues, if i need to display them in image(pixels coordinates).</p>