Debian Codegraph @

melder/NUMmetrics.cpp

raw symbols SCIP
1 /* NUMmetrics.cpp
2 *
3 * Copyright (C) 1992-2008,2011,2012,2014,2015,2017,2018 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "melder.h"cxx . . $ `<file>/melder/melder.h`/
20
21 int NUMrotationsPointInPolygoncxx . . $ NUMrotationsPointInPolygon(95d5ebe59db3a61f). (double x0, double y0, integercxx . . $ integer# n, double x [], double y []) {
22 integercxx . . $ integer# nup = 0, i;
23 int upold = y [n] > y0, upnew;
24 for (i = 1; i <= n; i ++) if ((upnew = y [i] > y0) != upold) {
25 integercxx . . $ integer# j = i == 1 ? n : i - 1;
26 if (x0 < x [i] + (x [j] - x [i]) * (y0 - y [i]) / (y [j] - y [i])) {
27 if (upnew) nup ++; else nup --;
28 }
29 upold = upnew;
30 }
31 return nup;
32 }
33
34 /* End of file NUM.cpp */