Line data Source code
1 24899 : function _sethalfedge!(mesh, v::VHnd, h::HHnd)
2 24899 : link(vattr(mesh))[v] = h
3 : end
4 :
5 31 : function _sethalfedge!(mesh, f::FHnd, h::HHnd)
6 31 : link(fattr(mesh))[f] = h
7 : end
8 :
9 23 : function _setvertex!(mesh, h::HHnd, v::VHnd)
10 23 : he = link(hattr(mesh))[h]
11 23 : link(hattr(mesh))[h] = HalfEdge(v, he.f, he.next, he.prev)
12 : end
13 :
14 29963 : function _setface!(mesh, h::HHnd, f::FHnd)
15 29963 : he = link(hattr(mesh))[h]
16 29963 : link(hattr(mesh))[h] = HalfEdge(he.v, f, he.next, he.prev)
17 : end
18 :
19 49671 : function _setnexthalfedge!(mesh, prv::HHnd, nxt::HHnd)
20 49671 : hp = link(hattr(mesh))[prv]
21 49671 : link(hattr(mesh))[prv] = HalfEdge(hp.v, hp.f, nxt, hp.prev)
22 :
23 49671 : hn = link(hattr(mesh))[nxt]
24 49671 : link(hattr(mesh))[nxt] = HalfEdge(hn.v, hn.f, hn.next, prv)
25 : end
26 :
27 14 : _setunused!(mesh::Mesh, v::VHnd) = setunused!(vattr(mesh), v)
28 :
29 44 : _setunused!(mesh::Mesh, f::FHnd) = setunused!(fattr(mesh), f)
30 :
31 0 : _setunused!(mesh::Mesh, h::HHnd) = @assert false "half-edges depend on edges"
32 :
33 53 : _setunused!(mesh::Mesh, e::EHnd) = setunused!(eattr(mesh), e)
34 :
35 : #-----------------------------------------------------------------------------
36 :
37 15024 : function _create_edge(mesh::Mesh, v0::VHnd, v1::VHnd)
38 15024 : @massert v0 != v1
39 :
40 15024 : n = pushattr!(eattr(mesh))
41 :
42 : # NOTE: Half-edges are not actively managed: they depend on (managed) edges.
43 : # => pushattr! on "unmanaged" attrs(...)
44 15024 : hs = attrs(hattr(mesh))
45 15024 : pushattr!(hs)
46 15024 : pushattr!(hs)
47 :
48 15024 : h0, h1 = halfedges(EHnd(n))
49 :
50 15024 : link = hs[:_link]
51 15024 : link[h0] = HalfEdge(v1)
52 15024 : link[h1] = HalfEdge(v0)
53 :
54 15024 : h0
55 : end
56 :
57 5150 : function _adjustoutgoinghalfedge!(mesh, v::VHnd)
58 5150 : h = halfedge(mesh, v)
59 5150 : (h == NoH) && return
60 :
61 5138 : hend = h
62 :
63 29523 : while !isboundary(mesh, h)
64 29415 : h = cw(mesh, h)
65 29415 : (h == hend) && return
66 24385 : end
67 :
68 108 : _sethalfedge!(mesh, v, h)
69 : end
|