objects_8c-source.html
来自「仿真人工智能是指用人工的方法和技术」· HTML 代码 · 共 651 行 · 第 1/4 页
HTML
651 行
00246 <a class="code" href="classObject.html#n1">timeLastSeen</a> = time;00247 <font class="keywordflow">return</font> <font class="keyword">true</font>;00248 }00249 <a name="l00253"></a><a class="code" href="classObject.html#a21">00253</a> <a class="code" href="classTime.html">Time</a> <a class="code" href="classObject.html#a21">Object::getTimeLastSeen</a>()<font class="keyword"> const</font>00254 <font class="keyword"></font>{00255 <font class="keywordflow">return</font> <a class="code" href="classObject.html#n1">timeLastSeen</a>;00256 }00257 00258 00259 <font class="comment">/******************************************************************************/</font>00260 <font class="comment">/********************** CLASS FIXEDOBJECT ************************************/</font>00261 <font class="comment">/******************************************************************************/</font>00262 <a name="l00266"></a><a class="code" href="classFixedObject.html#a2">00266</a> <font class="keywordtype">void</font> <a class="code" href="classFixedObject.html#a2">FixedObject::show</a>( ostream & os )00267 {00268 <font class="keywordtype">char</font> buf[<a class="code" href="SoccerTypes_8h.html#a8">MAX_TEAM_NAME_LENGTH</a>];00269 00270 <font class="comment">// DEFAULT_TEAM_NAME is used since it is not a player, so name does not matter</font>00271 <a class="code" href="classSoccerTypes.html#d0">SoccerTypes::getObjectStr</a>( buf, <a class="code" href="classObject.html#n0">objectType</a>, <a class="code" href="SoccerTypes_8h.html#a11">DEFAULT_TEAM_NAME</a> );00272 os << buf00273 << <font class="stringliteral">" rel("</font> << <a class="code" href="classObject.html#n4">posRelative</a> << <font class="stringliteral">" r:"</font> << <a class="code" href="classObject.html#n4">posRelative</a>.<a class="code" href="classVecPosition.html#a32">getMagnitude</a>()00274 << <font class="stringliteral">" phi:"</font> << <a class="code" href="classObject.html#n4">posRelative</a>.<a class="code" href="classVecPosition.html#a33">getDirection</a>()00275 << <font class="stringliteral">" t:"</font> << <a class="code" href="classObject.html#n5">timeRelativePosition</a> << <font class="stringliteral">")"</font>00276 << <font class="stringliteral">" seen:"</font> << <a class="code" href="classObject.html#n1">timeLastSeen</a> << endl;00277 }00278 <a name="l00287"></a><a class="code" href="classFixedObject.html#a0">00287</a> <a class="code" href="classVecPosition.html">VecPosition</a> <a class="code" href="classObject.html#a13">FixedObject::getGlobalPosition</a>( <a class="code" href="SoccerTypes_8h.html#a246">SideT</a> s, <font class="keywordtype">double</font> dGoalWidth )<font class="keyword">const</font>00288 {00289 <font class="keywordflow">return</font> <a class="code" href="classSoccerTypes.html#d17">SoccerTypes::getGlobalPositionFlag</a>( getType(), s, dGoalWidth );00290 }00291 <a name="l00298"></a><a class="code" href="classFixedObject.html#a1">00298</a> <a class="code" href="Geometry_8h.html#a2">AngDeg</a> <a class="code" href="classFixedObject.html#a1">FixedObject::getGlobalAngle</a>( <a class="code" href="SoccerTypes_8h.html#a246">SideT</a> s )00299 {00300 <font class="keywordflow">return</font> <a class="code" href="classSoccerTypes.html#d18">SoccerTypes::getGlobalAngleLine</a>( <a class="code" href="classObject.html#a6">getType</a>(), s );00301 }00302 00303 <font class="comment">/******************************************************************************/</font>00304 <font class="comment">/********************** CLASS DYNAMICOBJECT ***********************************/</font>00305 <font class="comment">/******************************************************************************/</font>00306 <a name="l00309"></a><a class="code" href="classDynamicObject.html#a0">00309</a> <a class="code" href="classDynamicObject.html#a0">DynamicObject::DynamicObject</a>( ):<a class="code" href="classObject.html">Object</a>( )00310 {00311 <a class="code" href="classDynamicObject.html#n2">dRelativeDistanceChange</a> = <a class="code" href="SoccerTypes_8h.html#a19">UnknownDoubleValue</a>;00312 <a class="code" href="classDynamicObject.html#n3">dRelativeAngleChange</a> = <a class="code" href="SoccerTypes_8h.html#a19">UnknownDoubleValue</a>;00313 }00314 <a name="l00320"></a><a class="code" href="classDynamicObject.html#a7">00320</a> <font class="keywordtype">bool</font> <a class="code" href="classDynamicObject.html#a7">DynamicObject::setGlobalVelocity</a>( <a class="code" href="classVecPosition.html">VecPosition</a> v, <a class="code" href="classTime.html">Time</a> time)00321 {00322 <font class="keywordflow">if</font>( v.<a class="code" href="classVecPosition.html#a32">getMagnitude</a>() < <a class="code" href="Geometry_8h.html#a0">EPSILON</a> )00323 <a class="code" href="classDynamicObject.html#n0">vecGlobalVelocity</a>.<a class="code" href="classVecPosition.html#a29">setVecPosition</a>( 0.0, 0.0 );00324 <font class="keywordflow">else</font>00325 <a class="code" href="classDynamicObject.html#n0">vecGlobalVelocity</a> = v;00326 <a class="code" href="classDynamicObject.html#a10">setTimeGlobalVelocity</a>( time );00327 <font class="keywordflow">return</font> <font class="keyword">true</font>;00328 }00329 <a name="l00333"></a><a class="code" href="classDynamicObject.html#a8">00333</a> <a class="code" href="classVecPosition.html">VecPosition</a> <a class="code" href="classDynamicObject.html#a8">DynamicObject::getGlobalVelocity</a>( )<font class="keyword"> const</font>00334 <font class="keyword"></font>{00335 <font class="keywordflow">return</font> <a class="code" href="classDynamicObject.html#n0">vecGlobalVelocity</a>;00336 }00337 <a name="l00341"></a><a class="code" href="classDynamicObject.html#a9">00341</a> <font class="keywordtype">double</font> <a class="code" href="classDynamicObject.html#a9">DynamicObject::getSpeed</a>( )<font class="keyword"> const</font>00342 <font class="keyword"></font>{00343 <font class="keywordflow">return</font> <a class="code" href="classDynamicObject.html#n0">vecGlobalVelocity</a>.<a class="code" href="classVecPosition.html#a32">getMagnitude</a>();00344 }00345 <a name="l00350"></a><a class="code" href="classDynamicObject.html#a10">00350</a> <font class="keywordtype">bool</font> <a class="code" href="classDynamicObject.html#a10">DynamicObject::setTimeGlobalVelocity</a>( <a class="code" href="classTime.html">Time</a> time )00351 {00352 <a class="code" href="classDynamicObject.html#n1">timeGlobalVelocity</a> = time;00353 <font class="keywordflow">return</font> <font class="keyword">true</font>;00354 }00355 <a name="l00359"></a><a class="code" href="classDynamicObject.html#a11">00359</a> <a class="code" href="classTime.html">Time</a> <a class="code" href="classDynamicObject.html#a11">DynamicObject::getTimeGlobalVelocity</a>()<font class="keyword"> const</font>00360 <font class="keyword"></font>{00361 <font class="keywordflow">return</font> <a class="code" href="classDynamicObject.html#n1">timeGlobalVelocity</a>;00362 }00363 <a name="l00369"></a><a class="code" href="classDynamicObject.html#a1">00369</a> <font class="keywordtype">bool</font> <a class="code" href="classDynamicObject.html#a1">DynamicObject::setRelativeDistanceChange</a>( <font class="keywordtype">double</font> d, <a class="code" href="classTime.html">Time</a> time )00370 {00371 <a class="code" href="classDynamicObject.html#n2">dRelativeDistanceChange</a> = d;00372 <a class="code" href="classDynamicObject.html#a5">setTimeChangeInformation</a>( time );00373 <font class="keywordflow">return</font> <font class="keyword">true</font>;00374 }00375 <a name="l00382"></a><a class="code" href="classDynamicObject.html#a2">00382</a> <font class="keywordtype">double</font> <a class="code" href="classDynamicObject.html#a2">DynamicObject::getRelativeDistanceChange</a>()<font class="keyword"> const</font>00383 <font class="keyword"></font>{00384 <font class="keywordflow">return</font> <a class="code" href="classDynamicObject.html#n2">dRelativeDistanceChange</a>;00385 }00386 <a name="l00392"></a><a class="code" href="classDynamicObject.html#a3">00392</a> <font class="keywordtype">bool</font> <a class="code" href="classDynamicObject.html#a3">DynamicObject::setRelativeAngleChange</a>( <font class="keywordtype">double</font> d, <a class="code" href="classTime.html">Time</a> time )00393 {00394 <a class="code" href="classDynamicObject.html#n3">dRelativeAngleChange</a> = d;00395 <a class="code" href="classDynamicObject.html#a5">setTimeChangeInformation</a>( time );00396 <font class="keywordflow">return</font> <font class="keyword">true</font>;00397 }00398 <a name="l00403"></a><a class="code" href="classDynamicObject.html#a4">00403</a> <font class="keywordtype">double</font> <a class="code" href="classDynamicObject.html#a4">DynamicObject::getRelativeAngleChange</a>()<font class="keyword"> const</font>00404 <font class="keyword"></font>{00405 <font class="keywordflow">return</font> <a class="code" href="classDynamicObject.html#n3">dRelativeAngleChange</a>;00406 }00407 <a name="l00411"></a><a class="code" href="classDynamicObject.html#a5">00411</a> <font class="keywordtype">bool</font> <a class="code" href="classDynamicObject.html#a5">DynamicObject::setTimeChangeInformation</a>( <a class="code" href="classTime.html">Time</a> time )00412 {00413 <a class="code" href="classDynamicObject.html#n4">timeChangeInformation</a> = time ;00414 <font class="keywordflow">return</font> <font class="keyword">true</font>;00415 }00416 <a name="l00420"></a><a class="code" href="classDynamicObject.html#a6">00420</a> <a class="code" href="classTime.html">Time</a> <a class="code" href="classDynamicObject.html#a6">DynamicObject::getTimeChangeInformation</a>() <font class="keyword">const</font>00421 {00422 <font class="keywordflow">return</font> timeChangeInformation;00423 }00424 00425 00426 <font class="comment">/******************************************************************************/</font>00427 <font class="comment">/********************** CLASS PLAYEROBJECT ************************************/</font>00428 <font class="comment">/******************************************************************************/</font>00429 00432 <a class="code" href="classPlayerObject.html#a0">PlayerObject::PlayerObject</a>( ):<a class="code" href="classDynamicObject.html">DynamicObject</a>( )<a name="l00433"></a><a class="code" href="classPlayerObject.html#a0">00433</a> {00434 <a class="code" href="classPlayerObject.html#n2">angGlobalBodyAngle</a> = <a class="code" href="SoccerTypes_8h.html#a20">UnknownAngleValue</a>;00435 <a class="code" href="classPlayerObject.html#n3">angGlobalNeckAngle</a> = <a class="code" href="SoccerTypes_8h.html#a20">UnknownAngleValue</a>;00436 <a class="code" href="classPlayerObject.html#n0">isKnownPlayer</a> = <font class="keyword">false</font>;00437 <a class="code" href="classPlayerObject.html#n1">isGoalie</a> = <font class="keyword">false</font>;00438 00439 <a class="code" href="classPlayerObject.html#o0">angRelativeBodyAngle</a> = <a class="code" href="SoccerTypes_8h.html#a20">UnknownAngleValue</a>;00440 <a class="code" href="classPlayerObject.html#o1">angRelativeNeckAngle</a> = <a class="code" href="SoccerTypes_8h.html#a20">UnknownAngleValue</a>;00441 }00442 00448 <font class="keywordtype">bool</font> <a class="code" href="classPlayerObject.html#a7">PlayerObject::setRelativeBodyAngle</a>( <a class="code" href="Geometry_8h.html#a2">AngDeg</a> ang, <a class="code" href="classTime.html">Time</a> time )<a name="l00449"></a><a class="code" href="classPlayerObject.html#a7">00449</a> {00450 <a class="code" href="classPlayerObject.html#o0">angRelativeBodyAngle</a> = ang;00451 <a class="code" href="classPlayerObject.html#a15">setTimeRelativeAngles</a>( time );00452 <font class="keywordflow">return</font> <font class="keyword">true</font>;00453 }00454 00458 <a class="code" href="Geometry_8h.html#a2">AngDeg</a> <a class="code" href="classPlayerObject.html#a8">PlayerObject::getRelativeBodyAngle</a>( ) <font class="keyword">const</font><a name="l00459"></a><a class="code" href="classPlayerObject.html#a8">00459</a> {00460 <font class="keywordflow">return</font> angRelativeBodyAngle;00461 }00462 00468 <font class="keywordtype">bool</font> <a class="code" href="classPlayerObject.html#a9">PlayerObject::setGlobalBodyAngle</a>( <a class="code" href="Geometry_8h.html#a2">AngDeg</a> ang, <a class="code" href="classTime.html">Time</a> time)<a name="l00469"></a><a class="code" href="classPlayerObject.html#a9">00469</a> {00470 <a class="code" href="classPlayerObject.html#n2">angGlobalBodyAngle</a> = ang;00471 <a class="code" href="classPlayerObject.html#a17">setTimeGlobalAngles</a>( time );00472 <font class="keywordflow">return</font> <font class="keyword">true</font>;00473 }00474 00478 <a class="code" href="Geometry_8h.html#a2">AngDeg</a> <a class="code" href="classPlayerObject.html#a10">PlayerObject::getGlobalBodyAngle</a>( ) <font class="keyword">const</font><a name="l00479"></a><a class="code" href="classPlayerObject.html#a10">00479</a> {00480 <font class="keywordflow">return</font> angGlobalBodyAngle;00481 }00482 00488 <font class="keywordtype">bool</font> <a class="code" href="classPlayerObject.html#a11">PlayerObject::setRelativeNeckAngle</a>( <a class="code" href="Geometry_8h.html#a2">AngDeg</a> ang, <a class="code" href="classTime.html">Time</a> time )<a name="l00489"></a><a class="code" href="classPlayerObject.html#a11">00489</a> {00490 <a class="code" href="classPlayerObject.html#o1">angRelativeNeckAngle</a> = ang;00491 <a class="code" href="classPlayerObject.html#a15">setTimeRelativeAngles</a>( time );00492 <font class="keywordflow">return</font> <font class="keyword">true</font>;00493 }00494 00498 <a class="code" href="Geometry_8h.html#a2">AngDeg</a> <a class="code" href="classPlayerObject.html#a12">PlayerObject::getRelativeNeckAngle</a>( ) <font class="keyword">const</font><a name="l00499"></a><a class="code" href="classPlayerObject.html#a12">00499</a> {00500 <font class="keywordflow">return</font> angRelativeNeckAngle;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?