590 #ifndef vtkSurfaceNets3DNonManifoldCases_h
591 #define vtkSurfaceNets3DNonManifoldCases_h
593 #include "vtkFiltersCoreModule.h"
594 #include "vtkSetGet.h"
600 VTK_ABI_NAMESPACE_BEGIN
601 #define VTK_SURFACE_NETS_3D_ALWAYS_SPLIT_CASES_1_3
606 #ifdef VTK_SURFACE_NETS_3D_SUPPORT_ALL_SOLVABLE_VARIATIONS_FOR_CASE_8
607 static constexpr uint8_t MaxTableIndex = 9;
609 static constexpr uint8_t MaxTableIndex = 8;
660 NonManifoldIndexUnsolvable = -1,
661 NonManifoldIndex0 = 0,
662 NonManifoldIndex1 = 1,
663 NonManifoldIndex2 = 2,
664 NonManifoldIndex3 = 3,
665 NonManifoldIndex4 = 4,
666 NonManifoldIndex5 = 5,
667 NonManifoldIndex6 = 6,
668 NonManifoldIndex7 = 7,
669 NonManifoldIndex8 = 8,
670 #ifdef VTK_SURFACE_NETS_3D_SUPPORT_ALL_SOLVABLE_VARIATIONS_FOR_CASE_8
671 NonManifoldIndex9 = 9,
739 static auto GetNonManifoldTableIndex(
const VoxelNeighborhood<T>& voxelNeighborhood) -> int8_t;
752 return EdgeCaseOffsets[edgeCase + 1] - EdgeCaseOffsets[edgeCase];
766 if (tableIndex < 0 || tableIndex >= GetNumberOfNonManifoldCases(edgeCase))
770 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].NonManifoldCase;
786 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].VoxelCase;
802 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].IsHomogeneous;
817 constexpr uint8_t pointsPerNonManifoldCase[12] = {
831 return pointsPerNonManifoldCase[nonManifoldCase];
851 template <u
int8_t QuadId>
855 static_assert(QuadId < 12,
"QuadId must be between 0 and 11 (inclusive)");
856 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].PointIndices[QuadId];
870 constexpr uint8_t subCasesPerNonManifoldCase[12] = {
884 return subCasesPerNonManifoldCase[nonManifoldCase];
897 EdgeCaseType edgeCase, int8_t tableIndex) ->
const std::array<EdgeCaseType, 4>&
899 static constexpr std::array<EdgeCaseType, 4> Empty{};
904 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].SubEdgeCases;
937 uint8_t numPoints, int8_t tableIndex) -> uint8_t
944 return tableIndex == ManifoldIndex ? 1 : 2;
946 return 3 + tableIndex;
950 return 3 + (MaxTableIndex + 1) + tableIndex;
954 return 3 + (MaxTableIndex + 1) + 2 + tableIndex;
984 #ifdef VTK_SURFACE_NETS_3D_SUPPORT_ALL_SOLVABLE_VARIATIONS_FOR_CASE_8
985 constexpr
StateInfo InfoTable[17] = { { 0, EmptyIndex },
986 { 1, ManifoldIndex },
987 { 1, NonManifoldIndexUnsolvable },
989 { 3, NonManifoldIndex0 }, { 3, NonManifoldIndex1 }, { 3, NonManifoldIndex2 },
990 { 3, NonManifoldIndex3 }, { 3, NonManifoldIndex4 }, { 3, NonManifoldIndex5 },
991 { 3, NonManifoldIndex6 }, { 3, NonManifoldIndex7 }, { 3, NonManifoldIndex8 },
992 { 3, NonManifoldIndex9 },
994 { 4, NonManifoldIndex0 }, { 4, NonManifoldIndex1 },
996 { 5, NonManifoldIndex0 }, { 5, NonManifoldIndex1 } };
998 constexpr
StateInfo InfoTable[16] = { { 0, EmptyIndex },
999 { 1, ManifoldIndex },
1000 { 1, NonManifoldIndexUnsolvable },
1002 { 3, NonManifoldIndex0 }, { 3, NonManifoldIndex1 }, { 3, NonManifoldIndex2 },
1003 { 3, NonManifoldIndex3 }, { 3, NonManifoldIndex4 }, { 3, NonManifoldIndex5 },
1004 { 3, NonManifoldIndex6 }, { 3, NonManifoldIndex7 }, { 3, NonManifoldIndex8 },
1006 { 4, NonManifoldIndex0 }, { 4, NonManifoldIndex1 },
1008 { 5, NonManifoldIndex0 }, { 5, NonManifoldIndex1 } };
1010 return InfoTable[state];
1027 static VTK_ALWAYS_INLINE
auto GetManifoldSubVoxelCases(
1028 EdgeCaseType edgeCase, int8_t tableIndex) ->
const std::array<VoxelCaseType, 4>&
1030 return NonManifoldMetadata[EdgeCaseOffsets[edgeCase] + tableIndex].SubVoxelCases;
1033 static const std::array<uint16_t, 4097>& EdgeCaseOffsets;
1034 static const std::array<NonManifoldCaseMetadata, 3736>& NonManifoldMetadata;
1036 VTK_ABI_NAMESPACE_END
1038 #endif // vtkSurfaceNets3DNonManifoldCases_h
unsigned char VoxelCaseType
static VTK_ALWAYS_INLINE auto GetNonManifoldCase(EdgeCaseType edgeCase, int8_t tableIndex) -> NonManifoldCaseType
Given an edge case and the table index for the non-manifold case, returns the corresponding non-manif...
std::array< T, 8 > Labels
static VTK_ALWAYS_INLINE auto GetManifoldSubEdgeCases(EdgeCaseType edgeCase, int8_t tableIndex) -> const std::array< EdgeCaseType, 4 > &
Returns the manifold sub-edge cases for a given edge case and table index.
unsigned short EdgeCaseType
static VTK_ALWAYS_INLINE auto GetNonManifoldBasicVoxelCase(EdgeCaseType edgeCase, int8_t tableIndex) -> VoxelCaseType
Given an edge case and the table index for the non-manifold case, returns the corresponding basic vox...
VTKACCELERATORSVTKMDATAMODEL_EXPORT vtkIdType IsHomogeneous(vtkCellArray *cells)
Provides utilities to identify vtkSurfaceNets3D's edge-cases that can lead to non-manifold output geo...
static constexpr VTK_ALWAYS_INLINE auto ComputeState(uint8_t numPoints, int8_t tableIndex) -> uint8_t
Computes a state code from a point count and table index using a variable-width linear mapping...
static constexpr VTK_ALWAYS_INLINE auto GetStateInfo(uint8_t state) -> StateInfo
Decodes both the number of duplicate points and the metadata table index from a state code in a singl...
static constexpr VTK_ALWAYS_INLINE auto GetNumberOfPoints(NonManifoldCaseType nonManifoldCase) -> uint8_t
Given the non-manifold case, returns the number of duplicate points.
Holds the local configuration of the 8 voxels surrounding a triad point in the grid.
static VTK_ALWAYS_INLINE auto GetNonManiFoldPointIndex(EdgeCaseType edgeCase, int8_t tableIndex) -> int8_t
Given a quad id (bits 0–3 for yz-plane quads, 4–7 for xz-plane, 8–11 for xy-plane), and the table index for the non-manifold case, returns the duplicate point index for that quad in the current non-manifold configuration.
Decoded metadata for a state: number of points to generate and the corresponding non-manifold table i...
static VTK_ALWAYS_INLINE auto GetNumberOfNonManifoldCases(EdgeCaseType edgeCase) -> uint8_t
Returns the number of non-manifold metadata entries for the given edge case.
unsigned char NonManifoldCaseType
static constexpr VTK_ALWAYS_INLINE auto GetNumberOfManifoldSubCases(NonManifoldCaseType nonManifoldCase) -> uint8_t
Given the non-manifold case, returns the number of manifold sub-cases.
static VTK_ALWAYS_INLINE auto IsNonManifoldCaseHomogeneous(EdgeCaseType edgeCase, int8_t tableIndex) -> NonManifoldCaseType
Given an edge case and the table index for the non-manifold case, returns whether it's homogeneous or...