Initial snark14m import
[snark14.git] / src / snark / art_clip.cpp
1 /*
2  ***********************************************************
3  $SNARK_Header: S N A R K  1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4  $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/art_clip.cpp $
5  $LastChangedRevision: 85 $
6  $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7  $Author: agulati $
8  ***********************************************************
9
10  GET CONSTRAINED VALUES BY ART2 WAY
11  */
12
13 #include <cstdio>
14
15 #include "blkdta.h"
16 #include "modefl.h"
17
18 #include "art.h"
19
20 REAL art_class::clip(REAL temp, REAL thrlo, REAL thrup, REAL relax)
21 {
22         if (!((temp >= thrlo) && (temp <= thrup)))
23         {
24                 if (Modefl.lofl || Modefl.upfl)
25                 {
26
27                         if (Modefl.lofl && (temp < thrlo))
28                         {
29                                 temp += relax * (Modefl.lower - temp);
30                         }
31
32                         if (Modefl.upfl && (temp > thrup))
33                         {
34                                 temp += relax * (Modefl.upper - temp);
35                         }
36                 }
37         }
38         return temp;
39 }