20 #ifndef TF_PGPLOTSTRUCTS_H_VERSION 22 #define TF_PGPLOTSTRUCTS_H_VERSION \ 23 "TF_PGPLOTSTRUCTS_H V1.0 (17-03-2015)" 46 Trange(
const float& themin,
const float& themax):
47 min(themin),
max(themax) { }
61 float d=f*this->
abs();
83 return(amax > amin ? amax : amin);
88 return(absrange > 0 ? absrange : -absrange);
100 {
min+=value;
return(*
this); }
103 {
max-=value;
return(*
this); }
107 {
min*=value;
max*=value;
return(*
this); }
120 bool contains(
const float& v)
const {
return((v>=this->min) &&
134 Trect(
const float& xmin,
const float& xmax,
135 const float& ymin,
const float& ymax):
139 x(rect.
x),
y(rect.
y) { }
146 {
x.
lcutf(fraction);
return(*
this); }
149 {
x.
hcutf(fraction);
return(*
this); }
152 {
y.
hcutf(fraction);
return(*
this); }
155 {
y.
lcutf(fraction);
return(*
this); }
158 {
x.
lcut(fraction);
return(*
this); }
161 {
x.
hcut(fraction);
return(*
this); }
164 {
y.
hcut(fraction);
return(*
this); }
167 {
y.
lcut(fraction);
return(*
this); }
179 {
x*=rect.
x;
y*=rect.
y;
return(*
this); }
191 { this->x+=c.
x; this->y+=c.
y;
return(*
this); }
194 {
Tcoor r=(*this);
return(r += c); }
209 Tbbox(
const float x[4],
const float y[4]);
222 union {
float r,
h; };
224 union {
float g,
l; };
226 union {
float b,
s; };
233 #endif // TF_PGPLOTSTRUCTS_H_VERSION (includeguard) Trange & lcutf(const float &fraction)
fractional cut at lower edge
Tcoor operator+(const Tcoor &c)
shift coordinate by a vector c
Trect & operator*=(const Trect &rect)
scale relative to other rect (for viewport calculations)
Trange & swap()
swap range
Trange & hcutf(const float &fraction)
fractional cut at higher edge
Trect(const Trange &thex, const Trange &they)
set constructor
Trange(const Trange &range)
copy constgructor
Trect & lcut(const float &fraction)
absolute cut at left edge
contains all pgplot stuff
hold bounding box for text etc.
float absmax() const
return absolute maximum
Trange()
default constructor
Trect(const Trect &rect)
copy constructor
Trect & shift(const Trange &off)
shift rectangle - uses off.min=dx and off.max=dy
Trect & rcutf(const float &fraction)
fractional cut at right edge
Tcoor & operator+=(const Tcoor &c)
Trange & shrink(const Trange &range)
shrink this range if argument range is smaller
Trange & operator*=(const Trange &range)
scale relative to other range
Trange(const float &themin, const float &themax)
set constgructor
Trange & extendf(const float &f)
extend at both ends by a fraction of total range
Trange x
coordinate ranges
Trect & lcutf(const float &fraction)
fractional cut at left edge
Trange & extend(const Trange &range)
extend this range if argument range is larger
Trect & tcut(const float &fraction)
absolute cut at top edge
float fullrange() const
return absolute range
bool inside(const Trect &r) const
return true if coordinate is inside rect r
bool contains(const float &v) const
check if value is inside range
float y
y-coordinate shift coordinate by a vector c
Trect()
default constructor
Tcoor coor[4]
coordinates of four corners default constructor
Trange & hcut(const float &value)
absolute cut at higher edge
float abs() const
return total range
Trect & bcutf(const float &fraction)
fractional cut at bottom edge
float min
range [min....max]
Trect(const float &xmin, const float &xmax, const float &ymin, const float &ymax)
set constructor
a struct to hold colour triples i.e. rgb or hls values
Tbbox()
default constructor
Trect & rcut(const float &fraction)
absolute cut at right edge
Trange & lcut(const float &value)
absolute cut at lower edge
Trect & tcutf(const float &fraction)
fractional cut at top edge
Trect & shrinkf(const Trect &rect)
fractional shrink/expand
Trect & shift(const float &dx, const float &dy)
shift rectangle by dx and dy
Trect & bcut(const float &fraction)
absolute cut at bottom edge
Trange & operator*=(const T &value)
scale both values
Trange & shrinkf(const Trange &range)
fractional shrink/extend