| 1 | #cxx . . $ `<file>/dwtools/Polygon_extensions.h`/ifndef _Polygon_extensions_h_ |
| 2 | #define _Polygon_extensions_h_cxx . . $ `dwtools/Polygon_extensions.h:2:9`! |
| 3 | /* Polygon_extensions.h |
| 4 | * |
| 5 | * Copyright (C) 1993-2019 David Weenink |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | djmw 1996 |
| 23 | djmw 20020813 GPL header |
| 24 | djmw 20120220 Latest modification |
| 25 | */ |
| 26 | |
| 27 | #include "Polygon.h"cxx . . $ `<file>/fon/Polygon.h`/ |
| 28 | #include "Categories.h"cxx . . $ `<file>/dwtools/Categories.h`/ |
| 29 | #include "Graphics.h"cxx . . $ `<file>/sys/Graphics.h`/ |
| 30 | #include "Sound.h"cxx . . $ `<file>/fon/Sound.h`/ |
| 31 | |
| 32 | #define Polygon_INSIDEcxx . . $ `dwtools/Polygon_extensions.h:32:9`! -1 |
| 33 | #define Polygon_OUTSIDEcxx . . $ `dwtools/Polygon_extensions.h:33:9`! 0 |
| 34 | #define Polygon_BOUNDARYcxx . . $ `dwtools/Polygon_extensions.h:34:9`! 1 |
| 35 | #define Polygon_EDGEcxx . . $ `dwtools/Polygon_extensions.h:35:9`! 3 |
| 36 | #define Polygon_VERTEXcxx . . $ `dwtools/Polygon_extensions.h:36:9`! 5 |
| 37 | |
| 38 | void Polygon_getExtremacxx . . $ Polygon_getExtrema(7bc564fe6c79180b). (Polygoncxx . . $ Polygon# me, double *out_xmin, double *out_xmax, double *out_ymin, double *out_ymax); |
| 39 | |
| 40 | autoPolygoncxx . . $ autoPolygon# Polygon_createSimplecxx . . $ Polygon_createSimple(5ec1d710d38aec9c). (constVECVUcxx . . $ constVECVU# const& vertices_asXYPairs); |
| 41 | |
| 42 | autoPolygoncxx . . $ autoPolygon# Polygon_createFromRandomPointscxx . . $ Polygon_createFromRandomPoints(a7feded88c281902). (integercxx . . $ integer# numberOfVertices, double xmin, double xmax, double ymin, double ymax); |
| 43 | |
| 44 | autoPolygoncxx . . $ autoPolygon# Polygon_simplifycxx . . $ Polygon_simplify(18f02ed335786f5e). (Polygoncxx . . $ Polygon# me); |
| 45 | |
| 46 | void Polygon_translatecxx . . $ Polygon_translate(5c67dd9106539855). (Polygoncxx . . $ Polygon# me, double xt, double yt); |
| 47 | |
| 48 | void Polygon_rotatecxx . . $ Polygon_rotate(47fb2ed3c48fec03). (Polygoncxx . . $ Polygon# me, double alpha, double xc, double yc); |
| 49 | |
| 50 | void Polygon_scalecxx . . $ Polygon_scale(5c67dd9106539855). (Polygoncxx . . $ Polygon# me, double xs, double ys); |
| 51 | |
| 52 | void Polygon_reverseXcxx . . $ Polygon_reverseX(91453997b1d2886f). (Polygoncxx . . $ Polygon# me); |
| 53 | |
| 54 | void Polygon_reverseYcxx . . $ Polygon_reverseY(91453997b1d2886f). (Polygoncxx . . $ Polygon# me); |
| 55 | |
| 56 | autoPolygoncxx . . $ autoPolygon# Polygon_circularPermutationcxx . . $ Polygon_circularPermutation(5f594b76660cfd5). (Polygoncxx . . $ Polygon# me, integercxx . . $ integer# nshift); |
| 57 | |
| 58 | // Is point (x,y) Inside, Outside, Boundary (Edge or Vertex) ? |
| 59 | int Polygon_getLocationOfPointcxx . . $ Polygon_getLocationOfPoint(7c887ac351245d3b). (Polygoncxx . . $ Polygon# me, double x0, double y0, double eps); |
| 60 | |
| 61 | void Polygon_Categories_drawcxx . . $ Polygon_Categories_draw(d630b9065d4a3419). (Polygoncxx . . $ Polygon# me, Categoriescxx . . $ Categories# thee, Graphicscxx . . $ Graphics# graphics, double xmin, double xmax, double ymin, double ymax, bool garnish); |
| 62 | /* reverse axis when min > max */ |
| 63 | |
| 64 | void Polygon_drawMarkscxx . . $ Polygon_drawMarks(b15a615d680d36a0). (Polygoncxx . . $ Polygon# me, Graphicscxx . . $ Graphics# g, double xmin, double xmax, double ymin, double ymax, double size_mm, conststring32cxx . . $ conststring32# mark); |
| 65 | |
| 66 | autoPolygoncxx . . $ autoPolygon# Sound_to_Polygoncxx . . $ Sound_to_Polygon(d49c6384878752b8). (Soundcxx . . $ Sound# me, integercxx . . $ integer# channel, double tmin, double tmax, double ymin, double ymax, double level); |
| 67 | /* |
| 68 | Post-conditions: |
| 69 | |
| 70 | If there are ns = i2 - i1 + 1 samples of the sound in the interval (tmin, tmax), the first at index i1 |
| 71 | and the last at index i2, the Polygon will have np = 2 + ns + 2 + 1 points. |
| 72 | i1 = Sampled_xToHighIndex (me, tmin) |
| 73 | i2 = Sampled_xToLowIndex (me, tmax) |
| 74 | thy x [1] = tmin |
| 75 | thy y [1] = clip(level) |
| 76 | thy x [2] = tmin |
| 77 | thy y [2] = interpolated amplitude in 'channel' at tmin (or, averaged over all channels if channel = 0) |
| 78 | thy x [3] = my x1 + (i1 - 1) * my dx |
| 79 | thy y [3] = clip(my z [channel] [i1]) (or, averaged over all channels if channel == 0) |
| 80 | ... |
| 81 | thy x [ns+2] = my x1 +(i2 - 1) * my dx |
| 82 | thy y [ns+2] = clip(my z [channel] [i2]) (or, averaged over all channels if channel == 0) |
| 83 | thy x [ns+3] = tmax |
| 84 | thy y [ns+3] = clip(interpolated amplitude in 'channel' at tmax (or, averaged over all channels if channel == 0)) |
| 85 | thy x [ns+4] = tmax |
| 86 | thy y [ns+4] = clip(level) |
| 87 | thy x [ns+5] = thy x [1] (close the path) |
| 88 | thy y [ns+5] = thy y [1] |
| 89 | where clip(y) = y < ymin ? ymin : y > ymax ? ymax ; y; |
| 90 | */ |
| 91 | |
| 92 | autoPolygoncxx . . $ autoPolygon# Sounds_to_Polygon_enclosedcxx . . $ Sounds_to_Polygon_enclosed(e8f555567ffc235c). (Soundcxx . . $ Sound# me, Soundcxx . . $ Sound# thee, integercxx . . $ integer# channel, double tmin, double tmax, double ymin, double ymax); |
| 93 | /* Area enclosed by the sounds */ |
| 94 | |
| 95 | autoPolygoncxx . . $ autoPolygon# Polygons_unioncxx . . $ Polygons_union(bc0089f2395c09bf). (Polygoncxx . . $ Polygon# me, Polygoncxx . . $ Polygon# thee); |
| 96 | |
| 97 | Collection_definecxx . . $ autoSomeThing#static_cast_move(8f979c7064dbabcf). (PolygonBag, CollectionOf, Polygon) { |
| 98 | }; |
| 99 | |
| 100 | autoPolygonBagcxx . . $ autoPolygonBag# Polygons_clipcxx . . $ Polygons_clip(4fbb2164e8b4b37c). (Polygoncxx . . $ Polygon# me, Polygoncxx . . $ Polygon# thee); |
| 101 | |
| 102 | autoPolygoncxx . . $ autoPolygon# Polygon_convexHullcxx . . $ Polygon_convexHull(18f02ed335786f5e). (Polygoncxx . . $ Polygon# me); |
| 103 | |
| 104 | double Polygon_getAreaOfConvexHullcxx . . $ Polygon_getAreaOfConvexHull(8e940d5358c1a895). (Polygoncxx . . $ Polygon# me); |
| 105 | |
| 106 | #endif /* _Polygon_extensions_h_ */ |