gwnavgeneration/boundary/boundaryedge.h Source File

boundaryedge.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 // primary contact: GUAL - secondary contact: NOBODY
10 #ifndef GwNavGen_BoundaryEdge_H
11 #define GwNavGen_BoundaryEdge_H
12 
13 
17 
18 
19 namespace Kaim
20 {
21 
22 class BoundaryVertex;
23 class BoundaryPixel;
24 class BoundaryContour;
25 class BoundarySimplifyPolyline;
26 class BoundarySimplifiedEdge;
27 
28 
29 class BoundaryEdge
30 {
31  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
32 public:
33  void Init(CardinalDir dir, BoundaryEdgeType type, bool isInside, KyUInt32 leftColor, KyUInt32 leftNavTagIdx, KyUInt32 index);
34 
35  void ComputeNextEdge();
36 
37  bool IsInContour() const;
38  bool IsOutside() const;
39  bool HasDiscontinuityVertex() const;
40 
41 public:
42  KyUInt32 m_index;
43 
44  CardinalDir m_orientation;
45  BoundaryEdgeType m_type;
46  BoundaryVertex* m_vertex[2];
47  KyUInt32 m_leftColor;
48  KyUInt32 m_leftConnexIdx;
49  bool m_isOutside;
50  KyUInt32 m_leftPixelFeatureTag;
51  BoundaryEdge* m_pair;
52 
53  // contour related
54  BoundaryContour* m_contour;
55  BoundaryEdge* m_next;
56 
57  // simplifyPolyline related
58  BoundarySimplifyPolyline* m_simplifyPolyline;
59  BoundaryOrder m_simplifyPolylineOrder;
60 
61  // simplifiedEdge related
62  BoundarySimplifiedEdge* m_simplifiedEdge;
63 };
64 
65 
66 KY_INLINE void BoundaryEdge::Init(CardinalDir dir, BoundaryEdgeType type, bool isOutside, KyUInt32 leftColor, KyUInt32 leftNavTagIdx, KyUInt32 index)
67 {
68  m_index = index;
69  m_orientation = dir;
70  m_type = type;
71  m_vertex[0] = KY_NULL;
72  m_vertex[1] = KY_NULL;
73  m_leftColor = leftColor;
74  m_leftConnexIdx = leftNavTagIdx;
75  m_isOutside = isOutside;
76  m_leftPixelFeatureTag = UNDEFINED_NAVRASTER_FEATURE;
77  m_pair = KY_NULL;
78  m_contour = KY_NULL;
79  m_next = KY_NULL;
80  m_simplifyPolyline = KY_NULL;
81  m_simplifyPolylineOrder = BoundaryOrder_Unset;
82  m_simplifiedEdge = KY_NULL;
83 }
84 
85 KY_INLINE bool BoundaryEdge::IsInContour() const { return m_contour != KY_NULL; }
86 KY_INLINE bool BoundaryEdge::IsOutside() const { return m_isOutside; }
87 KY_INLINE bool BoundaryEdge::HasDiscontinuityVertex() const
88 {
89  return (m_vertex[0] != KY_NULL && m_vertex[0]->IsDiscontinuity()) ||
90  (m_vertex[1] != KY_NULL && m_vertex[1]->IsDiscontinuity());
91 }
92 
93 }
94 
95 
96 #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