Cropping a Voronoi diagram

Someone know how can I get the correct crop of this Voronoi image using RegionFunction?

As you can see, there is a lot of undesired white regions inside the left polygon. Some clue on how to correct it? Here is the code using PointInPoly and RegionFunction:

PointInPoly[{x_, y_}, poly_List] :=
Module[{i, j, c = False, npol = Length[poly]},
For[i = 1; j = npol, i <= npol, j = i++,
If[((((poly[[i, 2]] <= y) && (y <
poly[[j, 2]])) || ((poly[[j, 2]] <= y) && (y <
poly[[i, 2]]))) && (x < (poly[[j, 1]] -
poly[[i, 1]])*(y - poly[[i, 2]])/(poly[[j, 2]] -
poly[[i, 2]]) + poly[[i, 1]])), c = \[Not] c];];
c]

pts=MapIndexed[Flatten[{##}]&,RandomReal[{0,1},{20,2}]];

poli={0.5,0.5}+#&/@Table[0.3{Cos[2\[Pi] k/6],Sin[2\[Pi] k/6]},{k,0,6}];
opt={ColorFunction->Hue
,InterpolationOrder->0
,ImageSize->500
,PlotRange->{{0,1},{0,1}}
,Epilog->{PointSize[.01],Point[Most/@pts],Line[poli]}
};

g1=ListDensityPlot[pts
,Sequence@@opt
,RegionFunction->Function[{x,y,z},PointInPoly[{x, y}, poli]]
];

g2=ListDensityPlot[pts
,Sequence@@opt
];

GraphicsRow@{g1, g2}


Important point, I can't use image manipulate functions.

What I really need is the list of polygons inside the cropped area. I get it using g1[[1]]

-

GraphicsMeshMeshInit[];

g2 = ListDensityPlot[pts, Sequence @@ opt];

po = Cases[
Normal @ g2,
Polygon[x_, y__] :> x,
Infinity];

po2 = PolygonIntersection[Polygon/@{poli, #}, AllTriangles->False] & /@ po /.
Polygon[{{}}] -> Sequence[];

GraphicsRow[{
Graphics[{Hue /@ Range[0, 1, 1/(Length[po2] - 1)], po2} // Transpose],
g2}, ImageSize -> 700]


Coordinates of vertices you are looking for are in po2, you can just remove Polygon heads from inside.

This is undocumented function but the method will work for each function calculating graphics intersection. I just used it because it is short.

-
Tks @Cuba. Exactly what I need. I'll wait just for respect the protocol. :) –  Murta Aug 27 '13 at 14:02
@Murta I'm glad it works as you want it to work. Of course, no need to hurry. :) –  Kuba Aug 27 '13 at 15:42
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.23846746981143951, "perplexity": 10033.651388338198}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-35/segments/1409535921872.11/warc/CC-MAIN-20140909040521-00432-ip-10-180-136-8.ec2.internal.warc.gz"}