9 void GVOShip::updateWithSurveyCoord( const POINT& surveyCoord)
11 const GVOVector v( m_surveyCoord, surveyCoord );
12 const double velocity = v.length();
14 //
\88Ú
\93®
\82µ
\82Ä
\82È
\82¯
\82ê
\82Î
\96³
\8e\8b\82·
\82é
\81B
15 if ( velocity == 0.0 ) {
20 sprintf( buf, "velocity:%f\n", v.length() );
21 OutputDebugStringA( buf );
24 // 90
\93x
\82ð
\92´
\82¦
\82½
\82ç
\8eQ
\8dl
\82É
\82È
\82ç
\82È
\82¢
\97\9a\97ð
\82ð
\83N
\83\8a\83A
\82·
\82é
\81B
25 const double angle = m_vector.angleTo( v );
26 if ( M_PI_2 < ::fabs( angle ) ) {
27 m_vectorHistory.clear();
30 VectorHistoryItem item;
31 item.m_surveyCoord = surveyCoord;
33 m_vectorHistory.push_back( item );
35 m_surveyCoord = surveyCoord;
41 void GVOShip::updateVector()
43 if ( m_vectorHistory.size() < 2 ) {
44 if ( m_vectorHistory.empty() ) {
47 m_vector = m_vectorHistory.back().m_vector;
51 //
\82Æ
\82è
\82 \82¦
\82¸
\93Á
\92è
\82Ì
\8b\97\97£
\90i
\82ñ
\82¾
\95ª
\82Ì
\97\9a\97ð
\82ð
\8d\87\90¬
\82·
\82é
\81B
52 //
\82à
\82¿
\82ë
\82ñ
\8c\8b\89Ê
\82Í
\88À
\92è
\82µ
\82È
\82¢
\82¯
\82Ç
\81B
54 const double k_lengthThreshold = 30; //
\83Q
\81[
\83\80\93à
\8dÀ
\95W
\82Å
\82Ìè
\87\92l
58 for ( VectorHistory::const_reverse_iterator it = m_vectorHistory.rbegin(); it != m_vectorHistory.rend(); ++it ) {
59 v = GVOVector( v, it->m_vector );
60 length += it->m_vector.length();
61 if ( k_lengthThreshold < length ) {
62 m_vectorHistory.erase( m_vectorHistory.begin(), std::next(it).base() );
67 //
\90^
\93\8c\82©
\82ç
\82Ì
\8ap
\93x
\82ð
\8eæ
\93¾
68 double sita = GVOVector( 1, 0 ).angleTo( v );
70 // 2
\93x
\82¸
\82Â
\82Ì360
\93x
\95ª
\89ð
\94\
\82É
\8aÛ
\82ß
\82é
71 sita = (sita * 180.0) / M_PI;
72 sita = ::floor( ::round( sita ) * 0.5 ) * 2.0;
76 sprintf( buf, "%f v:%f\n", sita, v.length() );
77 OutputDebugStringA( buf );
80 //
\8cÊ
\93x
\82É
\96ß
\82·
81 //sita = (sita * M_PI) / 180.0;
82 sita = g_radianFromDegree( sita );
83 //
\90¢
\8aE
\8dÀ
\95W
\8cn
\82Í
\8fã
\82ª0
\82È
\82Ì
\82ÅY
\8e²
\82ð
\94½
\93]
\82³
\82¹
\82é
84 v = GVOVector( ::cos( sita ), -::sin( sita ) );