AGX Dynamics  2.37.3.2
Deformable1DIterator.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXMODEL_DEFORMABLE1DITERATOR_H
18 #define AGXMODEL_DEFORMABLE1DITERATOR_H
19 
21 
22 namespace agxModel
23 {
25  {
26  public:
30 
33  const agxModel::Deformable1DNodeRef* operator-> () const;
34 
37 
38  agxModel::Deformable1DIterator& operator++ ();
39  agxModel::Deformable1DIterator& operator-- ();
40  agxModel::Deformable1DIterator operator++ ( int );
41  agxModel::Deformable1DIterator operator-- ( int );
42 
46  agx::Bool isBegin() const;
47 
51  agx::Bool isEnd() const;
52 
56  agx::Bool equal( const agxModel::Deformable1DIterator& other ) const;
57 
63 
69 
73  agxModel::Deformable1DIterator next() const;
74 
78  agxModel::Deformable1DIterator prev() const;
79 
83  agxModel::Deformable1DNode* get() const;
84 
88  const agxModel::Segment* getSegment() const;
89 
90  private:
91  Deformable1DNodeRef m_node;
92  };
93 
95  {
96  m_node = other.m_node;
97  return *this;
98  }
99 
101  {
102  return m_node;
103  }
104 
106  {
107  return &m_node;
108  }
109 
111  {
112  return m_node == other.m_node;
113  }
114 
116  {
117  return !( *this == other );
118  }
119 
121  {
122  return inc();
123  }
124 
126  {
127  return dec();
128  }
129 
131  {
132  Deformable1DIterator ret = *this;
133  ++(*this);
134  return ret;
135  }
136 
138  {
139  Deformable1DIterator ret = *this;
140  --(*this);
141  return ret;
142  }
143 
145  {
146  return m_node == nullptr;
147  }
148 
150  {
151  return *this == other;
152  }
153 
155  {
156  if ( m_node == nullptr )
157  return *this;
158 
159  m_node = m_node->getNumBranches() > 0 ? static_cast< Deformable1DNode* >(m_node->getBranch(0)) : nullptr;
160 
161  return *this;
162  }
163 
165  {
166  if ( m_node == nullptr )
167  return *this;
168 
169  m_node = static_cast< Deformable1DNode* >(m_node->getParent());
170 
171  return *this;
172  }
173 
175  {
176  return Deformable1DIterator(m_node != nullptr && m_node->getNumBranches() > 0 ? static_cast< Deformable1DNode* >(m_node->getBranch(0)) : nullptr);
177  }
178 
180  {
181  return Deformable1DIterator(m_node != nullptr ? static_cast< Deformable1DNode* >(m_node->getParent()) : nullptr);
182  }
183 
185  {
186  return m_node;
187  }
188 
190  {
191  return m_node != nullptr ? m_node->getSegment() : nullptr;
192  }
193 }
194 
195 #endif // AGXMODEL_DEFORMABLE1DITERATOR_H
agx::Bool operator!=(const agxModel::Deformable1DIterator &other) const
bool Bool
Definition: Integer.h:48
agxModel::Deformable1DIterator next() const
agxModel::Deformable1DNode * get() const
bool operator==(T val, InvalidIndexStruct)
Definition: agx.h:194
const agxModel::Deformable1DNodeRef & operator*() const
agx::Bool equal(const agxModel::Deformable1DIterator &other) const
Same as == to be used with exports to languages with not complete support for operator overloading...
agx::Bool operator==(const agxModel::Deformable1DIterator &other) const
agxModel::Deformable1DIterator & operator++()
agxModel::Deformable1DIterator & inc()
Increment this by one.
agxModel::Deformable1DIterator prev() const
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
const agxModel::Deformable1DNodeRef * operator->() const
agxModel::Deformable1DIterator & dec()
Decrement this by one.
A Deformable1D segment is the segment between two nodes, or if this is the last segment, only one node but still has a start- and an end position defined.
const agxModel::Segment * getSegment() const
agxModel::Deformable1DIterator & operator=(const agxModel::Deformable1DIterator &other)
agxModel::Deformable1DIterator & operator--()
bool operator!=(T val, InvalidIndexStruct)
Definition: agx.h:200
#define AGXMODEL_EXPORT
Vec3T< T > operator*(const Vec3T< T > &v, const AffineMatrix4x4T< T > &m)
Special node implementation of segments in e.g., a Deformable1D object.