https://github.com/ubpa/uhemesh
an elegant, high-performance and user-friendly halfedge data structure
https://github.com/ubpa/uhemesh
Last synced: over 1 year ago
JSON representation
an elegant, high-performance and user-friendly halfedge data structure
- Host: GitHub
- URL: https://github.com/ubpa/uhemesh
- Owner: Ubpa
- License: mit
- Created: 2020-01-19T12:35:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T14:47:49.000Z (over 5 years ago)
- Last Synced: 2025-03-24T20:38:10.969Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 185 KB
- Stars: 82
- Watchers: 3
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```
__ __ __ __ _______ .___ ___. _______ _______. __ __
| | | | | | | | | ____|| \/ | | ____| / || | | |
| | | | | |__| | | |__ | \ / | | |__ | (----`| |__| |
| | | | | __ | | __| | |\/| | | __| \ \ | __ |
| `--' | | | | | | |____ | | | | | |____.----) | | | | |
\______/ |__| |__| |_______||__| |__| |_______|_______/ |__| |__|
```
# UHEMesh
> **U**bpa **H**alf-**E**dge **Mesh**
⭐ Star us on GitHub — it helps!
[](https://github.com/Ubpa/UHEMesh/archive/master.zip) [](https://github.com/Ubpa/UHEMesh/tags) [](LICENSE)
an elegant, high-performance, user-friendly halfedge data structure
## Feature
- Elegant: store **topology** only
- High-performance: **cache-friendly**
- User-friendly: you can custom **Vertex, Edge, Polygon and Half-Edge** class
## Usage
### default Vertex, Edge, Polygon and Half-Edge class
```c++
#include
#include
int main() {
std::vector indices = {0,1,2,0,2,3};
Ubpa::HEMesh<> mesh(indices, 3);
// ...
}
```
### custom Vertex, Edge, Polygon and Half-Edge class
```c++
#include
#include
using namespace Ubpa;
// forward declaration
class V;
class E;
class P;
class H;
using Traits_VEPH = HEMeshTraits;
// custom vertex, edge, polygon and half-edge class
class V : public TVertex { /*...*/ }
class E : public TEdge { /*...*/ }
class P : public TPolygon { /*...*/ }
class H : public THalfEdge { /*...*/ }
int main() {
std::vector indices = {0,1,2,0,2,3};
HEMesh mesh(indices, 3);
// ...
}
```
## Documentaion
We have no documentaion.
You can read source code ([include/UHEMesh](include/UHEMesh)) and [example](src/test/00_basic/main.cpp) for more details.
## Tips
- customed class `T` should `std::is_default_constructibl`
- you can get vertex, edge, polygon and halfedge type by `HEMesh<...>::V/E/P/HE`
- use `Empty*_*` type if you don't need to custom some class, see [Empty.h](include/UHEMesh/Empty.h) for more details.
> **example**
>
> if you just need to custom vertex and polygon, then you can do like this
>
> ```c++
> class V;
> class P;
> using Traits_VP = HEMeshTriats_EmptyEH;
> class V : public TVertex { /*...*/ }
> class P : public TPolygon { /*...*/ }
>
> int main() {
> std::vector indices = {0,1,2,0,2,3};
> HEMesh mesh(indices, 3);
> // ...
> }
> ```
- boundary polygon is `nullptr` or use `HEMesh<...>::P::IsBoundary(polygon)` to avoid literal value