迭代器和循环器-google earth engine学习教程

时间:2021-06-09 14:46:18
【文件属性】:
文件名称:迭代器和循环器-google earth engine学习教程
文件大小:1.08MB
文件格式:PDF
更新时间:2021-06-09 14:46:18
OpenMesh 中文文档 OpenMesh教程 3.2 迭代器和循环器 坏坰坥坮坍坥坳坨中提供了丰富的迭代器和循环器。迭代器可以用来遍历网格元素,而循环器可 以用来遍历元素的近邻元素在如遍历某一点的所有近邻点,及圱圭坲坩坮坧邻域圩。 圳圮圲圮圱 迭代器 坏坰坥坮坍坥坳坨为各网格元素在点、边、半边、面圩提供了线性迭代器,可以用来遍历网格。使用 方式如下: 1 MyMesh mesh ; 2 // . 3 // i t e r a t e over a l l v e r t i c e s 4 f o r (MyMesh : : Ve r t ex I t e r v i t=mesh . v e r t i c e s b e g i n ( ) ; v i t !=mesh . v e r t i c e s e nd ( ) ; ++v i t ) 5 . . . ; // do something with ∗ v i t , v i t −>, or ∗ v i t 6 // i t e r a t e over a l l h a l f edg e s 7 f o r (MyMesh : : Ha l f edg e I t e r h i t=mesh . ha l f e dg e s b e g i n ( ) ; h i t !=mesh . ha l f edge s end ( ) ; ++h i t ) 8 . . . ; // do something with ∗ h i t , h i t −>, or ∗ h i t 9 // i t e r a t e over a l l edges 10 f o r (MyMesh : : EdgeIter e i t=mesh . edge s beg in ( ) ; e i t !=mesh . edges end ( ) ; ++e i t ) 11 . . . ; // do something with ∗ e i t , e i t −>, or ∗ e i t 12 // i t e r a t o r over a l l f a c e s 13 f o r (MyMesh : : Face I t e r f i t=mesh . f a c e s b e g i n ( ) ; f i t !=mesh . f a c e s end ( ) ; ++f i t ) 14 . . . ; // do something with ∗ f i t , f i t −>, or ∗ f i t 方便起见,也可以使用坃圫圫中提供的坡坵坴坯关键字: 1 MyMesh mesh ; 2 // . 3 // i t e r a t e over a l l v e r t i c e s 4 f o r ( auto v i t=mesh . v e r t i c e s b e g i n ( ) ; v i t !=mesh . v e r t i c e s e nd ( ) ; ++v i t ) 5 . . . ; // do something with ∗ v i t , v i t −>, or ∗ v i t 6 // i t e r a t e over a l l h a l f edg e s 7 f o r ( auto h i t=mesh . ha l f e dg e s b e g i n ( ) ; h i t !=mesh . ha l f edge s end ( ) ; ++h i t ) 8 . . . ; // do something with ∗ h i t , h i t −>, or ∗ h i t 9 // i t e r a t e over a l l edges 10 f o r ( auto e i t=mesh . edge s beg in ( ) ; e i t !=mesh . edges end ( ) ; ++e i t ) 11 . . . ; // do something with ∗ e i t , e i t −>, or ∗ e i t 12 // i t e r a t o r over a l l f a c e s 13 f o r ( auto f i t=mesh . f a c e s b e g i n ( ) ; f i t !=mesh . f a c e s end ( ) ; ++f i t ) 14 . . . ; // do something with ∗ f i t , f i t −>, or ∗ f i t 此外,对于每一个迭代器,坏坰坥坮坍坥坳坨提供了相应的坣坯坮坳坴版本迭代器如下:

网友评论