-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvertex.hh
63 lines (46 loc) · 1.27 KB
/
vertex.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef __FLYWAVE_MESH_TOPO_VERTEX_HH__
#define __FLYWAVE_MESH_TOPO_VERTEX_HH__
#include <TopExp_Explorer.hxx>
#include <TopoDS_Vertex.hxx>
#include "shape.hh"
namespace flywave {
namespace topo {
class vertex_iterator;
class vertex : public shape {
public:
vertex() = default;
vertex(Standard_Real x, Standard_Real y, Standard_Real z);
vertex(const gp_Pnt &P);
virtual ~vertex() = default;
static vertex make_vertex(const gp_Pnt &P);
TopoDS_Vertex &value();
const TopoDS_Vertex &value() const;
operator const gp_Pnt() const;
virtual geometry_object_type type() const override {
return geometry_object_type::VertexType;
}
virtual shape copy(bool deep = true) const override;
vertex(TopoDS_Shape shp) : shape(shp) {}
vertex(const shape &v, TopoDS_Shape shp) : shape(v, shp) {}
protected:
friend class vertex_iterator;
friend class shape;
};
class vertex_iterator {
public:
TopExp_Explorer ex;
vertex_iterator(shape &arg) : ex(arg.value(), TopAbs_VERTEX) {}
void reset() { ex.ReInit(); }
boost::optional<vertex> next() {
if (ex.More()) {
vertex ret{ex.Current()};
ex.Next();
return {ret};
} else {
return boost::none;
}
}
};
} // namespace topo
} // namespace flywave
#endif // __FLYWAVE_MESH_TOPO_VERTEX_HH__