KiCad PCB EDA Suite
hed::DART Class Reference

#include <hedart.h>

Public Member Functions

 DART ()
 Default constructor. More...
 
 DART (const EDGE_PTR &aEdge, bool aDir=true)
 Constructor. More...
 
 DART (const DART &aDart)
 Copy constructor. More...
 
 ~DART ()
 Destructor. More...
 
DARToperator= (const DART &aDart)
 Assignment operator. More...
 
bool operator== (const DART &aDart) const
 Comparing dart objects. More...
 
bool operator!= (const DART &aDart) const
 Comparing dart objects. More...
 
DARTAlpha0 ()
 Maps the dart to a different node. More...
 
DARTAlpha1 ()
 Maps the dart to a different edge. More...
 
DARTAlpha2 ()
 Maps the dart to a different triangle. Note: the dart is not changed if it is at the boundary! More...
 
Utilities not required by TTL
void Init (const EDGE_PTR &aEdge, bool aDir=true)
 
double X () const
 
double Y () const
 
bool IsCCW () const
 
const NODE_PTRGetNode () const
 
const NODE_PTRGetOppositeNode () const
 
EDGE_PTRGetEdge ()
 

Private Attributes

EDGE_PTR m_edge
 
bool m_dir
 Dart direction: true if dart is counterclockwise in face. More...
 

Detailed Description

Definition at line 54 of file hedart.h.

Constructor & Destructor Documentation

◆ DART() [1/3]

hed::DART::DART ( )
inline

Default constructor.

Definition at line 63 of file hedart.h.

64  {
65  m_dir = true;
66  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59

References m_dir.

◆ DART() [2/3]

hed::DART::DART ( const EDGE_PTR aEdge,
bool  aDir = true 
)
inline

Constructor.

Definition at line 69 of file hedart.h.

70  {
71  m_edge = aEdge;
72  assert ( m_edge );
73  m_dir = aDir;
74  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ DART() [3/3]

hed::DART::DART ( const DART aDart)
inline

Copy constructor.

Definition at line 77 of file hedart.h.

78  {
79  m_edge = aDart.m_edge;
80  assert ( m_edge );
81  m_dir = aDart.m_dir;
82  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ ~DART()

hed::DART::~DART ( )
inline

Destructor.

Definition at line 85 of file hedart.h.

86  {
87  }

Member Function Documentation

◆ Alpha0()

DART& hed::DART::Alpha0 ( )
inline

Maps the dart to a different node.

Definition at line 115 of file hedart.h.

116  {
117  m_dir = !m_dir;
118  return *this;
119  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59

References m_dir.

Referenced by hed::TTLtraits::CrossProduct2D(), and hed::TTLtraits::ScalarProduct2D().

◆ Alpha1()

DART& hed::DART::Alpha1 ( )
inline

Maps the dart to a different edge.

Definition at line 122 of file hedart.h.

123  {
124  if( m_dir )
125  {
126  m_edge = m_edge->GetNextEdgeInFace()->GetNextEdgeInFace();
127  assert ( m_edge );
128  m_dir = false;
129  }
130  else
131  {
132  m_edge = m_edge->GetNextEdgeInFace();
133  assert ( m_edge );
134  m_dir = true;
135  }
136 
137  return *this;
138  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ Alpha2()

DART& hed::DART::Alpha2 ( )
inline

Maps the dart to a different triangle. Note: the dart is not changed if it is at the boundary!

Definition at line 141 of file hedart.h.

142  {
143  if( m_edge->GetTwinEdge() )
144  {
145  m_edge = m_edge->GetTwinEdge();
146  assert ( m_edge );
147  m_dir = !m_dir;
148  }
149 
150  // else, the dart is at the boundary and should not be changed
151  return *this;
152  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ GetEdge()

EDGE_PTR& hed::DART::GetEdge ( )
inline

◆ GetNode()

const NODE_PTR& hed::DART::GetNode ( ) const
inline

Definition at line 178 of file hedart.h.

179  {
180  return m_dir ? m_edge->GetSourceNode() : m_edge->GetTargetNode();
181  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

Referenced by X(), and Y().

◆ GetOppositeNode()

const NODE_PTR& hed::DART::GetOppositeNode ( ) const
inline

Definition at line 183 of file hedart.h.

184  {
185  return m_dir ? m_edge->GetTargetNode() : m_edge->GetSourceNode();
186  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ Init()

void hed::DART::Init ( const EDGE_PTR aEdge,
bool  aDir = true 
)
inline

Definition at line 156 of file hedart.h.

157  {
158  m_edge = aEdge;
159  assert(m_edge);
160  m_dir = aDir;
161  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

Referenced by hed::TRIANGULATION::splitTriangle().

◆ IsCCW()

bool hed::DART::IsCCW ( ) const
inline

Definition at line 173 of file hedart.h.

174  {
175  return m_dir;
176  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59

References m_dir.

◆ operator!=()

bool hed::DART::operator!= ( const DART aDart) const
inline

Comparing dart objects.

Definition at line 109 of file hedart.h.

110  {
111  return !( aDart == *this );
112  }

◆ operator=()

DART& hed::DART::operator= ( const DART aDart)
inline

Assignment operator.

Definition at line 90 of file hedart.h.

91  {
92  if( this == &aDart )
93  return *this;
94 
95  m_edge = aDart.m_edge;
96  assert ( m_edge );
97  m_dir = aDart.m_dir;
98 
99  return *this;
100  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ operator==()

bool hed::DART::operator== ( const DART aDart) const
inline

Comparing dart objects.

Definition at line 103 of file hedart.h.

104  {
105  return ( aDart.m_edge == m_edge && aDart.m_dir == m_dir );
106  }
bool m_dir
Dart direction: true if dart is counterclockwise in face.
Definition: hedart.h:59
EDGE_PTR m_edge
Definition: hedart.h:56

References m_dir, and m_edge.

◆ X()

double hed::DART::X ( ) const
inline

Definition at line 163 of file hedart.h.

164  {
165  return GetNode()->GetX();
166  }
const NODE_PTR & GetNode() const
Definition: hedart.h:178

References GetNode().

Referenced by hed::TTLtraits::CrossProduct2D(), hed::TTLtraits::Orient2D(), and hed::TTLtraits::ScalarProduct2D().

◆ Y()

double hed::DART::Y ( ) const
inline

Definition at line 168 of file hedart.h.

169  {
170  return GetNode()->GetY();
171  }
const NODE_PTR & GetNode() const
Definition: hedart.h:178

References GetNode().

Referenced by hed::TTLtraits::CrossProduct2D(), hed::TTLtraits::Orient2D(), and hed::TTLtraits::ScalarProduct2D().

Member Data Documentation

◆ m_dir

bool hed::DART::m_dir
private

Dart direction: true if dart is counterclockwise in face.

Definition at line 59 of file hedart.h.

Referenced by Alpha0(), Alpha1(), Alpha2(), DART(), GetNode(), GetOppositeNode(), Init(), IsCCW(), operator=(), and operator==().

◆ m_edge

EDGE_PTR hed::DART::m_edge
private

Definition at line 56 of file hedart.h.

Referenced by Alpha1(), Alpha2(), DART(), GetEdge(), GetNode(), GetOppositeNode(), Init(), operator=(), and operator==().


The documentation for this class was generated from the following file: