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 
9 
10 
11 // primary contact: GUAL - secondary contact: LASI
12 #ifndef GwNavGen_BoundaryPixel_H
13 #define GwNavGen_BoundaryPixel_H
14 
15 
18 
19 
20 namespace Kaim
21 {
22 
23 class BoundaryEdge;
24 
25 /* There is one BoundaryPixel for each NavRasterPixel. */
26 class BoundaryPixel
27 {
28  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
29 public:
30  BoundaryPixel();
31 
32  void Init(const NavPixelPos& pos, NavRasterFloorIdx floorIdx, const NavRasterPixel* navRasterPixel, bool isOutside);
33  KyUInt32 GetFeatureMask(CardinalDir dir) const;
34 public:
35  NavPixelPos3d m_navPixelPos3d;
36  const NavRasterPixel* m_navRasterPixel;
37  PixelColor m_floorColor;
38  KyUInt32 m_connexIdx;
39  bool m_isOutside;
40 
41  // +----1=N---+
42  // | | |
43  // 2=W-- ----0=E
44  // | | |
45  // +----3=S---+
46  BoundaryEdge* m_edges[4];
47 };
48 
49 KY_INLINE BoundaryPixel::BoundaryPixel() : m_navRasterPixel(KY_NULL), m_floorColor(PixelColor_Unset), m_connexIdx(KyUInt32MAXVAL), m_isOutside(false)
50 {
51  for(CardinalDir dir = 0; dir < 4; ++dir)
52  m_edges[dir] = KY_NULL;
53 }
54 
55 KY_INLINE void BoundaryPixel::Init(const NavPixelPos& pos, NavRasterFloorIdx floorIdx, const NavRasterPixel* navRasterPixel, bool isOutside)
56 {
57  m_navPixelPos3d.Set(pos.x, pos.y, floorIdx);
58  m_navRasterPixel = navRasterPixel;
59  m_floorColor = navRasterPixel->m_floorColor;
60  m_connexIdx = navRasterPixel->m_connexIdx;
61  m_isOutside = isOutside;
62 }
63 
64 KY_INLINE KyUInt32 BoundaryPixel::GetFeatureMask(CardinalDir dir) const
65 {
66  KY_ASSERT(m_navRasterPixel != KY_NULL);
67  return m_navRasterPixel->GetFeatureMask(dir);
68 }
69 
70 }
71 
72 
73 #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