Changeset 577
- Timestamp:
- 07/02/08 12:25:20 (5 months ago)
- Files:
-
- trunk/libx42make/topology-split.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libx42make/topology-split.cpp
r462 r577 109 109 } 110 110 111 struct LeafSortLt 112 { 113 public: 114 LeafSortLt( const BoneTopology &topology ) : top( &topology ) { } 115 116 bool operator () ( const ConstBonePtr &a, const ConstBonePtr &b ) 117 { 118 return (*top)[a].distanceToLocalRoot < (*top)[b].distanceToLocalRoot; 119 } 120 121 private: 122 const BoneTopology *top; 123 }; 124 111 125 void TopologicalSplitter::AddSetsStartingAtLeaves( void ) 112 126 { … … 115 129 116 130 std::vector< ConstBonePtr > toVisit; 117 118 struct LeafSort119 {120 public:121 LeafSort( const BoneTopology &topology ) : top( &topology ) { }122 123 bool operator () ( ConstBonePtr a, ConstBonePtr b )124 {125 return (*top)[a].distanceToLocalRoot < (*top)[b].distanceToLocalRoot;126 }127 128 private:129 const BoneTopology *top;130 };131 131 132 132 toVisit.insert( toVisit.begin(), topology.leaves.begin(), topology.leaves.end() ); 133 std::sort( toVisit.begin(), toVisit.end(), LeafSort ( topology ) );133 std::sort( toVisit.begin(), toVisit.end(), LeafSortLt( topology ) ); 134 134 135 135 InternalAddSets( toVisit, false, topology ); 136 136 } 137 138 struct LeafSortGt 139 { 140 public: 141 LeafSortGt( const BoneTopology &topology ) : top( &topology ) { } 142 143 bool operator () ( const ConstBonePtr &a, const ConstBonePtr &b ) 144 { 145 return (*top)[a].distanceToLocalRoot > (*top)[b].distanceToLocalRoot; 146 } 147 148 private: 149 const BoneTopology *top; 150 }; 137 151 138 152 void TopologicalSplitter::AddSetsStartingAtRoot( void ) … … 142 156 143 157 std::vector< ConstBonePtr > toVisit; 144 145 struct LeafSort146 {147 public:148 LeafSort( const BoneTopology &topology ) : top( &topology ) { }149 150 bool operator () ( ConstBonePtr a, ConstBonePtr b )151 {152 return (*top)[a].distanceToLocalRoot > (*top)[b].distanceToLocalRoot;153 }154 155 private:156 const BoneTopology *top;157 };158 158 159 159 toVisit.insert( toVisit.begin(), topology.leaves.begin(), topology.leaves.end() ); 160 std::sort( toVisit.begin(), toVisit.end(), LeafSort ( topology ) );160 std::sort( toVisit.begin(), toVisit.end(), LeafSortGt( topology ) ); 161 161 162 162 InternalAddSets( toVisit, false, topology );
