47 const size_t n = m_children.size();
48 for (
size_t i = 0; i < n; ++i)
50 tgModel *
const pChild = m_children[i];
52 assert(pChild != NULL);
59 for (std::size_t i = 0; i < m_children.size(); i++)
61 m_children[i]->setup(world);
70 for (std::size_t i = 0; i < m_children.size(); i++)
72 m_children[i]->teardown();
77 this->m_markers.clear();
81 assert(m_children.empty());
88 throw std::invalid_argument(
"dt is not positive");
94 const size_t n = m_children.size();
95 for (std::size_t i = 0; i < n; i++)
97 tgModel*
const pChild = m_children[i];
98 assert(pChild != NULL);
112 const size_t n = m_children.size();
113 for (std::size_t i = 0; i < n; i++)
115 tgModel *
const pChild = m_children[i];
116 assert(pChild != NULL);
129 throw std::invalid_argument(
"child is NULL");
131 else if (pChild ==
this)
133 throw std::invalid_argument(
"child is this object");
138 if (std::find(descendants.begin(), descendants.end(), pChild) !=
141 throw std::invalid_argument(
"child is already a descendant");
145 m_children.push_back(pChild);
149 assert(!m_children.empty());
150 assert(std::find(m_children.begin(), m_children.end(), pChild) !=
157 std::ostringstream os;
158 os << prefix <<
"tgModel(" << std::endl;
159 os << prefix << p <<
"Children:" << std::endl;
160 for(std::size_t i = 0; i < m_children.size(); i++) {
161 os << m_children[i]->toString(prefix + p) << std::endl;
163 os << prefix << p <<
"Tags: [" << getTags() <<
"]" << std::endl;
174 std::vector<tgModel*> result;
175 const size_t n = m_children.size();
176 for (std::size_t i = 0; i < n; i++)
178 tgModel*
const pChild = m_children[i];
179 assert(pChild != NULL);
180 result.push_back(pChild);
183 result.insert(result.end(), cd.begin(), cd.end());
188 const std::vector<abstractMarker>& tgModel::getMarkers()
const {
193 m_markers.push_back(a);
196 bool tgModel::invariant()
const
virtual void setup(tgWorld &world)
virtual std::string toString(std::string prefix="") const
void addChild(tgModel *pChild)
virtual void step(double dt)
std::ostream & operator<<(std::ostream &os, const tgModel &obj)
Markers for specific places on a tensegrity.
virtual void onVisit(const tgModelVisitor &r) const
Contains the definition of class tgModel.
virtual void render(const tgRod &rod) const
Contains the definition of interface class tgModelVisitor.
std::vector< tgModel * > getDescendants() const