77 void selectVertices(
SplatCloud *_splatCloud,
const std::vector<int> &_vertices )
79 if( _splatCloud == 0 )
82 if( _vertices.empty() )
90 unsigned int i, num = _splatCloud->
numSplats();
91 for( i=0; i<num; ++i )
95 int n_vertices = (int) _splatCloud->
numSplats();
98 for( i=0; i<_vertices.size(); ++i )
100 int v = _vertices[ i ];
101 if( (v >= 0) && (v < n_vertices) )
110 void unselectVertices(
SplatCloud *_splatCloud,
const std::vector<int> &_vertices )
112 if( _splatCloud == 0 )
115 if( _vertices.empty() )
121 int n_vertices = (int) _splatCloud->
numSplats();
124 for( i=0; i<_vertices.size(); ++i )
126 int v = _vertices[ i ];
127 if( (v >= 0) && (v < n_vertices) )
136 void selectAllVertices(
SplatCloud *_splatCloud )
138 if( _splatCloud == 0 )
147 unsigned int i, num = _splatCloud->
numSplats();
148 for( i=0; i<num; ++i )
156 void clearVertexSelection(
SplatCloud *_splatCloud )
158 if( _splatCloud == 0 )
164 unsigned int i, num = _splatCloud->
numSplats();
165 for( i=0; i<num; ++i )
173 void invertVertexSelection(
SplatCloud *_splatCloud )
175 if( _splatCloud == 0 )
180 unsigned int i, num = _splatCloud->
numSplats();
181 for( i=0; i<num; ++i )
189 unsigned int i, num = _splatCloud->
numSplats();
190 for( i=0; i<num; ++i )
199 static unsigned int countSelected(
const SplatCloud *_splatCloud )
201 unsigned int count = 0;
203 unsigned int i, num = _splatCloud->
numSplats();
204 for( i=0; i<num; ++i )
217 std::vector<int> getVertexSelection(
const SplatCloud *_splatCloud )
219 std::vector<int> vertices;
221 if( _splatCloud == 0 )
227 unsigned int numSelected = countSelected( _splatCloud );
229 vertices.reserve( numSelected );
231 unsigned int i, num = _splatCloud->
numSplats();
232 for( i=0; i<num; ++i )
235 vertices.push_back( i );
245 std::vector<int> getVertexSelection(
const SplatCloud *_splatCloud,
bool &_inverted )
249 std::vector<int> vertices;
251 if( _splatCloud == 0 )
257 unsigned int numSelected = countSelected( _splatCloud );
258 unsigned int numUnselected = _splatCloud->
numSplats() - numSelected;
260 if( numSelected <= numUnselected )
262 vertices.reserve( numSelected );
264 unsigned int i, num = _splatCloud->
numSplats();
265 for( i=0; i<num; ++i )
268 vertices.push_back( i );
275 vertices.reserve( numUnselected );
277 unsigned int i, num = _splatCloud->
numSplats();
278 for( i=0; i<num; ++i )
281 vertices.push_back( i );
bool hasSelections() const
Return the availability of the predefined property.
bool requestSelections()
Request the predefined property.
unsigned int numSplats() const
Get the number of splats.
Selection & selections(int _idx)
Get a reference of the predefined property's value.
Functions for selection on a SplatCloud.