Clip Piecewise-Linear (PWL) Functions¶
Defines
-
DEBUG_CLIP
¶
Functions
-
template <int step, bool need_check = false, typename float_ = double>
float_clip
(Event *elem, Range &pq, float_ slope, float_ offset)¶ Cut all knots until the PWL is at least zero.
Hereby, start with initial
slope
andoffset
. To achieve a value oft
, subtract it fromoffset
.If
step
is positive, go frompq.start
tillpq.stop
(inclusive); otherwise go the other direction, i.e. frompq.stop
down topq.start
(inclusive).If
need_check
is set, ensure that in the endstd::abs(slope) > EPS
; ifslope
is too close to zero (i.e.EPS
) the division byslope
might result in strange behavior. That is why a newEvent
is only added ifstd::abs(slope) > EPS
.
-
template <int step, bool need_check = false, typename float_ = double>
float_clip
(std::vector<Event> &elem, Range &pq, float_ slope, float_ offset)¶
Variables
-
const double
EPS
= 1e-10¶ Minimal slope after which the PWL is treated as having zero slope.
-
const bool
DEBUG
= false¶ Printout debugging information?