LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 Interval iv; | 256 Interval iv; |
257 for (vsize i = sols.size (); i--;) | 257 for (vsize i = sols.size (); i--;) |
258 { | 258 { |
259 Offset p (curve_point (sols[i])); | 259 Offset p (curve_point (sols[i])); |
260 if (p[ax] >= l && p[ax] <= r) | 260 if (p[ax] >= l && p[ax] <= r) |
261 iv.add_point (p[bx]); | 261 iv.add_point (p[bx]); |
262 } | 262 } |
263 | 263 |
264 // or intersections of the curve with the bounding lines at L and R. | 264 // or intersections of the curve with the bounding lines at L and R. |
265 Interval lr (l, r); | 265 Interval lr (l, r); |
266 Direction dir = LEFT; | 266 for (LEFT_and_RIGHT (dir)) |
267 do | |
268 { | 267 { |
269 vector<Real> v = get_other_coordinates (ax, lr[dir]); | 268 vector<Real> v = get_other_coordinates (ax, lr[dir]); |
270 for (vsize i = v.size (); i--;) | 269 for (vsize i = v.size (); i--;) |
271 iv.add_point (v[i]); | 270 iv.add_point (v[i]); |
272 } | 271 } |
273 while (flip (&dir) != LEFT); | |
274 | 272 |
275 if (iv.is_empty ()) | 273 if (iv.is_empty ()) |
276 { | 274 { |
277 programming_error ("Bezier curve does not cross region of concern"); | 275 programming_error ("Bezier curve does not cross region of concern"); |
278 return 0.0; | 276 return 0.0; |
279 } | 277 } |
280 | 278 |
281 return iv.at (d); | 279 return iv.at (d); |
282 } | 280 } |
283 | 281 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 else | 395 else |
398 subdivide (t_min, &bez1, &bez2); | 396 subdivide (t_min, &bez1, &bez2); |
399 if (t_max == 1.0) | 397 if (t_max == 1.0) |
400 return bez2; | 398 return bez2; |
401 else | 399 else |
402 { | 400 { |
403 bez2.subdivide ((t_max - t_min) / (1 - t_min), &bez3, &bez4); | 401 bez2.subdivide ((t_max - t_min) / (1 - t_min), &bez3, &bez4); |
404 return bez3; | 402 return bez3; |
405 } | 403 } |
406 } | 404 } |
LEFT | RIGHT |