36 #include "LinearMath/btVector3.h"
42 tgBlockField::Config::Config(btVector3 origin,
53 m_restitution(restitution),
57 m_length(blockLength),
61 assert(m_friction >= 0.0);
62 assert(m_restitution >= 0.0);
63 assert(m_nBlocks >= 0.0);
64 assert(m_length >= 0.0);
65 assert(m_width >= 0.0);
66 assert(m_height >= 0.0);
75 tgUtil::seedRandom(1);
84 tgUtil::seedRandom(1);
99 spec.addBuilder(
"box",
new tgBoxInfo(boxConfig));
114 throw std::invalid_argument(
"dt is not positive");
134 for(
size_t i = 0; i < 2 * m_config.
m_nBlocks; i += 2) {
135 double xOffset = fieldSize.getX() * rand() / RAND_MAX;
136 double yOffset = fieldSize.getY() * rand() / RAND_MAX;
137 double zOffset = fieldSize.getZ() * rand() / RAND_MAX;
139 btVector3 offset(xOffset, yOffset, zOffset);
143 position += btVector3(0.0, 0.0, m_config.
m_length);
Create a box shape as an obstacle or add it to your tensegrity.
virtual void setup(tgWorld &world)
virtual void step(double dt)
virtual void onVisit(const tgModelVisitor &r) const
Class that interfaces with Bullet to build the boxes.
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
virtual void step(double dt)
virtual void setup(tgWorld &world)
Definition of class tgNode.
Contains the definition of class tgBlockField. A random field of blocks used to test tensegrities...
Definition of class tgStructure.
Definition of class tgStructureInfo.
Rand seeding simular to the evolution and terrain classes.
Definition of class tgBuildSpec.
void buildInto(tgModel &model, tgWorld &world)
void addNode(double x, double y, double z, std::string tags="")
virtual void onVisit(tgModelVisitor &r)