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) 2012--2020 Mike Solomon <mike@mikesolomon.org> | 4 Copyright (C) 2012--2020 Mike Solomon <mike@mikesolomon.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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 buildings.push_back (Drul_array<Offset> (inter_l, inter_r)); | 182 buildings.push_back (Drul_array<Offset> (inter_l, inter_r)); |
183 else | 183 else |
184 { | 184 { |
185 Real length = (inter_l - inter_r).length (); | 185 Real length = (inter_l - inter_r).length (); |
186 | 186 |
187 vsize passes = (vsize) ((length * 2) + 1); | 187 vsize passes = (vsize) ((length * 2) + 1); |
188 vector<Offset> points; | 188 vector<Offset> points; |
189 | 189 |
190 for (vsize i = 0; i < 1 + passes; i++) | 190 for (vsize i = 0; i < 1 + passes; i++) |
191 { | 191 { |
192 Offset pt (linear_map (x0, x1, 0, Real (passes), Real (i)), | 192 Offset pt (linear_map (x0, x1, 0, static_cast<Real> (passes), |
193 linear_map (y0, y1, 0, Real (passes), Real (i))); | 193 static_cast<Real> (i)), |
| 194 linear_map (y0, y1, 0, static_cast<Real> (passes), |
| 195 static_cast<Real> (i))); |
194 Offset inter = scm_transform (trans, pt + outward); | 196 Offset inter = scm_transform (trans, pt + outward); |
195 points.push_back (inter); | 197 points.push_back (inter); |
196 } | 198 } |
197 for (vsize i = 0; i < points.size () - 1; i++) | 199 for (vsize i = 0; i < points.size () - 1; i++) |
198 { | 200 { |
199 Box b; | 201 Box b; |
200 b.add_point (points[i]); | 202 b.add_point (points[i]); |
201 b.add_point (points[i + 1]); | 203 b.add_point (points[i + 1]); |
202 boxes.push_back (b); | 204 boxes.push_back (b); |
203 } | 205 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 Real x_scale = sqrt(sqr(t.get_xx ()) + sqr(t.get_yx ())); | 254 Real x_scale = sqrt(sqr(t.get_xx ()) + sqr(t.get_yx ())); |
253 Real y_scale = sqrt(sqr(t.get_xy ()) + sqr(t.get_yy ())); | 255 Real y_scale = sqrt(sqr(t.get_xy ()) + sqr(t.get_yy ())); |
254 ////////////////////// | 256 ////////////////////// |
255 Drul_array<vector<Offset> > points; | 257 Drul_array<vector<Offset> > points; |
256 int quantization = std::max (1, (int) (((x_rad * x_scale) + (y_rad * y_scale)) | 258 int quantization = std::max (1, (int) (((x_rad * x_scale) + (y_rad * y_scale)) |
257 * M_PI / QUANTIZATION_UNIT)); | 259 * M_PI / QUANTIZATION_UNIT)); |
258 for (DOWN_and_UP (d)) | 260 for (DOWN_and_UP (d)) |
259 { | 261 { |
260 for (vsize i = 0; i <= (vsize) quantization; i++) | 262 for (vsize i = 0; i <= (vsize) quantization; i++) |
261 { | 263 { |
262 Real ang = linear_map (start, end, 0, quantization, Real (i)); | 264 Real ang |
| 265 = linear_map (start, end, 0, quantization, static_cast<Real> (i)); |
263 Offset pt (offset_directed (ang).scale (rad)); | 266 Offset pt (offset_directed (ang).scale (rad)); |
264 Offset inter = t (pt + d * get_normal ((th/2) * pt.direction ())); | 267 Offset inter = t (pt + d * get_normal ((th/2) * pt.direction ())); |
265 points[d].push_back (inter); | 268 points[d].push_back (inter); |
266 } | 269 } |
267 } | 270 } |
268 | 271 |
269 for (vsize i = 0; i < points[DOWN].size () - 1; i++) | 272 for (vsize i = 0; i < points[DOWN].size () - 1; i++) |
270 { | 273 { |
271 Box b; | 274 Box b; |
272 for (DOWN_and_UP (d)) | 275 for (DOWN_and_UP (d)) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 390 |
388 cx[LEFT] = -left + radius; | 391 cx[LEFT] = -left + radius; |
389 cx[RIGHT] = right - radius; | 392 cx[RIGHT] = right - radius; |
390 cy[DOWN] = -bottom + radius; | 393 cy[DOWN] = -bottom + radius; |
391 cy[UP] = top - radius; | 394 cy[UP] = top - radius; |
392 | 395 |
393 for (vsize i = 0; i <= (vsize) quantization; i++) | 396 for (vsize i = 0; i <= (vsize) quantization; i++) |
394 for (DOWN_and_UP(v)) | 397 for (DOWN_and_UP(v)) |
395 for (LEFT_and_RIGHT(h)) | 398 for (LEFT_and_RIGHT(h)) |
396 { | 399 { |
397 Real ang = linear_map (0., 90., 0, quantization, Real (i)); | 400 Real ang = linear_map (0., 90., 0, quantization, |
| 401 static_cast<Real> (i)); |
398 Offset pt (offset_directed (ang).scale (rad)); | 402 Offset pt (offset_directed (ang).scale (rad)); |
399 Offset inter (cx[h] + h * pt[X_AXIS], | 403 Offset inter (cx[h] + h * pt[X_AXIS], |
400 cy[v] + v * pt[Y_AXIS]); | 404 cy[v] + v * pt[Y_AXIS]); |
401 points.push_back (t (inter)); | 405 points.push_back (t (inter)); |
402 } | 406 } |
403 | 407 |
404 for (vsize i = 0; i < points.size () - 4; i++) | 408 for (vsize i = 0; i < points.size () - 4; i++) |
405 { | 409 { |
406 Box b; | 410 Box b; |
407 b.add_point (points[i]); | 411 b.add_point (points[i]); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 + (temp2 - temp1).length () | 475 + (temp2 - temp1).length () |
472 + (temp3 - temp2).length ()) | 476 + (temp3 - temp2).length ()) |
473 / QUANTIZATION_UNIT); | 477 / QUANTIZATION_UNIT); |
474 for (DOWN_and_UP (d)) | 478 for (DOWN_and_UP (d)) |
475 { | 479 { |
476 Offset first = curve.control_[0] | 480 Offset first = curve.control_[0] |
477 + d * get_normal ((th / 2) * curve.dir_at_point (0.0)); | 481 + d * get_normal ((th / 2) * curve.dir_at_point (0.0)); |
478 points[d].push_back (scm_transform (trans, first)); | 482 points[d].push_back (scm_transform (trans, first)); |
479 for (vsize i = 1; i < (vsize) quantization; i++) | 483 for (vsize i = 1; i < (vsize) quantization; i++) |
480 { | 484 { |
481 Real pt = Real (i) / quantization; | 485 Real pt = static_cast<Real> (i) / quantization; |
482 Offset inter = curve.curve_point (pt) | 486 Offset inter = curve.curve_point (pt) |
483 + d * get_normal ((th / 2) *curve.dir_at_point (pt)); | 487 + d * get_normal ((th / 2) *curve.dir_at_point (pt)); |
484 points[d].push_back (scm_transform (trans, inter)); | 488 points[d].push_back (scm_transform (trans, inter)); |
485 } | 489 } |
486 Offset last = curve.control_[3] | 490 Offset last = curve.control_[3] |
487 + d * get_normal ((th / 2) * curve.dir_at_point (1.0)); | 491 + d * get_normal ((th / 2) * curve.dir_at_point (1.0)); |
488 points[d].push_back (scm_transform (trans, last)); | 492 points[d].push_back (scm_transform (trans, last)); |
489 } | 493 } |
490 | 494 |
491 for (vsize i = 0; i < points[DOWN].size () - 1; i++) | 495 for (vsize i = 0; i < points[DOWN].size () - 1; i++) |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 | 1209 |
1206 MAKE_SCHEME_CALLBACK (Grob, pure_horizontal_skylines_from_element_stencils, 3); | 1210 MAKE_SCHEME_CALLBACK (Grob, pure_horizontal_skylines_from_element_stencils, 3); |
1207 SCM | 1211 SCM |
1208 Grob::pure_horizontal_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM
end_scm) | 1212 Grob::pure_horizontal_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM
end_scm) |
1209 { | 1213 { |
1210 Grob *me = unsmob<Grob> (smob); | 1214 Grob *me = unsmob<Grob> (smob); |
1211 int beg = robust_scm2int (beg_scm, 0); | 1215 int beg = robust_scm2int (beg_scm, 0); |
1212 int end = robust_scm2int (end_scm, 0); | 1216 int end = robust_scm2int (end_scm, 0); |
1213 return internal_skylines_from_element_stencils (me, Y_AXIS, true, beg, end); | 1217 return internal_skylines_from_element_stencils (me, Y_AXIS, true, beg, end); |
1214 } | 1218 } |
LEFT | RIGHT |