 			_v2 = i; _v3 = i + 1;
 
 			pos1 = { polygon.vertex[_v1].x, polygon.vertex[_v1].y, polygon.vertex[_v1].z };
-			d1 = polygon.vertex[_v1].w;
+			//d1 = polygon.vertex[_v1].w;
 
 			pos2 = { polygon.vertex[_v2].x, polygon.vertex[_v2].y, polygon.vertex[_v2].z };
-			d2 = polygon.vertex[_v2].w;
+			//d2 = polygon.vertex[_v2].w;
 
 			pos3 = { polygon.vertex[_v3].x, polygon.vertex[_v3].y, polygon.vertex[_v3].z };
-			d3 = polygon.vertex[_v3].w;
-
-			computeTriangleCentriod(pos1, pos2, pos3, d1, d2, d3, centriodTimesWeight, total_weight);
-			
+			//d3 = polygon.vertex[_v3].w;
+
+			computeTriangleCentriod(pos1, pos2, pos3,  centriodTimesWeight, total_weight);
+
 			current_weight += total_weight;
 			current_posTimesWeight.x += centriodTimesWeight.x;
 			current_posTimesWeight.y += centriodTimesWeight.y;

				points_nn,
				k_p
				);
			
			if (current_polygon.vertex_nb < 3 /*|| current_polygon.vertex_nb > 6*/) break;
			//atomicAdd(&valid_visited_nb[facetidx_in_block], 1);
			//if (tid == facets_nb - 1 && counter == 3){
				/*int idx = 0;
				double* ret = retdata + pid * 32;
				ret[0] = has_visited_nb[facetidx_in_block];
				for (int i = 0; t < has_visited_nb[facetidx_in_block]; ++i){
					ret[i + 1] = has_visited[facetidx_in_block][i];
				}
				
				for (index_t t = 0; t < ret[0]; ++t){
					ret[16 + t] = current_polygon.vertex[t].neigh_s;
				}*/
				//return;
			//}
			//return;
			//now we get the clipped polygon stored in "polygon", do something.
			action(
				current_polygon,


namespace Gpu_Rvd{

	CudaRestrictedVoronoiDiagram::CudaRestrictedVoronoiDiagram(Mesh* m, Points* p, int iter, std::vector<int> sample_facet, int k){
		vertex_ = m->v_ptr();
		vertex_nb_ = m->get_vertex_nb();
		points_ = p->v_ptr();
