1 #ifndef _ParamCurve_h_ 2 #define _ParamCurve_h_ 3 /* ParamCurve.h 4 * 5 * Copyright (C) 1992-2011,2012,2015,2017 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 /* 22 Parametrized curve (x (t), y (t)): 23 two functions (x and y) of one variable (the parameter t). 24 Sampled parametrized curve (x [i], y [j]): 25 x [i] = x (tx [i]) = x (tx1 + (i - 1) * dtx); 26 y [i] = y (ty [i]) = y (ty1 + (i - 1) * dty); 27 */ 28 29 #include "Sound.h" 30 #include "Graphics.h" 31 32 #include "ParamCurve_def.h" 33 34 void ParamCurve_init (ParamCurve me, Sound x, Sound y); 35 36 autoParamCurve ParamCurve_create (Sound x, Sound y); 37 /* 38 Return value: 39 a newly created ParamCurve object. 40 Failures: 41 Out of memory. 42 Domains do not overlap: 43 x -> xmax <= y -> xmin || x -> xmin >= y -> xmax. 44 Postconditions: 45 (Result's domain is intersection of both domains:) 46 result -> xmin = max (x -> xmin, y -> xmin); 47 result -> xmax = min (x -> xmax, y -> xmax); 48 */ 49 50 void ParamCurve_draw (ParamCurve me, Graphics g, double t1, double t2, double dt, 51 double x1, double x2, double y1, double y2, bool garnish); 52 /* 53 Function: 54 draw the points of the curve between parameter values t1 and t2, 55 in time steps dt starting at t1 and including t2, 56 along the axes [x1, x2] x [y1, y2]. 57 Defaults: 58 t2 <= t1: draw all (overlapping) points. 59 dt <= 0.0: time step is the smaller of my x -> dx and my y -> dx. 60 x2 <= x1: autoscaling along horizontal axis. 61 y2 <= y1: autoscaling along vertical axis. 62 */ 63 64 void ParamCurve_swapXY (ParamCurve me); 65 /* 66 Reflect around y = x. 67 Postconditions: 68 x == old y; 69 y == old x; 70 */ 71 72 /* End of file ParamCurve.h */ 73 #endif 74 75