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

          Line data    Source code
       1             : """
       2             :     g = geomeytry(mesh)
       3             :     mesh = tessellation(g)
       4             : 
       5             : Get `Mesh` from [`AbstractGeometry`](@ref)
       6             : 
       7             : See also [`geometry`](@ref)
       8             : """
       9         181 : tessellation(g::AbstractGeometry) = g.mesh
      10             : 
      11             : #-----------------------------------------------------------------------------
      12             : 
      13           1 : positions(m::Mesh, x) = positions(geometry(m, x))
      14             : 
      15         228 : positions(g::AbstractGeometry) = maphandles(position(g))
      16             : 
      17         225 : positions(g::AbstractGeometry, f::FHnd) =
      18             :     positions(g, _istriangulation(g), f)
      19             : 
      20         224 : positions(g, ::IsTriangulation, f::FHnd) = positions(g).(triangle(g.mesh, f))
      21             : 
      22           1 : positions(g, ::NoTriangulation, f::FHnd) = positions(g).(vertices(g.mesh, f))
      23             : 
      24             : """
      25             :     fp = positions(mesh, x)
      26             : 
      27             :     g = geometry(mesh, x)
      28             : 
      29             :     fp = positions(g)
      30             :     x = fp(v)             # map VHnd to position
      31             : 
      32             : Create a functor that maps `v::VHnd` to stored [`position`](@ref).
      33             : 
      34             :     xs = positions(g, f)
      35             : 
      36             : Get positions of vertices of face `f` as 3-tuple for a triangulation
      37             : or vector.
      38             : 
      39             : See also [`geometry`](@ref), [`maphandles`](@ref), [`position`](@ref)
      40             : """ positions
      41             : 
      42       48797 : Base.position(g::AbstractGeometry) = _vpos(g)
      43             : 
      44         100 : Base.position(g::AbstractGeometry, v::VHnd) = position(g)[v]
      45             : 
      46             : """
      47             :     g = geometry(mesh, x)
      48             : 
      49             :     p = position(g)      # get attribute
      50             :     pv = position(g, v)  # get attribte element
      51             : 
      52             :     @assert p[v] == pv
      53             : 
      54             : Get position of vertex `v` given as vertex attribute `x`.
      55             : 
      56             : See also [`geometry`](@ref), [`positions`](@ref)
      57             : """ position
      58             : 
      59             : #-----------------------------------------------------------------------------
      60             : 
      61             : """
      62             :     g = geometry(mesh, ..., fnormal=...)
      63             : 
      64             :     fn = fnormals(g)
      65             :     nrm = fn(f)          # map FHnd to face normal
      66             : 
      67             : Create a functor that maps `f::FHnd` to stored [`fnormal`](@ref).
      68             : 
      69             : !!! warning "precondition"
      70             :     Requires `has_fnormal(g)`. Otherwise method missing.
      71             : 
      72             : See also [`geometry`](@ref), [`maphandles`](@ref), [`fnormal`](@ref)
      73             : """
      74       64512 : fnormals(g::AbstractGeometry) = maphandles(fnormal(g))
      75             : 
      76             : """
      77             :     g = geometry(mesh, ..., fnormal=...)
      78             :     fnrm = fnormal(g)
      79             : 
      80             : Get face normals attribute.
      81             : 
      82             : !!! warning "precondition"
      83             :     Requires `has_fnormal(g)`. Otherwise method missing.
      84             : 
      85             : See also  [`geometry`](@ref), [`fnormals`](@ref)
      86             : """
      87      129024 : fnormal(g::AbstractGeometry) = fnormal(g, _has_fn(g))
      88      129024 : fnormal(g::AbstractGeometry, ::HasFN) = _fnrm(g)
      89             : 
      90             : #-----------------------------------------------------------------------------
      91             : 
      92             : """
      93             :     g = geometry(mesh, ..., fnormal=...)
      94             : 
      95             :     vn = vnormals(g)
      96             :     nrm = vn(v)          # map VHnd to vertex normal
      97             : 
      98             : Create a functor that maps `v::VHnd` to stored [`vnormal`](@ref).
      99             : 
     100             : !!! warning "precondition"
     101             :     Requires `has_fnormal(g)`. Otherwise method missing.
     102             : 
     103             : See also [`geometry`](@ref), [`maphandles`](@ref), [`vnormal`](@ref)
     104             : """
     105       16136 : vnormals(g::AbstractGeometry) = maphandles(vnormal(g))
     106             : 
     107             : """
     108             :     g = geometry(mesh, ..., vnormal=...)
     109             :     vnrm = vnormal(g)
     110             : 
     111             : Get vertex normals attribute.
     112             : 
     113             : !!! warning "precondition"
     114             :     Requires `has_fnormal(g)`. Otherwise method missing.
     115             : 
     116             : See also  [`geometry`](@ref), [`vnormals`](@ref)
     117             : """
     118       32272 : vnormal(g::AbstractGeometry) = vnormal(g, _has_vn(g))
     119       32272 : vnormal(g::AbstractGeometry, ::HasVN) = _vnrm(g)

Generated by: LCOV version 1.16