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

          Line data    Source code
       1             : """
       2             : Bind a mesh to an object that additionally provides attributes with
       3             : vertex positions and optionally face normals and vertex normals for
       4             : evaluation and storage of geometry queries.
       5             : 
       6             : See also [`geometry`](@ref), [`triangulated`](@ref)
       7             : """
       8             : abstract type AbstractGeometry end
       9             : 
      10             : #
      11             : # traits
      12             : #
      13             : # (following THTT, see e.g.,
      14             : #  https://ahsmart.com/pub/holy-traits-design-patterns-and-best-practice-book/)
      15             : #
      16             : 
      17             : abstract type TriangulationTraits end
      18             : 
      19          65 : struct NoTriangulation <: TriangulationTraits end
      20          11 : struct IsTriangulation <: TriangulationTraits end
      21             : 
      22             : abstract type VPosTraits end
      23             : abstract type FNrmTraits end
      24             : abstract type VNrmTraits end
      25             : 
      26      145736 : struct HasVX <: VPosTraits end
      27             : struct NoVX <: VPosTraits end
      28             : 
      29      468039 : struct HasFN <: FNrmTraits end
      30       97143 : struct NoFN <: FNrmTraits end
      31             : 
      32       96828 : struct HasVN <: VNrmTraits end
      33       32296 : struct NoVN <: VNrmTraits end
      34             : 
      35           0 : _has_vx(::AbstractGeometry) = NoVX()
      36           0 : _has_fn(::AbstractGeometry) = NoFN()
      37           0 : _has_vn(::AbstractGeometry) = NoVN()
      38             : 
      39           0 : _istriangulation(::AbstractGeometry) =  NoTriangulation()
      40             : 
      41           0 : has_position(g::AbstractGeometry) = has_position(_has_vx(g))
      42           0 : has_position(::HasVX) = true
      43           0 : has_position(::NoVX) = false
      44             : 
      45             : """
      46             :     has_position(geometry(...))
      47             : 
      48             : Query vertex position traits.
      49             : 
      50             : See also [`geometry`](@ref)
      51             : """ has_position
      52             : 
      53          12 : has_fnormal(g::AbstractGeometry) = has_fnormal(_has_fn(g))
      54           0 : has_fnormal(::HasFN) = true
      55           0 : has_fnormal(::NoFN) = false
      56             : 
      57             : """
      58             :     has_fnormal(geometry(...))
      59             : 
      60             : Query face normal traits.
      61             : 
      62             : See also [`geometry`](@ref)
      63             : """ has_fnormal
      64             : 
      65             : 
      66          12 : has_vnormal(g::AbstractGeometry) = has_vnormal(_has_vn(g))
      67           0 : has_vnormal(::HasVN) = true
      68           0 : has_vnormal(::NoVN) = false
      69             : 
      70             : 
      71             : """
      72             :     has_vnormal(geometry(...))
      73             : 
      74             : Query vertex normal traits.
      75             : 
      76             : See also [`geometry`](@ref)
      77             : """ has_vnormal
      78             : 
      79           0 : istriangulation(g::AbstractGeometry) = istriangulation(_istriangulation(g))
      80           0 : istriangulation(::IsTriangulation) = true
      81           0 : istriangulation(::NoTriangulation) = false
      82             : 
      83             : """
      84             :     istriangulation(geometry(...))
      85             : 
      86             : Query type traits: Is triangulation or general polygonal mesh?
      87             : 
      88             : !!! note
      89             :     This method relies only on *static* type information. It does
      90             :     **not** check face [`degree`](@ref)s!
      91             : 
      92             : See also [`geometry`](@ref)
      93             : """ istriangulation

Generated by: LCOV version 1.16