LCOV - code coverage report
Current view: top level - src - corenavigation.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 41 46 89.1 %
Date: 2025-07-10 13:12:25 Functions: 0 0 -

          Line data    Source code
       1      633240 : function opposite(mesh::Mesh, h::HHnd)
       2      633240 :     @massert isused(mesh, h)
       3      633240 :     opposite(h)
       4             : end
       5             : 
       6      633240 : function opposite(h::HHnd)
       7      633240 :     @massert h != NoH
       8      633240 :     i = Int(h)
       9      633240 :     ((i % 2) == 0) && return HHnd(i - 1)
      10      316318 :     HHnd(i + 1)
      11             : end
      12             : 
      13             : """
      14             :     ho = opposite(mesh, h::HHnd)
      15             : 
      16             : Get half-edge "opposite" to `h`, i.e., with inverse orientation.
      17             : """ opposite
      18             : 
      19             : """
      20             :     f = face(mesh, h::HHnd)
      21             : 
      22             : Get face spanned by half-edge `h` or `NoH` if `h` is boundary.
      23             : """
      24      582653 : function face(mesh::Mesh, h::HHnd)
      25      582653 :     @massert isused(mesh, h)
      26      582653 :     link(hattr(mesh))[h].f ::FHnd
      27             : end
      28             : 
      29     1015159 : function next(mesh::Mesh, h::HHnd)
      30     1015159 :     @massert isused(mesh, h)
      31     1015159 :     link(hattr(mesh))[h].next :: HHnd
      32             : end
      33             : 
      34             : """
      35             :     ph = prev(mesh, h::HHnd)
      36             : 
      37             : Get previous half-edge within face (in counter-clockwise order).
      38             : 
      39             : See also [`next`](@ref)
      40             : """
      41      228757 : function prev(mesh::Mesh, h::HHnd)
      42      228757 :     @massert isused(mesh, h)
      43      228757 :     link(hattr(mesh))[h].prev ::HHnd
      44             : end
      45             : 
      46        1678 : next(mesh::Mesh, ::Val{:ccw}, h::HHnd) = next(mesh, h) :: HHnd
      47             : 
      48           0 : next(mesh::Mesh, ::Val{:cw}, h::HHnd) = prev(mesh, h) :: HHnd
      49             : 
      50           0 : next(mesh::Mesh, orientation::Symbol, h::HHnd) =
      51             :     next(mesh, Val(orientation), h)
      52             : 
      53             : """
      54             :     nh = next(mesh, h::HHnd[,:ccw])   # next
      55             :     ph = next(mesh, h::Hnd, :cw)      # previous
      56             : 
      57             : Get next half-edge within face in counter-clockwise (`:ccw`)
      58             : order. The next edge in clockwise order (`cw`) equals is the previous
      59             : edge.
      60             : 
      61             : See also [`prev`](@ref)
      62             : """
      63             : next
      64             : 
      65      364747 : nextinstar(mesh::Mesh, h::HHnd) = next(mesh, opposite(mesh, h)) :: HHnd
      66             : 
      67             : """
      68             :     ph = previnstar(mesh, h)
      69             : 
      70             : Get previous edge in star around `source(h)`.
      71             : 
      72             : See also [`ccw`](@ref), [`nextinstar`](@ref)
      73             : """
      74           4 : previnstar(mesh::Mesh, h::HHnd) = opposite(mesh, prev(mesh, h)) :: HHnd
      75             : 
      76      291443 : nextinstar(mesh::Mesh, ::Val{:cw}, h::HHnd) = nextinstar(mesh, h)
      77             : 
      78           0 : nextinstar(mesh::Mesh, ::Val{:ccw}, h::HHnd) = previnstar(mesh, h)
      79             : 
      80           0 : nextinstar(mesh::Mesh, orientation::Symbol, h::HHnd) =
      81             :     nextinstar(mesh, Val(orientation), h)
      82             : 
      83             : """
      84             :     nh = nextinstar(mesh[, :cw], h)
      85             :     np = nextinstar(mesh, :ccw, h)   # previnstar
      86             : 
      87             : Get next edge in star turning clockwise (`:cw`) around
      88             : `source(h)`. The next edge when turning in counter-clockwise
      89             : orientation (`:ccw`) is equal to the previous edge
      90             : [`previnstar`](@ref).
      91             : 
      92             : See also [`cw`](@ref), [`previnstar`](@ref)
      93             : """ nextinstar
      94             : 
      95             : """
      96             :     v = destination(mesh, h::HHnd)
      97             : 
      98             : Get destination vertex of `h`: half-edge is incident to `v`.
      99             : 
     100             : See also [`source`](@ref)
     101             : """
     102     1129227 : function destination(mesh::Mesh, h::HHnd)
     103     1129227 :     @massert isused(mesh, h)
     104     1129227 :     link(hattr(mesh))[h].v ::VHnd
     105             : end
     106             : 
     107             : """
     108             :     v = source(mesh, h::HHnd)
     109             : 
     110             : Get source vertex of `h`: half-edge is outgoing from `v`.
     111             : 
     112             : See also [`destination`](@ref)
     113             : """
     114      218834 : source(mesh::Mesh, h::HHnd) = destination(mesh, opposite(mesh, h))
     115             : 
     116             : """
     117             : Synonym for [`nextinstar`](@ref): turn clockwise
     118             : """
     119       73302 : cw(mesh::Mesh, h::HHnd) = nextinstar(mesh, h)
     120             : 
     121             : """
     122             : Synonym for [`previnstar`](@ref): turn counter-clockwise
     123             : """
     124           2 : ccw(mesh::Mesh, h::HHnd) = previnstar(mesh, h)
     125             : 
     126       29775 : halfedge(mesh::Mesh, v01::Tuple{VHnd, VHnd}) = halfedge(mesh, v01...)
     127             : 
     128       29831 : function halfedge(mesh::Mesh, v0::VHnd, v1::VHnd)
     129       29831 :     @massert isused(mesh, v0) && isused(mesh, v1)
     130       29831 :     h = halfedge(mesh, v0)
     131             : 
     132       29831 :     (h == NoH) && return h
     133             : 
     134       24560 :     @massert isused(mesh, h)
     135       24560 :     h0 = h
     136             : 
     137       58694 :     while true
     138       58694 :         (destination(mesh, h) == v1) && return h
     139       43885 :         h = cw(mesh, h)
     140       43885 :         (h == h0) && break
     141       34134 :     end
     142             : 
     143           0 :     NoH
     144             : end
     145             : 
     146             : """
     147             :     h = halfedge(mesh, (v0, v1))
     148             :     h = halfedge(mesh, v0, v1)
     149             : 
     150             : Find half-edge from vertex `v0` to vertex `v1` or return `NoH` if
     151             : there is no such half-edge.
     152             : 
     153             : See also [`edge`](@ref)
     154             : """ halfedge
     155             : 
     156          15 : edge(mesh::Mesh, v0::VHnd, v1::VHnd) = edge(halfedge(mesh, v0, v1))
     157             : 
     158           1 : edge(mesh::Mesh, v01::Tuple{VHnd, VHnd}) = edge(mesh, v01...)
     159             : 
     160             : """
     161             :     e = edge(mesh, (v0, v1))
     162             :     e = edge(mesh, v0, v1)
     163             : 
     164             : Find edge spanned by vertices `v0` and `v1` or return `NoE` if
     165             : there is no such edge.
     166             : 
     167             : See also [`halfedge`](@ref)
     168             : """ edge

Generated by: LCOV version 1.16