gwnavgeneration/raster/singlestagepixel.h Source File

singlestagepixel.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
12 
13 
15 
16 
17 namespace Kaim
18 {
19 
20 
21 class SingleStagePixel
22 {
23 public:
24  SingleStagePixel() { Clear(); }
25 
26  SingleStagePixel(KyFloat32 min_, KyFloat32 max_) :
27  m_min(min_), m_max(max_)
28  {}
29 
30  void Clear()
31  {
32  m_min = KyFloat32MAXVAL;
33  m_max = -KyFloat32MAXVAL;
34  }
35 
36  bool IsEmpty() const
37  {
38  return m_min == KyFloat32MAXVAL;
39  }
40 
41  bool IsInside(KyFloat32 value) const
42  {
43  return value >= m_min && value <= m_max;
44  }
45 
46  void AddValue(KyFloat32 value)
47  {
48  if (value < m_min) m_min = value;
49  if (value > m_max) m_max = value;
50  }
51 
52  void AddDownAndUp(KyFloat32 down, KyFloat32 up)
53  {
54  if (down < m_min) m_min = down;
55  if (up > m_max) m_max = up;
56  }
57 
58  void AddUp(KyFloat32 up)
59  {
60  if (up > m_max) m_max = up;
61  }
62 
63  void AddDown(KyFloat32 down)
64  {
65  if (down < m_min) m_min = down;
66  }
67 
68 public:
69  KyFloat32 m_min;
70  KyFloat32 m_max;
71 };
72 
73 
74 }
75 
76 
#define KyFloat32MAXVAL
KyFloat32 max value
Definition: types.h:71
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
float KyFloat32
float
Definition: types.h:32