gwnavgeneration/boundary/boundarypixel.h Source File

boundarypixel.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 // primary contact: GUAL - secondary contact: LASI
9 #ifndef GwNavGen_BoundaryPixel_H
10 #define GwNavGen_BoundaryPixel_H
11 
12 
15 
16 
17 namespace Kaim
18 {
19 
20 class BoundaryEdge;
21 
22 // There is one BoundaryPixel for each NavRasterPixel.
23 class BoundaryPixel
24 {
25  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
26 public:
27  BoundaryPixel();
28 
29  void Init(const NavPixelPos& pos, NavRasterFloorIdx floorIdx, const NavRasterPixel* navRasterPixel, bool isOutside);
30  KyUInt32 GetFeatureMask(CardinalDir dir) const;
31 
32 public:
33  NavPixelPos3d m_navPixelPos3d;
34  const NavRasterPixel* m_navRasterPixel;
35  PixelColor m_floorColor;
36  KyUInt32 m_connexIdx;
37  bool m_isOutside;
38 
39  // +----1=N---+
40  // | | |
41  // 2=W-- ----0=E
42  // | | |
43  // +----3=S---+
44  BoundaryEdge* m_edges[4];
45 };
46 
47 KY_INLINE BoundaryPixel::BoundaryPixel() : m_navRasterPixel(KY_NULL), m_floorColor(PixelColor_Unset), m_connexIdx(KyUInt32MAXVAL), m_isOutside(false)
48 {
49  for(CardinalDir dir = 0; dir < 4; ++dir)
50  m_edges[dir] = KY_NULL;
51 }
52 
53 KY_INLINE void BoundaryPixel::Init(const NavPixelPos& pos, NavRasterFloorIdx floorIdx, const NavRasterPixel* navRasterPixel, bool isOutside)
54 {
55  m_navPixelPos3d.Set(pos.x, pos.y, floorIdx);
56  m_navRasterPixel = navRasterPixel;
57  m_floorColor = navRasterPixel->m_floorColor;
58  m_connexIdx = navRasterPixel->m_connexIdx;
59  m_isOutside = isOutside;
60 }
61 
62 KY_INLINE KyUInt32 BoundaryPixel::GetFeatureMask(CardinalDir dir) const
63 {
64  KY_ASSERT(m_navRasterPixel != KY_NULL);
65  return m_navRasterPixel->GetFeatureMask(dir);
66 }
67 
68 }
69 
70 
71 #endif
#define KY_NULL
Null value.
Definition: types.h:247
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:23
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226