| 1 |
#ifndef _Polygon_h_ |
| 2 |
#define _Polygon_h_ |
| 3 |
/* Polygon.h |
| 4 |
* |
| 5 |
* Copyright (C) 1992-2005,2007-2009,2011,2015-2017,2019 Paul Boersma |
| 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. |
| 15 |
* See the GNU 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 |
#include "Data.h" |
| 22 |
#include "Graphics.h" |
| 23 |
|
| 24 |
#include "Polygon_def.h" |
| 25 |
|
| 26 |
autoPolygon Polygon_create (integer numberOfPoints); |
| 27 |
/* |
| 28 |
Function: |
| 29 |
create a new instance of Polygon. |
| 30 |
Return value: |
| 31 |
the newly created object. |
| 32 |
Precondition: |
| 33 |
numberOfPoints >= 1; |
| 34 |
Failure: |
| 35 |
Out of memory. |
| 36 |
Postconditions: |
| 37 |
result -> numberOfPoints == numberOfPoints; |
| 38 |
result -> x [1..numberOfPoints] == 0.0; |
| 39 |
result -> y [1..numberOfPoints] == 0.0; |
| 40 |
*/ |
| 41 |
|
| 42 |
void Polygon_randomize (Polygon me); /* Randomize the order of the points. */ |
| 43 |
|
| 44 |
double Polygon_perimeter (Polygon me); /* Return the length of the closed path through all points. */ |
| 45 |
|
| 46 |
void Polygon_salesperson (Polygon me, integer numberOfIterations); |
| 47 |
/* |
| 48 |
Function: |
| 49 |
change the order of the points in such a way that it defines the shortest closed path. |
| 50 |
Preconditions: |
| 51 |
!! me; |
| 52 |
numberOfIterations >= 1; |
| 53 |
Postconditions: |
| 54 |
my numberOfPoints == my old numberOfPoints; |
| 55 |
Polygon_perimeter (me) <= old Polygon_perimeter (me); |
| 56 |
*/ |
| 57 |
|
| 58 |
/*** Drawing routines. ***/ |
| 59 |
|
| 60 |
void Polygon_draw (Polygon me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 61 |
void Polygon_draw_inside (Polygon me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 62 |
void Polygon_drawClosed (Polygon me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 63 |
|
| 64 |
void Polygon_paint (Polygon me, Graphics g, MelderColour colour, double xmin, double xmax, double ymin, double ymax); |
| 65 |
void Polygon_paint_inside (Polygon me, Graphics g, MelderColour colour, double xmin, double xmax, double ymin, double ymax); |
| 66 |
|
| 67 |
void Polygon_drawCircles (Polygon me, Graphics g, |
| 68 |
double xmin, double xmax, double ymin, double ymax, double diameter_mm); |
| 69 |
|
| 70 |
void Polygon_paintCircles (Polygon me, Graphics g, |
| 71 |
double xmin, double xmax, double ymin, double ymax, double diameter_mm); |
| 72 |
|
| 73 |
void Polygons_drawConnection (Polygon me, Polygon thee, Graphics g, |
| 74 |
double xmin, double xmax, double ymin, double ymax, int hasArrow, double relativeLength); |
| 75 |
|
| 76 |
/* End of file Polygon.h */ |
| 77 |
#endif |