 		){
 		index_t tid = blockIdx.x * blockDim.x + threadIdx.x;
 		if (tid >= facets_nb) return;
+
+		if (tid >= 0 && tid < points_nb){
+			g_seeds_information[tid * 4 + 0] = 0.0;
+			g_seeds_information[tid * 4 + 1] = 0.0;
+			g_seeds_information[tid * 4 + 2] = 0.0;
+			g_seeds_information[tid * 4 + 3] = 0.0;
+		}
 
 		//load \memory[facet] 3 times.
 		int3 facet_index = {


			//now we get the clipped polygon stored in "polygon", do something.
			action(
				);

			//Propagate to adjacent seeds

		dev_facets_(nil),
		dev_points_nn_(nil),
		dev_facets_nn_(nil),
		dev_ret_(nil),
		host_ret_(nil),
		dev_seeds_info_(nil),
		dev_seeds_poly_nb(nil)
	{
	}

	CudaRestrictedVoronoiDiagram::~CudaRestrictedVoronoiDiagram()
	{
	}

	/*
	* \brief Atomic operation add.
	*
	*/
	__device__
		double MyAtomicAdd(double* address, double val){
		unsigned long long int* address_as_ull = (unsigned long long int*)address;

		unsigned long long int old = *address_as_ull, assumed;

		do{
			assumed = old;
			old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val + __longlong_as_double(assumed)));
		} while (assumed != old);

		return __longlong_as_double(old);
	}

	/*
	 * \breif Manipulates the computed RVD data.
	 */
	__device__
		void action(
		const CudaPolygon polygon, index_t current_seed
	){
		double weight;
		double3 position;

		index_t _v1 = 0;
		index_t _v2, _v3;

		double3 pos1, pos2, pos3;
		double d1, d2, d3;
		index_t triangle_nb = polygon.vertex_nb - 2;

		double total_weight = 0.0;
		double3 centriodTimesWeight = { 0.0, 0.0, 0.0 };

		double current_weight = 0.0;
		double3 current_posTimesWeight = { 0.0, 0.0, 0.0 };

		for (index_t i = 1; i < polygon.vertex_nb - 1; ++i)
		{
			_v2 = i; _v3 = i + 1;

			pos1 = { polygon.vertex[_v1].x, polygon.vertex[_v1].y, polygon.vertex[_v1].z };
			d1 = polygon.vertex[_v1].w;

			pos2 = { polygon.vertex[_v2].x, polygon.vertex[_v2].y, polygon.vertex[_v2].z };
			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);

			current_weight += total_weight;
			current_posTimesWeight.x += centriodTimesWeight.x;
			current_posTimesWeight.y += centriodTimesWeight.y;
			current_posTimesWeight.z += centriodTimesWeight.z;

			total_weight = 0.0;
			centriodTimesWeight = { 0.0, 0.0, 0.0 };

			atomicAdd(&g_seeds_polygon_nb[current_seed], 1);
			if (triangle_nb > 0){

				current_weight /= triangle_nb;

				double3 temp_pos;

				temp_pos.x = current_posTimesWeight.x / triangle_nb;
				temp_pos.y = current_posTimesWeight.y / triangle_nb;
				temp_pos.z = current_posTimesWeight.z / triangle_nb;

				MyAtomicAdd(&g_seeds_information[current_seed * 4 + 0], temp_pos.x);
				MyAtomicAdd(&g_seeds_information[current_seed * 4 + 1], temp_pos.y);
				MyAtomicAdd(&g_seeds_information[current_seed * 4 + 2], temp_pos.z);
				MyAtomicAdd(&g_seeds_information[current_seed * 4 + 3], current_weight);
			}
		}
	}

	/*
