gwnavgeneration/raster/singlestagepixel.h Source File

singlestagepixel.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 
9 
10 
11 // primary contact: GUAL - secondary contact: NOBODY
12 #ifndef GwNavGen_SingleStagePixel_H
13 #define GwNavGen_SingleStagePixel_H
14 
15 
17 
18 
19 namespace Kaim
20 {
21 
22 
23 class SingleStagePixel
24 {
25 public:
26  SingleStagePixel() { Clear(); }
27 
28  SingleStagePixel(KyFloat32 min_, KyFloat32 max_) :
29  m_min(min_), m_max(max_)
30  {}
31 
32  void Clear()
33  {
34  m_min = KyFloat32MAXVAL;
35  m_max = -KyFloat32MAXVAL;
36  }
37 
38  bool IsEmpty() const
39  {
40  return m_min == KyFloat32MAXVAL;
41  }
42 
43  bool IsInside(KyFloat32 value) const
44  {
45  return value >= m_min && value <= m_max;
46  }
47 
48  void AddValue(KyFloat32 value)
49  {
50  if (value < m_min) m_min = value;
51  if (value > m_max) m_max = value;
52  }
53 
54  void AddDownAndUp(KyFloat32 down, KyFloat32 up)
55  {
56  if (down < m_min) m_min = down;
57  if (up > m_max) m_max = up;
58  }
59 
60  void AddUp(KyFloat32 up)
61  {
62  if (up > m_max) m_max = up;
63  }
64 
65  void AddDown(KyFloat32 down)
66  {
67  if (down < m_min) m_min = down;
68  }
69 
70 public:
71  KyFloat32 m_min;
72  KyFloat32 m_max;
73 };
74 
75 
76 }
77 
78 
79 #endif
#define KyFloat32MAXVAL
The maximum value that can be stored in the KyFloat32 variable type.
Definition: types.h:227
Definition: gamekitcrowddispersion.h:20
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43