LEFT | RIGHT |
(no file at all) | |
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) 2006--2012 Joe Neeman <joeneeman@gmail.com> | 4 Copyright (C) 2006--2012 Joe Neeman <joeneeman@gmail.com> |
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 /* their slopes were not equal, so there is an intersection point */ | 202 /* their slopes were not equal, so there is an intersection point */ |
203 Real i = intersection_x (other); | 203 Real i = intersection_x (other); |
204 return (i <= x && slope_ > other.slope_) | 204 return (i <= x && slope_ > other.slope_) |
205 || (i > x && slope_ < other.slope_); | 205 || (i > x && slope_ < other.slope_); |
206 } | 206 } |
207 | 207 |
208 // Remove redundant empty buildings from the skyline. | 208 // Remove redundant empty buildings from the skyline. |
209 // If there are two adjacent empty buildings, they can be | 209 // If there are two adjacent empty buildings, they can be |
210 // turned into one. | 210 // turned into one. |
| 211 // Also remove buildings with no width |
211 void | 212 void |
212 Skyline::normalize () | 213 Skyline::normalize () |
213 { | 214 { |
214 bool last_empty = false; | 215 bool last_empty = false; |
215 list<Building>::iterator i; | 216 list<Building>::iterator i; |
216 for (i = buildings_.begin (); i != buildings_.end (); i++) | 217 for (i = buildings_.begin (); i != buildings_.end (); i++) |
217 { | 218 { |
218 if (last_empty && i->y_intercept_ == -infinity_f) | 219 if (last_empty |
| 220 && (i->y_intercept_ == -infinity_f |
| 221 || i->start_ == i->end_)) |
219 { | 222 { |
220 list<Building>::iterator last = i; | 223 list<Building>::iterator last = i; |
221 last--; | 224 last--; |
222 last->end_ = i->end_; | 225 last->end_ = i->end_; |
223 buildings_.erase (i); | 226 buildings_.erase (i); |
224 i = last; | 227 i = last; |
225 } | 228 } |
226 last_empty = (i->y_intercept_ == -infinity_f); | 229 last_empty = (i->y_intercept_ == -infinity_f); |
227 } | 230 } |
228 | 231 |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 return scm_from_double (Skyline::unsmob (skyline_scm)->max_height_position ())
; | 918 return scm_from_double (Skyline::unsmob (skyline_scm)->max_height_position ())
; |
916 } | 919 } |
917 | 920 |
918 MAKE_SCHEME_CALLBACK (Skyline, get_height, 2) | 921 MAKE_SCHEME_CALLBACK (Skyline, get_height, 2) |
919 SCM | 922 SCM |
920 Skyline::get_height (SCM skyline_scm, SCM x_scm) | 923 Skyline::get_height (SCM skyline_scm, SCM x_scm) |
921 { | 924 { |
922 Real x = robust_scm2double (x_scm, 0.0); | 925 Real x = robust_scm2double (x_scm, 0.0); |
923 return scm_from_double (Skyline::unsmob (skyline_scm)->height (x)); | 926 return scm_from_double (Skyline::unsmob (skyline_scm)->height (x)); |
924 } | 927 } |
LEFT | RIGHT |