#pragma once #include #include #include /** * A plane is defined by the barycentric plane equation: * f0 * b0 + f1 * b1 + f2 * b2 + f3 * b3 = 0 // For 3D * where the b's are the barycentric variables, and f's are the * plane equation coefficients. We store the f's for each plane. */ using plane_t = std::array; /** * A point is represented as the intersection of planes. We store the index * of the plane here. */ using point_t = std::array; template using stl_vector_mp = std::vector>; template using tbb_vector_mp = tbb::concurrent_vector>; static constexpr uint32_t INVALID_INDEX = std::numeric_limits::max(); struct arrangement_t { /* vertex descriptor */ stl_vector_mp vertices{}; /* face descriptor */ struct face_descriptor { stl_vector_mp vertices{}; ///< An ordered list of boundary vertices. The face is always oriented ///< counterclockwise when viewed from the positive side of the supporting plane. uint32_t supporting_plane{INVALID_INDEX}; ///< Plane index of the supporting plane. uint32_t positive_cell{INVALID_INDEX}; ///< The cell index on the positive side of this face. uint32_t negative_cell{INVALID_INDEX}; ///< The cell index on the negative side of this face. }; stl_vector_mp faces{}; ///< A set of boundary vertex indices in no particular order. /* cell descriptor */ struct cell_descriptor { stl_vector_mp faces{}; }; stl_vector_mp cells{}; ///< A set of boundary face indices in no particular order. /* Note: the following structure is only non-empty if input planes contain duplicates. */ stl_vector_mp unique_plane_indices{}; stl_vector_mp> unique_planes{}; stl_vector_mp unique_plane_orientations{}; }; IA_API bool load_lut(); IA_API void lut_print_test(); IA_API arrangement_t compute_arrangement(const stl_vector_mp& planes);