00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef freecloth_geMeshWingedEdge_inline_h
00020 #define freecloth_geMeshWingedEdge_inline_h
00021
00022 FREECLOTH_NAMESPACE_START
00023
00024
00025
00026
00027
00028
00029
00030 inline UInt32 GeMeshWingedEdge::getNbHalfEdges() const
00031 {
00032 return _halfEdges.size();
00033 }
00034
00035
00036
00037 inline GeMeshWingedEdge::HalfEdgeType GeMeshWingedEdge::getHalfEdge(
00038 HalfEdgeId halfEdgeId
00039 ) const {
00040 return HalfEdgeWrapper( *this, halfEdgeId );
00041 }
00042
00043
00044
00045 inline GeMeshWingedEdge::HalfEdgeIterator
00046 GeMeshWingedEdge::beginHalfEdge() const
00047 {
00048 return HalfEdgeIterator::begin( *this );
00049 }
00050
00051
00052
00053 inline GeMeshWingedEdge::HalfEdgeIterator
00054 GeMeshWingedEdge::endHalfEdge() const
00055 {
00056 return HalfEdgeIterator::end( *this );
00057 }
00058
00059
00060
00061 inline GeMeshWingedEdge::EdgeIterator
00062 GeMeshWingedEdge::beginEdge() const
00063 {
00064 return EdgeIterator::begin( *this );
00065 }
00066
00067
00068
00069 inline GeMeshWingedEdge::EdgeIterator
00070 GeMeshWingedEdge::endEdge() const
00071 {
00072 return EdgeIterator::end( *this );
00073 }
00074
00075
00076
00077 inline GeMeshWingedEdge::VertexHalfEdgeIterator
00078 GeMeshWingedEdge::beginVertexHalfEdge( VertexId vertexId ) const
00079 {
00080 return VertexHalfEdgeIterator::begin( *this, vertexId );
00081 }
00082
00083
00084
00085 inline GeMeshWingedEdge::VertexHalfEdgeIterator
00086 GeMeshWingedEdge::endVertexHalfEdge( VertexId vertexId ) const
00087 {
00088 return VertexHalfEdgeIterator::end( *this, vertexId );
00089 }
00090
00091
00092
00093 inline GeMeshWingedEdge::VertexEdgeIterator
00094 GeMeshWingedEdge::beginVertexEdge( VertexId vertexId ) const
00095 {
00096 return VertexEdgeIterator::begin( *this, vertexId );
00097 }
00098
00099
00100
00101 inline GeMeshWingedEdge::VertexEdgeIterator
00102 GeMeshWingedEdge::endVertexEdge( VertexId vertexId ) const
00103 {
00104 return VertexEdgeIterator::end( *this, vertexId );
00105 }
00106
00107
00108
00109 inline GeMeshWingedEdge::VertexFaceIterator
00110 GeMeshWingedEdge::beginVertexFace( VertexId vertexId ) const
00111 {
00112 return VertexFaceIterator::begin( *this, vertexId );
00113 }
00114
00115
00116
00117 inline GeMeshWingedEdge::VertexFaceIterator
00118 GeMeshWingedEdge::endVertexFace( VertexId vertexId ) const
00119 {
00120 return VertexFaceIterator::end( *this, vertexId );
00121 }
00122
00123
00124
00125 inline GeMeshWingedEdge::HalfEdgeId
00126 GeMeshWingedEdge::getHalfEdgeFromFaceId( FaceId faceId ) const
00127 {
00128 DGFX_ASSERT( faceId < _faceHalfEdgeIds.size() );
00129 return _faceHalfEdgeIds[ faceId ];
00130 }
00131
00132
00133
00134 inline const GeMesh& GeMeshWingedEdge::getMesh() const
00135 {
00136 return *_mesh;
00137 }
00138
00139
00140
00141
00142
00143
00144
00145
00146 inline GeMeshWingedEdge::HalfEdge::HalfEdge()
00147 {
00148 }
00149
00150
00151
00152 inline GeMeshWingedEdge::HalfEdge::HalfEdge(
00153 VertexId origin,
00154 HalfEdgeId twin,
00155 FaceId face,
00156 HalfEdgeId next
00157 ) : _origin( origin ),
00158 _twin( twin ),
00159 _face( face ),
00160 _next( next )
00161 {
00162 }
00163
00164
00165
00166 inline GeMeshWingedEdge::VertexId
00167 GeMeshWingedEdge::HalfEdge::getOriginVertexId() const
00168 {
00169 return _origin;
00170 }
00171
00172
00173
00174 inline GeMeshWingedEdge::HalfEdgeId
00175 GeMeshWingedEdge::HalfEdge::getTwinHalfEdgeId() const
00176 {
00177 DGFX_ASSERT( hasTwin() );
00178 return _twin;
00179 }
00180
00181
00182
00183 inline GeMeshWingedEdge::FaceId GeMeshWingedEdge::HalfEdge::getFaceId() const
00184 {
00185 return _face;
00186 }
00187
00188
00189
00190 inline GeMeshWingedEdge::HalfEdgeId
00191 GeMeshWingedEdge::HalfEdge::getNextHalfEdgeId() const
00192 {
00193 return _next;
00194 }
00195
00196
00197
00198 inline bool GeMeshWingedEdge::HalfEdge::hasTwin() const
00199 {
00200 return _twin != ID_INVALID;
00201 }
00202
00203
00204
00205
00206
00207
00208
00209
00210 inline GeMeshWingedEdge::HalfEdgeWrapper::HalfEdgeWrapper()
00211 : _meshwe( 0 ),
00212 _halfEdgeId( 0 )
00213 {
00214 }
00215
00216
00217
00218 inline GeMeshWingedEdge::HalfEdgeWrapper::HalfEdgeWrapper(
00219 const GeMeshWingedEdge& meshwe,
00220 HalfEdgeId halfEdgeId
00221 ) : _meshwe( &meshwe ),
00222 _halfEdgeId( halfEdgeId )
00223 {
00224 DGFX_ASSERT( isValid() );
00225 }
00226
00227
00228
00229 inline GeMeshWingedEdge::HalfEdgeWrapper::HalfEdgeWrapper(
00230 const GeMeshWingedEdge* meshwe,
00231 HalfEdgeId halfEdgeId
00232 ) : _meshwe( meshwe ),
00233 _halfEdgeId( halfEdgeId )
00234 {
00235
00236
00237 }
00238
00239
00240
00241 inline const GeMeshWingedEdge&
00242 GeMeshWingedEdge::HalfEdgeWrapper::getMeshWE() const
00243 {
00244 DGFX_ASSERT( _meshwe != 0 );
00245 return *_meshwe;
00246 }
00247
00248
00249
00250 inline const GeMesh& GeMeshWingedEdge::HalfEdgeWrapper::getMesh() const
00251 {
00252 return getMeshWE().getMesh();
00253 }
00254
00255
00256
00257 inline GeMeshWingedEdge::HalfEdgeId
00258 GeMeshWingedEdge::HalfEdgeWrapper::getHalfEdgeId() const
00259 {
00260 return _halfEdgeId;
00261 }
00262
00263
00264
00265 inline bool GeMeshWingedEdge::HalfEdgeWrapper::isValid() const
00266 {
00267 return _meshwe != 0 && _halfEdgeId < getMeshWE().getNbHalfEdges();
00268 }
00269
00270
00271
00272 inline GeMeshWingedEdge::VertexId
00273 GeMeshWingedEdge::HalfEdgeWrapper::getOriginVertexId() const
00274 {
00275 return getMeshWE()._halfEdges[ _halfEdgeId ].getOriginVertexId();
00276 }
00277
00278
00279
00280 inline const GeMeshWingedEdge::VertexType&
00281 GeMeshWingedEdge::HalfEdgeWrapper::getOriginVertex() const
00282 {
00283 return getMesh().getVertex( getOriginVertexId() );
00284 }
00285
00286
00287
00288 inline GeMeshWingedEdge::VertexId
00289 GeMeshWingedEdge::HalfEdgeWrapper::getTipVertexId() const
00290 {
00291 return getNextHalfEdge().getOriginVertexId();
00292 }
00293
00294
00295
00296 inline const GeMeshWingedEdge::VertexType&
00297 GeMeshWingedEdge::HalfEdgeWrapper::getTipVertex() const
00298 {
00299 return getMesh().getVertex( getTipVertexId() );
00300 }
00301
00302
00303
00304 inline GeMeshWingedEdge::VertexId
00305 GeMeshWingedEdge::HalfEdgeWrapper::getOppositeVertexId() const
00306 {
00307 return getNextHalfEdge().getTipVertexId();
00308 }
00309
00310
00311
00312 inline const GeMeshWingedEdge::VertexType&
00313 GeMeshWingedEdge::HalfEdgeWrapper::getOppositeVertex() const
00314 {
00315 return getMesh().getVertex( getOppositeVertexId() );
00316 }
00317
00318
00319
00320 inline GeMeshWingedEdge::HalfEdgeId
00321 GeMeshWingedEdge::HalfEdgeWrapper::getTwinHalfEdgeId() const
00322 {
00323 return getMeshWE()._halfEdges[ _halfEdgeId ].getTwinHalfEdgeId();
00324 }
00325
00326
00327
00328 inline GeMeshWingedEdge::HalfEdgeWrapper
00329 GeMeshWingedEdge::HalfEdgeWrapper::getTwinHalfEdge() const
00330 {
00331 return getMeshWE().getHalfEdge( getTwinHalfEdgeId() );
00332 }
00333
00334
00335
00336 inline GeMeshWingedEdge::FaceId
00337 GeMeshWingedEdge::HalfEdgeWrapper::getFaceId() const
00338 {
00339 return getMeshWE()._halfEdges[ _halfEdgeId ].getFaceId();
00340 }
00341
00342
00343
00344 inline GeMesh::FaceType
00345 GeMeshWingedEdge::HalfEdgeWrapper::getFace() const
00346 {
00347 return getMesh().getFace( getFaceId() );
00348 }
00349
00350
00351
00352 inline GeMeshWingedEdge::HalfEdgeId
00353 GeMeshWingedEdge::HalfEdgeWrapper::getNextHalfEdgeId() const
00354 {
00355 return getMeshWE()._halfEdges[ _halfEdgeId ].getNextHalfEdgeId();
00356 }
00357
00358
00359
00360 inline GeMeshWingedEdge::HalfEdgeWrapper
00361 GeMeshWingedEdge::HalfEdgeWrapper::getNextHalfEdge() const
00362 {
00363 return getMeshWE().getHalfEdge( getNextHalfEdgeId() );
00364 }
00365
00366
00367
00368 inline GeMeshWingedEdge::HalfEdgeId
00369 GeMeshWingedEdge::HalfEdgeWrapper::getPrevHalfEdgeId() const
00370 {
00371
00372 return getNextHalfEdge().getNextHalfEdgeId();
00373 }
00374
00375
00376
00377 inline GeMeshWingedEdge::HalfEdgeWrapper
00378 GeMeshWingedEdge::HalfEdgeWrapper::getPrevHalfEdge() const
00379 {
00380 return getMeshWE().getHalfEdge( getPrevHalfEdgeId() );
00381 }
00382
00383
00384
00385 inline bool GeMeshWingedEdge::HalfEdgeWrapper::hasTwin() const
00386 {
00387 return getMeshWE()._halfEdges[ _halfEdgeId ].hasTwin();
00388 }
00389
00390
00391
00392
00393
00394
00395
00396
00397 template <bool HALF>
00398 inline TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::EdgeIteratorBase<HALF>
00399 TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::EdgeIteratorBase<HALF>::end(
00400 const GeMeshWingedEdge& meshwe
00401 ) {
00402
00403 return EdgeIteratorBase(
00404 HalfEdgeWrapper( &meshwe, meshwe.getNbHalfEdges() )
00405 );
00406 }
00407
00408
00409
00410 template <bool HALF>
00411 inline bool TEMPLATE_NAMESPACE_PREFIX
00412 GeMeshWingedEdge::EdgeIteratorBase<HALF>::operator==(
00413 const EdgeIteratorBase& rhs
00414 ) const {
00415 return ( _wrapper._meshwe == rhs._wrapper._meshwe ) &&
00416 ( _wrapper._halfEdgeId == rhs._wrapper._halfEdgeId );
00417 }
00418
00419
00420
00421 template <bool HALF>
00422 inline bool TEMPLATE_NAMESPACE_PREFIX
00423 GeMeshWingedEdge::EdgeIteratorBase<HALF>::operator!=(
00424 const EdgeIteratorBase& rhs
00425 ) const {
00426 return !operator==( rhs );
00427 }
00428
00429
00430
00431 template <bool HALF>
00432 inline const TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::HalfEdgeWrapper&
00433 TEMPLATE_NAMESPACE_PREFIX
00434 GeMeshWingedEdge::EdgeIteratorBase<HALF>::operator*() const
00435 {
00436 DGFX_ASSERT( _wrapper.isValid() );
00437 return _wrapper;
00438 }
00439
00440
00441
00442 template <bool HALF>
00443 inline const TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::HalfEdgeWrapper*
00444 TEMPLATE_NAMESPACE_PREFIX
00445 GeMeshWingedEdge::EdgeIteratorBase<HALF>::operator->() const
00446 {
00447 DGFX_ASSERT( _wrapper.isValid() );
00448 return &_wrapper;
00449 }
00450
00451
00452
00453
00454
00455
00456
00457
00458 template <bool HALF>
00459 inline TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>
00460 TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>::end(
00461 const GeMeshWingedEdge& meshwe,
00462 VertexId
00463 ) {
00464 return VertexEdgeIteratorBase(
00465 HalfEdgeWrapper( &meshwe, ID_INVALID ),
00466 ID_INVALID
00467 );
00468 }
00469
00470
00471
00472 template <bool HALF>
00473 inline bool TEMPLATE_NAMESPACE_PREFIX
00474 GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>::operator==(
00475 const VertexEdgeIteratorBase& rhs
00476 ) const {
00477 return ( _wrapper._meshwe == rhs._wrapper._meshwe ) &&
00478 ( _vertexId == rhs._vertexId ) &&
00479 ( _wrapper._halfEdgeId == rhs._wrapper._halfEdgeId );
00480 }
00481
00482
00483
00484 template <bool HALF>
00485 inline bool TEMPLATE_NAMESPACE_PREFIX
00486 GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>::operator!=(
00487 const VertexEdgeIteratorBase& rhs
00488 ) const {
00489 return !operator==( rhs );
00490 }
00491
00492
00493
00494 template <bool HALF>
00495 inline const TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::HalfEdgeWrapper&
00496 TEMPLATE_NAMESPACE_PREFIX
00497 GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>::operator*() const
00498 {
00499 DGFX_ASSERT( _vertexId != ID_INVALID && _wrapper.isValid() );
00500 return _wrapper;
00501 }
00502
00503
00504
00505 template <bool HALF>
00506 inline const TEMPLATE_NAMESPACE_PREFIX GeMeshWingedEdge::HalfEdgeWrapper*
00507 TEMPLATE_NAMESPACE_PREFIX
00508 GeMeshWingedEdge::VertexEdgeIteratorBase<HALF>::operator->() const
00509 {
00510 DGFX_ASSERT( _vertexId != ID_INVALID && _wrapper.isValid() );
00511 return &_wrapper;
00512 }
00513
00514
00515
00516
00517
00518
00519
00520
00521 inline GeMeshWingedEdge::VertexFaceIterator
00522 GeMeshWingedEdge::VertexFaceIterator::end(
00523 const GeMeshWingedEdge& meshwe,
00524 VertexId
00525 ) {
00526 return VertexFaceIterator(
00527 HalfEdgeWrapper( &meshwe, ID_INVALID ),
00528 ID_INVALID
00529 );
00530 }
00531
00532
00533
00534 inline bool GeMeshWingedEdge::VertexFaceIterator::operator==(
00535 const VertexFaceIterator& rhs
00536 ) const {
00537 return ( _wrapper._meshwe == rhs._wrapper._meshwe ) &&
00538 ( _vertexId == rhs._vertexId ) &&
00539 ( _wrapper._halfEdgeId == rhs._wrapper._halfEdgeId );
00540 }
00541
00542
00543
00544 inline bool GeMeshWingedEdge::VertexFaceIterator::operator!=(
00545 const VertexFaceIterator& rhs
00546 ) const {
00547 return !operator==( rhs );
00548 }
00549
00550
00551
00552 inline const GeMesh::FaceWrapper&
00553 GeMeshWingedEdge::VertexFaceIterator::operator*() const
00554 {
00555 DGFX_ASSERT( _vertexId != ID_INVALID && _wrapper.isValid() );
00556 return _faceWrapper;
00557 }
00558
00559
00560
00561 inline const GeMesh::FaceWrapper*
00562 GeMeshWingedEdge::VertexFaceIterator::operator->() const
00563 {
00564 DGFX_ASSERT( _vertexId != ID_INVALID && _wrapper.isValid() );
00565 return &_faceWrapper;
00566 }
00567
00568 FREECLOTH_NAMESPACE_END
00569
00570 #endif