The polygons are convex and planar and the vertices are ordered counter-clockwise.
I already have an algo to check if two convex polys intersects so I can filter it out and return zero distance, otherwise I will use the algorithm I search for.
The distance must be correct or at least underestimated. If the distance returned if bigger than real the contribution of lightmap is skipped making illuminations artifacts (darker regions).
I not search for speed, I precalculate these distances only once during radiosity setup.
I've partially solved, the assertions made on the box above are wrong i need to check for solid angle and thus accounting for the square of distance between hemicube origin and patch center.I have another question now, a radiosity solution based on hemicubes is automatically unit-less?
I've thinked that the inverse square law is due to the area that a polygon fill onto the hemicube faces, so the perspective automatically reduce this.... and so the units of the scene are not important.
But now, misuring the distance directly from polys, i think i need to convert units it to meters to work well?
I have also set an UnitsToMeters float to define the scene scale. Now it's all more correct.
The distance algorithm is always needed...