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++) {
114 tgModel *
const pChild = m_children[i];
115 assert(pChild != NULL);
127 throw std::invalid_argument(
"child is NULL");
129 else if (pChild ==
this)
131 throw std::invalid_argument(
"child is this object");
136 if (std::find(descendants.begin(), descendants.end(), pChild) !=
139 throw std::invalid_argument(
"child is already a descendant");
143 m_children.push_back(pChild);
147 assert(!m_children.empty());
148 assert(std::find(m_children.begin(), m_children.end(), pChild) !=
155 std::ostringstream os;
156 os << prefix <<
"tgModel(" << std::endl;
157 os << prefix << p <<
"Children:" << std::endl;
158 for(std::size_t i = 0; i < m_children.size(); i++) {
159 os << m_children[i]->toString(prefix + p) << std::endl;
161 os << prefix << p <<
"Tags: [" << getTags() <<
"]" << std::endl;
172 std::vector<tgModel*> result;
173 const size_t n = m_children.size();
174 for (std::size_t i = 0; i < n; i++)
176 tgModel*
const pChild = m_children[i];
177 assert(pChild != NULL);
178 result.push_back(pChild);
181 result.insert(result.end(), cd.begin(), cd.end());
196 std::vector<tgSenseable*> mySenseableDescendants;
197 for (
size_t i=0; i < myDescendants.size(); i++) {
198 mySenseableDescendants.push_back(myDescendants[i]);
200 return mySenseableDescendants;
203 const std::vector<abstractMarker>& tgModel::getMarkers()
const {
208 m_markers.push_back(a);
211 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.
virtual std::vector< tgSenseable * > getSenseableDescendants() const
std::vector< tgModel * > getDescendants() const