12 Charger::Charger(
World *world) : world(world), watts(1000.0)
23 bool Charger::Contains(
Pose pose)
25 return (pose.
x >= volume.x.min && pose.
x < volume.x.max && pose.
y >= volume.y.min
26 && pose.
y < volume.y.max && pose.
z >= volume.z.min && pose.
z < volume.z.max);
31 double given = watts *
world->interval_sim * 1e-6;
54 void Charger::Visualize()
57 glPolygonMode(GL_FRONT, GL_FILL);
58 glColor4f(1, 0.5, 0, 0.4);
59 glTranslatef(0, 0, volume.z.min);
60 glRectf(volume.x.min, volume.y.min, volume.x.max, volume.y.max);
62 glTranslatef(0, 0, volume.z.max);
63 glRectf(volume.x.min, volume.y.min, volume.x.max, volume.y.max);
67 glPolygonMode(GL_FRONT, GL_LINE);
68 glColor4f(1, 0.5, 0, 0.8);
69 glTranslatef(0, 0, volume.z.min);
70 glRectf(volume.x.min, volume.y.min, volume.x.max, volume.y.max);
72 glTranslatef(0, 0, volume.z.max);
73 glRectf(volume.x.min, volume.y.min, volume.x.max, volume.y.max);
80 void swap(
double &a,
double &b)
90 volume.x.min = wf->ReadTupleLength(entity,
"volume", 0, volume.x.min);
91 volume.x.max = wf->ReadTupleLength(entity,
"volume", 1, volume.x.max);
92 volume.y.min = wf->ReadTupleLength(entity,
"volume", 2, volume.y.min);
93 volume.y.max = wf->ReadTupleLength(entity,
"volume", 3, volume.y.max);
94 volume.z.min = wf->ReadTupleLength(entity,
"volume", 4, volume.z.min);
95 volume.z.max = wf->ReadTupleLength(entity,
"volume", 5, volume.z.max);
98 if (volume.x.min > volume.x.max)
99 swap(volume.x.min, volume.x.max);
101 if (volume.y.min > volume.y.max)
102 swap(volume.y.min, volume.y.max);
104 if (volume.z.min > volume.z.max)
105 swap(volume.z.min, volume.z.max);
108 watts = wf->
ReadFloat(entity,
"watts", watts);
void swap(double &a, double &b)
The Stage library uses its own namespace.
meters_t z
location in 3 axes
bool PropertyExists(int section, const char *token)
double ReadFloat(int entity, const char *name, double value)