NFFT  3.3.2
voronoi.c
00001 /*
00002  * Copyright (c) 2002, 2016 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #include "api.h"
00020 #include "cstripack.h"
00021 
00023 void Y(voronoi_weights_1d)(R *w, R *x, const INT M)
00024 {
00025   INT j;
00026 
00027   w[0] = (x[1]-x[0])/K(2.0);
00028 
00029   for(j = 1; j < M-1; j++)
00030     w[j] = (x[j+1]-x[j-1])/K(2.0);
00031 
00032   w[M-1] = (x[M-1]-x[M-2])/K(2.0);
00033 }