13 Charger::Charger(
World* world )
14 : world( world ), watts( 1000.0 )
21 if( Contains( pose ) )
25 bool Charger::Contains(
Pose pose )
27 return( pose.
x >= volume.x.min &&
28 pose.
x < volume.x.max &&
29 pose.
y >= volume.y.min &&
30 pose.
y < volume.y.max &&
31 pose.
z >= volume.z.min &&
32 pose.
z < volume.z.max );
37 double given = watts *
world->interval_sim * 1e-6;
59 void Charger::Visualize()
63 glPolygonMode( GL_FRONT, GL_FILL );
64 glColor4f( 1, 0.5,0,0.4 );
65 glTranslatef( 0,0,volume.z.min);
66 glRectf( volume.x.min, volume.y.min, volume.x.max, volume.y.max );
68 glTranslatef( 0,0,volume.z.max );
69 glRectf( volume.x.min, volume.y.min, volume.x.max, volume.y.max );
73 glPolygonMode( GL_FRONT, GL_LINE );
74 glColor4f( 1, 0.5,0,0.8 );
75 glTranslatef( 0,0,volume.z.min);
76 glRectf( volume.x.min, volume.y.min, volume.x.max, volume.y.max );
78 glTranslatef( 0,0,volume.z.max );
79 glRectf( volume.x.min, volume.y.min, volume.x.max, volume.y.max );
86 void swap(
double &a,
double &b )
97 volume.x.min = wf->ReadTupleLength( entity,
"volume", 0, volume.x.min );
98 volume.x.max = wf->ReadTupleLength( entity,
"volume", 1, volume.x.max );
99 volume.y.min = wf->ReadTupleLength( entity,
"volume", 2, volume.y.min );
100 volume.y.max = wf->ReadTupleLength( entity,
"volume", 3, volume.y.max );
101 volume.z.min = wf->ReadTupleLength( entity,
"volume", 4, volume.z.min );
102 volume.z.max = wf->ReadTupleLength( entity,
"volume", 5, volume.z.max );
105 if( volume.x.min > volume.x.max )
106 swap( volume.x.min, volume.x.max );
108 if( volume.y.min > volume.y.max )
109 swap( volume.y.min, volume.y.max );
111 if( volume.z.min > volume.z.max )
112 swap( volume.z.min, volume.z.max );
116 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)