8#include <kernel/geometry/mesh_part.hpp> 
    9#include <kernel/shape.hpp> 
   10#include <kernel/util/string.hpp> 
   11#include <kernel/util/tiny_algebra.hpp> 
   13#if defined(FEAT_HAVE_CGAL) || defined(DOXYGEN) 
   55    template<
typename DT_>
 
  145    template<typename MeshType_>
 
  146    static 
CGALWrapper<typename MeshType_::CoordType> cgal_wrapper_from_mesh(const MeshType_& mesh, const 
MeshPart<MeshType_>& part)
 
  148      using MeshType = MeshType_;
 
  149      using DT = 
typename MeshType::CoordType;
 
  150      using ShapeType = 
typename MeshType::ShapeType;
 
  156      static_assert(ShapeType::dimension == 3);
 
  158      std::vector<PointType> vertices;
 
  159      vertices.reserve(part.get_num_entities(0));
 
  162      const auto& vertex_set = mesh.get_vertex_set();
 
  163      const TargetSet& vts = part.template get_target_set<0>();
 
  164      for(
Index i(0); i < part.get_num_entities(0); i++)
 
  166        vertices.push_back(vertex_set[vts[i]]);
 
  170      std::vector<std::array<Index, 3>> faces;
 
  172      const auto& v_at_f = mesh.template get_index_set<2, 0>();
 
  173      const TargetSet& fts = part.template get_target_set<2>();
 
  174      const Index num_mesh_faces = part.get_num_entities(2);
 
  176      if constexpr(std::is_same_v<ShapeType, Shape::Hexahedron>)
 
  179        faces.reserve(2 * num_mesh_faces);
 
  181      if constexpr(std::is_same_v<ShapeType, Shape::Tetrahedron>)
 
  184        faces.reserve(num_mesh_faces);
 
  187      std::array<Index, vertices_per_face> vs;
 
  188      for(
Index i(0); i < num_mesh_faces; i++)
 
  190        for(
int j(0); j < vertices_per_face; j++)
 
  193          Index v = v_at_f(fts[i], j);
 
  206        if constexpr(std::is_same_v<ShapeType, Shape::Hexahedron>)
 
  208          faces.push_back({vs[0], vs[1], vs[2]});
 
  209          faces.push_back({vs[3], vs[2], vs[1]});
 
  211        if constexpr(std::is_same_v<ShapeType, Shape::Tetrahedron>)
 
  213          faces.push_back({vs[0], vs[1], vs[2]});
 
Wrapper for the CGAL Library.
void _init_wrapper()
initializes tree and inside tester with already initialized polyhedron
void transform(const TransformMatrix &trafo_mat, const PointType &translation, DataType scale=DataType(1))
bool point_inside(DataType x, DataType y, DataType z) const
Check whether a point is inside the Polyhedron defined at objects' construction.
bool intersects_line(const PointType &a, const PointType &b) const
tests whether the cgal mesh intersects with the line segment a->b
void _delete_tree()
Delete tree, which also requires to delete the inside tester.
DataType squared_distance(DataType x, DataType y, DataType z) const
Returns the minimun squared distance between the query point and all input primitives defined at obje...
std::size_t bytes() const
Returns the size in bytes.
CGALFeatureNetwork detect_features(DataType critical_angle)
Returns a vector of all feature vertices defined at objects' construction.
CGALWrapper(const CGALWrapper &)=delete
rule of five
PointType closest_point(const PointType &point) const
Returns the nearest point regarding on all input primitives defined at objects' construction.
DataType squared_distance_to_feature(const CGALFeature &f, const PointType &p) const
Returns the minimum squared distance between the query point and the given feature.
bool point_not_outside(DataType x, DataType y, DataType z) const
Check whether a point is inside or on the boundary of the Polyhedron defined at objects' construction...
PointType point(std::uint32_t idx) const
Returns the point of the surface mesh with the given index.
void _parse_mesh(std::istream &file, CGALFileMode file_mode)
read in stream in prescibed file format and preprocess search tree for in/out test
PointType closest_point_on_feature(const CGALFeature &f, const PointType &p) const
Returns the closest point closest to p on the given feature.
Class template for partial meshes.
Index get_num_entities() const
Returns the number of entities.
String class implementation.
Tiny Matrix class template.
Tiny Vector class template.
std::vector< CGALFeature > CGALFeatureNetwork
A FeatureNetwork is a list of features.
std::vector< std::uint32_t > CGALFeature
A feature is an edge-path on a surface mesh, stored as a list of vertex indices.
@ other
generic/other permutation strategy
std::uint64_t Index
Index data type.
Face traits tag struct template.