* python/lilylib.py (setup_temp): temporary directories are mode 700.
[lilypond.git] / lily / lookup.cc
blob441d738c485ff6a7a05cdc06dec1b2b74d19565a
1 /*
2 lookup.cc -- implement simple Lookup methods.
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 Jan Nieuwenhuizen <janneke@gnu.org>
10 TODO
11 Glissando
13 #include <math.h>
14 #include <ctype.h>
16 #include "warn.hh"
17 #include "dimensions.hh"
18 #include "bezier.hh"
19 #include "string-convert.hh"
20 #include "file-path.hh"
21 #include "main.hh"
22 #include "lily-guile.hh"
23 #include "molecule.hh"
24 #include "lookup.hh"
25 #include "font-metric.hh"
26 #include "interval.hh"
28 Molecule
29 Lookup::dot (Offset p, Real radius)
31 SCM at = (scm_list_n (ly_symbol2scm ("dot"),
32 gh_double2scm (p[X_AXIS]),
33 gh_double2scm (p[Y_AXIS]),
34 gh_double2scm (radius),
35 SCM_UNDEFINED));
36 Box box;
37 box.add_point (p - Offset (radius, radius));
38 box.add_point (p + Offset (radius, radius));
39 return Molecule (box, at);
42 Molecule
43 Lookup::beam (Real slope, Real width, Real thick)
45 Real height = slope * width;
46 Real min_y = (0 <? height) - thick/2;
47 Real max_y = (0 >? height) + thick/2;
51 Box b (Interval (0, width),
52 Interval (min_y, max_y));
55 SCM at = scm_list_n (ly_symbol2scm ("beam"),
56 gh_double2scm (width),
57 gh_double2scm (slope),
58 gh_double2scm (thick),
59 SCM_UNDEFINED);
60 return Molecule (b, at);
63 Molecule
64 Lookup::dashed_slur (Bezier b, Real thick, Real dash)
66 SCM l = SCM_EOL;
68 for (int i= 4; i -- ;)
70 l = gh_cons (ly_offset2scm (b.control_[i]), l);
73 SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
74 gh_double2scm (thick),
75 gh_double2scm (dash),
76 ly_quote_scm (l),
77 SCM_UNDEFINED));
79 Box box (Interval (0,0),Interval (0,0));
80 return Molecule (box, at);
83 Molecule
84 Lookup::line (Real th, Offset f, Offset t)
86 SCM at = (scm_list_n (ly_symbol2scm ("draw-line"),
87 gh_double2scm (th),
88 gh_double2scm (f[X_AXIS]),
89 gh_double2scm (f[Y_AXIS]),
90 gh_double2scm (t[X_AXIS]),
91 gh_double2scm (t[Y_AXIS]),
92 SCM_UNDEFINED));
94 Box box;
95 box.add_point (f);
96 box.add_point (t);
98 box[X_AXIS].widen (th/2);
99 box[Y_AXIS].widen (th/2);
101 return Molecule (box, at);
105 Molecule
106 Lookup::blank (Box b)
108 return Molecule (b, scm_makfrom0str (""));
111 Molecule
112 Lookup::filledbox (Box b)
114 SCM at = (scm_list_n (ly_symbol2scm ("filledbox"),
115 gh_double2scm (-b[X_AXIS][LEFT]),
116 gh_double2scm (b[X_AXIS][RIGHT]),
117 gh_double2scm (-b[Y_AXIS][DOWN]),
118 gh_double2scm (b[Y_AXIS][UP]),
119 SCM_UNDEFINED));
121 return Molecule (b,at);
125 * round filled box:
127 * __________________________________
128 * / \ ^ / \ ^
129 * | |blot | |
130 * | | |dia | | |
131 * | |meter | |
132 * |\ _ _ / v \ _ _ /| |
133 * | | |
134 * | | | Box
135 * | <------>| | extent
136 * | blot | | (Y_AXIS)
137 * | diameter| |
138 * | | |
139 * | _ _ _ _ | |
140 * |/ \ / \| |
141 * | | |
142 * | | | | |
143 * | | |
144 * x\_____/______________\_____/|_____v
145 * |(0,0) |
146 * | |
147 * | |
148 * |<-------------------------->|
149 * Box extent(X_AXIS)
151 Molecule
152 Lookup::roundfilledbox (Box b, Real blotdiameter)
154 if (b.x ().length () < blotdiameter)
156 programming_error (_f ("round filled box horizontal extent smaller than blot; decreasing blot"));
157 blotdiameter = b.x ().length ();
159 if (b.y ().length () < blotdiameter)
161 programming_error (_f ("round filled box vertical extent smaller than blot; decreasing blot"));
162 blotdiameter = b.y ().length ();
165 SCM at = (scm_list_n (ly_symbol2scm ("roundfilledbox"),
166 gh_double2scm (-b[X_AXIS][LEFT]),
167 gh_double2scm (b[X_AXIS][RIGHT]),
168 gh_double2scm (-b[Y_AXIS][DOWN]),
169 gh_double2scm (b[Y_AXIS][UP]),
170 gh_double2scm (blotdiameter),
171 SCM_UNDEFINED));
173 return Molecule (b,at);
177 * Create Molecule that represents a filled polygon with round edges.
179 * LIMITATIONS:
181 * (a) Only outer (convex) edges are rounded.
183 * (b) This algorithm works as expected only for polygons whose edges
184 * do not intersect. For example, the polygon ((0, 0), (q, 0), (0,
185 * q), (q, q)) has an intersection at point (q/2, q/2) and therefore
186 * will give a strange result. Even non-adjacent edges that just
187 * touch each other will in general not work as expected for non-null
188 * blotdiameter.
190 * (c) Given a polygon ((x0, y0), (x1, y1), ... , (x(n-1), y(n-1))),
191 * if there is a natural number k such that blotdiameter is greater
192 * than the maximum of { | (x(k mod n), y(k mod n)) - (x((k+1) mod n),
193 * y((k+1) mod n)) |, | (x(k mod n), y(k mod n)) - (x((k+2) mod n),
194 * y((k+2) mod n)) |, | (x((k+1) mod n), y((k+1) mod n)) - (x((k+2)
195 * mod n), y((k+2) mod n)) | }, then the outline of the rounded
196 * polygon will exceed the outline of the core polygon. In other
197 * words: Do not draw rounded polygons that have a leg smaller or
198 * thinner than blotdiameter (or set blotdiameter to a sufficiently
199 * small value -- maybe even 0.0)!
201 * NOTE: Limitations (b) and (c) arise from the fact that round edges
202 * are made by moulding sharp edges to round ones rather than adding
203 * to a core filled polygon. For details of these two different
204 * approaches, see the thread upon the ledger lines patch that started
205 * on March 25, 2002 on the devel mailing list. The below version of
206 * round_filled_polygon() sticks to the moulding model, which the
207 * majority of the list participants finally voted for. This,
208 * however, results in the above limitations and a much increased
209 * complexity of the algorithm, since it has to compute a shrinked
210 * polygon -- which is not trivial define precisely and unambigously.
211 * With the other approach, one simply could move a circle of size
212 * blotdiameter along all edges of the polygon (which is what the
213 * postscript routine in the backend effectively does, but on the
214 * shrinked polygon). --jr
216 Molecule
217 Lookup::round_filled_polygon (Array<Offset> points, Real blotdiameter)
219 /* TODO: Maybe print a warning if one of the above limitations
220 applies to the given polygon. However, this is quite complicated
221 to check. */
223 /* remove consecutive duplicate points */
224 const Real epsilon = 0.01;
225 for (int i = 0; i < points.size ();)
227 int next_i = (i + 1) % points.size ();
228 Real d = (points[i] - points[next_i]).length ();
229 if (d < epsilon)
230 points.del (next_i);
231 else
232 i++;
235 /* special cases: degenerated polygons */
236 if (points.size () == 0)
237 return Molecule ();
238 if (points.size () == 1)
239 return dot (points[0], 0.5 * blotdiameter);
240 if (points.size () == 2)
241 return line (blotdiameter, points[0], points[1]);
243 /* shrink polygon in size by 0.5 * blotdiameter */
244 Array<Offset> shrinked_points;
245 shrinked_points.set_size (points.size ());
246 bool ccw = 1; // true, if three adjacent points are counterclockwise ordered
247 for (int i = 0; i < points.size (); i++)
249 int i0 = i;
250 int i1 = (i + 1) % points.size ();
251 int i2 = (i + 2) % points.size ();
252 Offset p0 = points[i0];
253 Offset p1 = points[i1];
254 Offset p2 = points[i2];
255 Offset p10 = p0 - p1;
256 Offset p12 = p2 - p1;
257 if (p10.length () != 0.0)
258 { // recompute ccw
259 Real phi = p10.arg ();
260 // rotate (p2 - p0) by (-phi)
261 Offset q = complex_multiply (p2 - p0, complex_exp (Offset (1.0, -phi)));
263 if (q[Y_AXIS] > 0)
264 ccw = 1;
265 else if (q[Y_AXIS] < 0)
266 ccw = 0;
267 else {} // keep ccw unchanged
269 else {} // keep ccw unchanged
270 Offset p10n = (1.0 / p10.length ()) * p10; // normalize length to 1.0
271 Offset p12n = (1.0 / p12.length ()) * p12;
272 Offset p13n = 0.5 * (p10n + p12n);
273 Offset p14n = 0.5 * (p10n - p12n);
274 Offset p13;
275 Real d = p13n.length () * p14n.length (); // distance p3n to line(p1..p0)
276 if (d < epsilon)
277 // special case: p0, p1, p2 are on a single line => build
278 // vector orthogonal to (p2-p0) of length 0.5 blotdiameter
280 p13[X_AXIS] = p10[Y_AXIS];
281 p13[Y_AXIS] = -p10[X_AXIS];
282 p13 = (0.5 * blotdiameter / p13.length ()) * p13;
284 else
285 p13 = (0.5 * blotdiameter / d) * p13n;
286 shrinked_points[i1] = p1 + ((ccw) ? p13 : -p13);
289 /* build scm expression and bounding box */
290 SCM shrinked_points_scm = SCM_EOL;
291 Box box;
292 for (int i = 0; i < shrinked_points.size (); i++)
294 SCM x = gh_double2scm (shrinked_points[i][X_AXIS]);
295 SCM y = gh_double2scm (shrinked_points[i][Y_AXIS]);
296 shrinked_points_scm = gh_cons (x, gh_cons (y, shrinked_points_scm));
297 box.add_point (points[i]);
299 SCM polygon_scm = scm_list_n (ly_symbol2scm ("polygon"),
300 ly_quote_scm (shrinked_points_scm),
301 gh_double2scm (blotdiameter),
302 SCM_UNDEFINED);
304 Molecule polygon = Molecule (box, polygon_scm);
305 shrinked_points.clear ();
306 return polygon;
309 Molecule
310 Lookup::frame (Box b, Real thick)
312 Molecule m;
313 Direction d = LEFT;
314 for (Axis a = X_AXIS; a < NO_AXES; a = Axis (a + 1))
316 Axis o = Axis ((a+1)%NO_AXES);
319 Box edges;
320 edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1);
321 edges[o][DOWN] = b[o][DOWN] - thick/2;
322 edges[o][UP] = b[o][UP] + thick/2;
324 m.add_molecule (filledbox (edges));
326 while (flip (&d) != LEFT);
328 return m;
333 Make a smooth curve along the points
335 Molecule
336 Lookup::slur (Bezier curve, Real curvethick, Real linethick)
338 Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
339 Bezier back = curve;
340 Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI/2)) * 0.5;
341 back.reverse ();
342 back.control_[1] += perp;
343 back.control_[2] += perp;
345 curve.control_[1] -= perp;
346 curve.control_[2] -= perp;
348 SCM scontrols[8];
350 for (int i=4; i--;)
351 scontrols[ i ] = ly_offset2scm (back.control_[i]);
352 for (int i=4 ; i--;)
353 scontrols[i+4] = ly_offset2scm (curve.control_[i]);
356 Need the weird order b.o. the way PS want its arguments
358 int indices[]= {5, 6, 7, 4, 1, 2, 3, 0};
359 SCM list = SCM_EOL;
360 for (int i= 8; i--;)
362 list = gh_cons (scontrols[indices[i]], list);
366 SCM at = (scm_list_n (ly_symbol2scm ("bezier-bow"),
367 ly_quote_scm (list),
368 gh_double2scm (linethick),
369 SCM_UNDEFINED));
370 Box b(curve.extent (X_AXIS),
371 curve.extent (Y_AXIS));
373 b[X_AXIS].unite (back.extent (X_AXIS));
374 b[Y_AXIS].unite (back.extent (Y_AXIS));
376 return Molecule (b, at);
380 * Bezier Sandwich:
382 * .|
383 * . |
384 * top . |
385 * . curve |
386 * . |
387 * . |
388 * . |
389 * | |
390 * | .|
391 * | .
392 * | bottom .
393 * | . curve
394 * | .
395 * | .
396 * | .
397 * | .
398 * |.
402 Molecule
403 Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
406 Need the weird order b.o. the way PS want its arguments
408 SCM list = SCM_EOL;
409 list = gh_cons (ly_offset2scm (bottom_curve.control_[3]), list);
410 list = gh_cons (ly_offset2scm (bottom_curve.control_[0]), list);
411 list = gh_cons (ly_offset2scm (bottom_curve.control_[1]), list);
412 list = gh_cons (ly_offset2scm (bottom_curve.control_[2]), list);
413 list = gh_cons (ly_offset2scm (top_curve.control_[0]), list);
414 list = gh_cons (ly_offset2scm (top_curve.control_[3]), list);
415 list = gh_cons (ly_offset2scm (top_curve.control_[2]), list);
416 list = gh_cons (ly_offset2scm (top_curve.control_[1]), list);
418 SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"),
419 ly_quote_scm (list),
420 gh_double2scm (0.0),
421 SCM_UNDEFINED);
423 Interval x_extent = top_curve.extent (X_AXIS);
424 x_extent.unite (bottom_curve.extent (X_AXIS));
425 Interval y_extent = top_curve.extent (Y_AXIS);
426 y_extent.unite (bottom_curve.extent (Y_AXIS));
427 Box b (x_extent, y_extent);
429 return Molecule (b, horizontal_bend);
433 * Horizontal Slope:
435 * /| ^
436 * / | |
437 * / | | height
438 * / | |
439 * / | v
440 * | /
441 * | /
442 * (0,0) x /slope=dy/dx
443 * | /
444 * |/
446 * <----->
447 * width
449 Molecule
450 Lookup::horizontal_slope (Real width, Real slope, Real height)
452 SCM width_scm = gh_double2scm (width);
453 SCM slope_scm = gh_double2scm (slope);
454 SCM height_scm = gh_double2scm (height);
455 SCM horizontal_slope = scm_list_n (ly_symbol2scm ("beam"),
456 width_scm, slope_scm,
457 height_scm, SCM_UNDEFINED);
458 Box b (Interval (0, width),
459 Interval (-height/2, height/2 + width*slope));
460 return Molecule (b, horizontal_slope);
464 TODO: junk me.
466 Molecule
467 Lookup::accordion (SCM s, Real staff_space, Font_metric *fm)
469 Molecule m;
470 String sym = ly_scm2string (ly_car (s));
471 String reg = ly_scm2string (ly_car (ly_cdr (s)));
473 if (sym == "Discant")
475 Molecule r = fm->find_by_name ("accordion-accDiscant");
476 m.add_molecule (r);
477 if (reg.left_string (1) == "F")
479 Molecule d = fm->find_by_name ("accordion-accDot");
480 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
481 m.add_molecule (d);
482 reg = reg.right_string (reg.length ()-1);
484 int eflag = 0x00;
485 if (reg.left_string (3) == "EEE")
487 eflag = 0x07;
488 reg = reg.right_string (reg.length ()-3);
490 else if (reg.left_string (2) == "EE")
492 eflag = 0x05;
493 reg = reg.right_string (reg.length ()-2);
495 else if (reg.left_string (2) == "Eh")
497 eflag = 0x04;
498 reg = reg.right_string (reg.length ()-2);
500 else if (reg.left_string (1) == "E")
502 eflag = 0x02;
503 reg = reg.right_string (reg.length ()-1);
505 if (eflag & 0x02)
507 Molecule d = fm->find_by_name ("accordion-accDot");
508 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
509 m.add_molecule (d);
511 if (eflag & 0x04)
513 Molecule d = fm->find_by_name ("accordion-accDot");
514 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
515 d.translate_axis (0.8 * staff_space PT, X_AXIS);
516 m.add_molecule (d);
518 if (eflag & 0x01)
520 Molecule d = fm->find_by_name ("accordion-accDot");
521 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
522 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
523 m.add_molecule (d);
525 if (reg.left_string (2) == "SS")
527 Molecule d = fm->find_by_name ("accordion-accDot");
528 d.translate_axis (0.5 * staff_space PT, Y_AXIS);
529 d.translate_axis (0.4 * staff_space PT, X_AXIS);
530 m.add_molecule (d);
531 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
532 m.add_molecule (d);
533 reg = reg.right_string (reg.length ()-2);
535 if (reg.left_string (1) == "S")
537 Molecule d = fm->find_by_name ("accordion-accDot");
538 d.translate_axis (0.5 * staff_space PT, Y_AXIS);
539 m.add_molecule (d);
540 reg = reg.right_string (reg.length ()-1);
543 else if (sym == "Freebase")
545 Molecule r = fm->find_by_name ("accordion-accFreebase");
546 m.add_molecule (r);
547 if (reg.left_string (1) == "F")
549 Molecule d = fm->find_by_name ("accordion-accDot");
550 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
551 m.add_molecule (d);
552 reg = reg.right_string (reg.length ()-1);
554 if (reg == "E")
556 Molecule d = fm->find_by_name ("accordion-accDot");
557 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
558 m.add_molecule (d);
561 else if (sym == "Bayanbase")
563 Molecule r = fm->find_by_name ("accordion-accBayanbase");
564 m.add_molecule (r);
565 if (reg.left_string (1) == "T")
567 Molecule d = fm->find_by_name ("accordion-accDot");
568 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
569 m.add_molecule (d);
570 reg = reg.right_string (reg.length ()-1);
572 /* include 4' reed just for completeness. You don't want to use this. */
573 if (reg.left_string (1) == "F")
575 Molecule d = fm->find_by_name ("accordion-accDot");
576 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
577 m.add_molecule (d);
578 reg = reg.right_string (reg.length ()-1);
580 if (reg.left_string (2) == "EE")
582 Molecule d = fm->find_by_name ("accordion-accDot");
583 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
584 d.translate_axis (0.4 * staff_space PT, X_AXIS);
585 m.add_molecule (d);
586 d.translate_axis (-0.8 * staff_space PT, X_AXIS);
587 m.add_molecule (d);
588 reg = reg.right_string (reg.length ()-2);
590 if (reg.left_string (1) == "E")
592 Molecule d = fm->find_by_name ("accordion-accDot");
593 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
594 m.add_molecule (d);
595 reg = reg.right_string (reg.length ()-1);
598 else if (sym == "Stdbase")
600 Molecule r = fm->find_by_name ("accordion-accStdbase");
601 m.add_molecule (r);
602 if (reg.left_string (1) == "T")
604 Molecule d = fm->find_by_name ("accordion-accDot");
605 d.translate_axis (staff_space * 3.5 PT, Y_AXIS);
606 m.add_molecule (d);
607 reg = reg.right_string (reg.length ()-1);
609 if (reg.left_string (1) == "F")
611 Molecule d = fm->find_by_name ("accordion-accDot");
612 d.translate_axis (staff_space * 2.5 PT, Y_AXIS);
613 m.add_molecule (d);
614 reg = reg.right_string (reg.length ()-1);
616 if (reg.left_string (1) == "M")
618 Molecule d = fm->find_by_name ("accordion-accDot");
619 d.translate_axis (staff_space * 2 PT, Y_AXIS);
620 d.translate_axis (staff_space PT, X_AXIS);
621 m.add_molecule (d);
622 reg = reg.right_string (reg.length ()-1);
624 if (reg.left_string (1) == "E")
626 Molecule d = fm->find_by_name ("accordion-accDot");
627 d.translate_axis (staff_space * 1.5 PT, Y_AXIS);
628 m.add_molecule (d);
629 reg = reg.right_string (reg.length ()-1);
631 if (reg.left_string (1) == "S")
633 Molecule d = fm->find_by_name ("accordion-accDot");
634 d.translate_axis (staff_space * 0.5 PT, Y_AXIS);
635 m.add_molecule (d);
636 reg = reg.right_string (reg.length ()-1);
639 /* ugh maybe try to use regular font for S.B. and B.B and only use one font
640 for the rectangle */
641 else if (sym == "SB")
643 Molecule r = fm->find_by_name ("accordion-accSB");
644 m.add_molecule (r);
646 else if (sym == "BB")
648 Molecule r = fm->find_by_name ("accordion-accBB");
649 m.add_molecule (r);
651 else if (sym == "OldEE")
653 Molecule r = fm->find_by_name ("accordion-accOldEE");
654 m.add_molecule (r);
656 else if (sym == "OldEES")
658 Molecule r = fm->find_by_name ("accordion-accOldEES");
659 m.add_molecule (r);
661 return m;
664 Molecule
665 Lookup::repeat_slash (Real w, Real s, Real t)
667 SCM wid = gh_double2scm (w);
668 SCM sl = gh_double2scm (s);
669 SCM thick = gh_double2scm (t);
670 SCM slashnodot = scm_list_n (ly_symbol2scm ("repeat-slash"),
671 wid, sl, thick, SCM_UNDEFINED);
673 Box b (Interval (0, w + sqrt (sqr(t/s) + sqr (t))),
674 Interval (0, w * s));
676 return Molecule (b, slashnodot); // http://slashnodot.org
679 Molecule
680 Lookup::bracket (Axis a, Interval iv, Real thick, Real protude)
682 Box b;
683 Axis other = Axis((a+1)%2);
684 b[a] = iv;
685 b[other] = Interval(-1, 1) * thick * 0.5;
687 Molecule m = filledbox (b);
689 b[a] = Interval (iv[UP] - thick, iv[UP]);
690 Interval oi = Interval (-thick/2, thick/2 + fabs (protude)) ;
691 oi *= sign (protude);
692 b[other] = oi;
693 m.add_molecule (filledbox (b));
694 b[a] = Interval (iv[DOWN], iv[DOWN] +thick);
695 m.add_molecule (filledbox(b));
697 return m;
700 Molecule
701 Lookup::triangle (Interval iv, Real thick, Real protude)
703 Box b ;
704 b[X_AXIS] = iv;
705 b[Y_AXIS] = Interval (0 <? protude , 0 >? protude);
707 SCM s = scm_list_n (ly_symbol2scm ("symmetric-x-triangle"),
708 gh_double2scm (thick),
709 gh_double2scm (iv.length()),
710 gh_double2scm (protude), SCM_UNDEFINED);
712 return Molecule (b, s);
717 TODO: use rounded boxes.
719 LY_DEFINE(ly_bracket ,"ly:bracket",
720 4, 0, 0,
721 (SCM a, SCM iv, SCM t, SCM p),
722 "Make a bracket in direction @var{a}. The extent of the bracket is "
723 "given by @var{iv}. The wings protude by an amount of @var{p}, which "
724 "may be negative. The thickness is given by @var{t}.")
726 SCM_ASSERT_TYPE(ly_axis_p (a), a, SCM_ARG1, __FUNCTION__, "axis") ;
727 SCM_ASSERT_TYPE(ly_number_pair_p (iv), iv, SCM_ARG2, __FUNCTION__, "number pair") ;
728 SCM_ASSERT_TYPE(gh_number_p (t), a, SCM_ARG3, __FUNCTION__, "number") ;
729 SCM_ASSERT_TYPE(gh_number_p (p), a, SCM_ARG4, __FUNCTION__, "number") ;
732 return Lookup::bracket ((Axis)gh_scm2int (a), ly_scm2interval (iv),
733 gh_scm2double (t),
734 gh_scm2double (p)).smobbed_copy ();