 /*
 */
 __device__
-void intersection_clip_facet_with_knn(double* polygon_pointer, int& vertex_nb, int current_seed, double* seeds_pointer, int seeds_nb, int *seeds_neighbor_index, int k)
+void intersection_clip_facet_with_knn(double* polygon_pointer, int& vertex_nb, int current_seed, double* seeds_pointer, int seeds_nb, int *seeds_neighbor_index, int k
+, int tid, int pass)
 {
 	
 	//set a buffer pointer to store the polygon
-	double* polygon_buffer = (double*)malloc(sizeof(double) * 10 * 4);
+	double polygon_buffer[40];
 	int polygon_buffer_nb = 0;
-
+	
 	for (int i = 0; i < k; ++i)
 	{
 		int j = seeds_neighbor_index[current_seed * k + i];

			swap_polygons(polygon_pointer, vertex_nb, polygon_buffer, polygon_buffer_nb);
		}
	}

	free(polygon_buffer);
}

/*

		mesh_vertex[facet_index.z * 3 + 1],
		mesh_vertex[facet_index.z * 3 + 2] };

	double polygon[40];
	int vertex_nb;

	/*
