#include "debug.hh"
#include "lookup.hh"
#include "misc.hh"
+#include "main.hh"
Atom
Lookup::beam_element (int sidx, int widx, Real slope) const
{
String name = String("slope");
- Atom bs=(*symtables_)("beamslopes")->lookup (name);
+ Atom bs=(*symtables_p_)("beamslopes")->lookup (name);
Array<String> args;
args.push (sidx);
Atom
Lookup::rule_symbol (Real height, Real width) const
{
- Atom bs=(*symtables_)("beamslopes")->lookup ("horizontal");
+ Atom bs=(*symtables_p_)("beamslopes")->lookup ("horizontal");
Array<String> args;
args.push (print_dimen (height));
args.push (print_dimen (width));
return bs;
}
+Atom
+Lookup::beam(Real &slope, Real width, Real y_thick) const
+{
+ if (postscript_global_b)
+ {
+ return ps_beam (slope, width, y_thick);
+ }
+ else
+ return tex_beam(slope, width);
+}
+
+Atom
+Lookup::ps_beam (Real slope, Real width, Real y_thickness)const
+{
+ Atom ret;
+ String ps(String (width) + " "+ String(slope)
+ + " " + String(y_thickness) + " draw_beam");
+ ret.tex_ = String("\\embeddedps{" + ps + "}");
+ ret.dim_[X_AXIS] = Interval(0, width);
+ ret.dim_[Y_AXIS] = Interval(0, slope * width + y_thickness);
+ return ret;
+}
+
Atom
-Lookup::beam (Real &slope, Real width) const
+Lookup::tex_beam (Real &slope, Real width) const
{
+ const Real MAX_SLOPE = 0.6;
+ const Real SLOPES = 20.0;
int sidx = 0;
- if (abs (slope) > 1.0)
+ if (abs (slope) > MAX_SLOPE)
{
- WARN << _("beam steeper than 1.0 (") << slope << ")\n";
- slope = sign (slope);
+ WARN << _("beam too steep (") << slope << ")\n";
+ slope = sign (slope) * MAX_SLOPE;
}
- sidx = int (rint (slope * 20.0));
- slope = sidx / 20.0;
+ sidx = int (rint (slope / MAX_SLOPE * SLOPES));
+ slope = MAX_SLOPE * sidx / SLOPES;
- Interval xdims = (*symtables_)("beamslopes")->lookup ("slope").dim_[X_AXIS];
+ Interval xdims = (*symtables_p_)("beamslopes")->lookup ("slope").dim_[X_AXIS];
Real min_wid = xdims[LEFT];
Real max_wid = xdims[RIGHT];
assert(max_wid > 0);