35 #include "LinearMath/btVector3.h"
64 origin = btVector3(0,0,0);
69 origin = btVector3(center.getX(), center.getY(), center.getZ());
78 const tgBox::Config boxConfig(c.width, c.height, c.density, c.friction, c.rollFriction, c.restitution);
86 spec.addBuilder(
"box",
new tgBoxInfo(boxConfig));
92 structureInfo.buildInto(*
this, world);
104 throw std::invalid_argument(
"dt is not positive");
124 const int nBoxes = 4;
127 btVector3 rotationPoint = origin;
128 btVector3 rotationAxis = btVector3(0, 1, 0);
129 double rotationAngle = M_PI/2;
136 for(
int i=0;i<nodes.size();i+=2) {
139 s.
addRotation(rotationPoint, rotationAxis, rotationAngle);
142 s.move(btVector3(0, -5, 0));
145 void tgCraterDeep::addBoxNodes() {
155 btVector3 rotationPoint = btVector3((x2-x1)/2, (y2-y1)/2, (z2-z1)/2);
156 btVector3 rotationAxis = btVector3(0, 1, 0);
157 double rotationAngle = 0;
159 node =
tgNode(x1, y1, z1,
"node");
160 node.
addRotation(rotationPoint, rotationAxis, rotationAngle);
161 nodes.push_back(node);
163 node =
tgNode(x2, y2, z2,
"node");
164 node.
addRotation(rotationPoint, rotationAxis, rotationAngle);
165 nodes.push_back(node);
Create a box shape as an obstacle or add it to your tensegrity.
virtual void setup(tgWorld &world)
void addRotation(const btVector3 &fixedPoint, const btVector3 &fromOrientation, const btVector3 &toOrientation)
Contains the definition of class tgCraterDeep. Specifically, this crater is defined as a series of bo...
virtual void step(double dt)
virtual void onVisit(tgModelVisitor &r)
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="")
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
Definition of class tgNode.
virtual void setup(tgWorld &world)
Definition of class tgStructure.
Definition of class tgStructureInfo.
Definition of class tgBuildSpec.
virtual void step(double dt)
void notifyStep(double dt)
void addNode(double x, double y, double z, std::string tags="")