ホーム » メモ » FaceA::Search の高速化

2010年10月
 12
3456789
10111213141516
17181920212223
24252627282930
31  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,459 アクセス



FaceA::Search の高速化

データが増えると遅かったので改良
BOOL FaceA::Search(const long edgeS,const long edgeE,long* left_Face,long* rightFace) const
{
  if (left_Face == NULL) { return FALSE ; }
  if (rightFace== NULL) { return FALSE ; }
  *left_Face = *rightFace = -1 ;
  BOOL lfFound = FALSE ;
  BOOL rfFound = FALSE ;
   static long LastFace = 0 ;
  int index = 0 ;
   for (index=LastFace ; index<GetCount() ; index++) {
     Face f = Faces[index] ;
     if (!f.Search(edgeS,edgeE,&lfFound,&rfFound)) { continue ; }
     if (*left_Face<0 && lfFound) { *left_Face = index ; }
     if (*rightFace<0 && rfFound) { *rightFace = index ; }
     if (*left_Face >= 0 && *rightFace>=0) {
       LastFace = min(*left_Face,*rightFace) ;
       return TRUE ;
       }
     }
  for (index=0 ; index<GetCount() ; index++) {
    Face f = Faces[index] ;
    if (!f.Search(edgeS,edgeE,&lfFound,&rfFound)) { continue ; }
    if (*left_Face<0 && lfFound) { *left_Face = index ; }
    if (*rightFace<0 && rfFound) { *rightFace = index ; }
    if (*left_Face >= 0 && *rightFace>=0) {
      LastFace = min(*left_Face,*rightFace) ;
      return TRUE ;
      }
    }
  return FALSE ;
  }

前に検索して一致した所から再検索するコードを追加.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。