Subject: CGAL users discussion list
List archive
- From: Kim <>
- To:
- Subject: [cgal-discuss] Hybrid mesh bounded by polyhedral domain
- Date: Sun, 18 Oct 2020 11:52:11 -0500 (CDT)
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
- Ironport-phdr: 9a23:ieDAyh2mNKzUIQ2WsmDT+DRfVm0co7zxezQtwd8ZseIVLfad9pjvdHbS+e9qxAeQG9mCtLQa2qGH4ujJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVhjexe7J/IRG5oQjVssQdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnZhMJwkqxVow+vqBNjzIDbe4yVKPhzcr/Bcd8GWWZNQMBcXDFBDIOmaIsPCvIMM+NZr4n4ulADqh6+BQi2COzzzT9InGX20rM90+g7DQHJwgkgH8oJsHTOttr1MLwfUeeozKnUyTXDaPRW2TTn5IfUdRAhpOiBULRtesXe1UchDRnKjkmMqYP7JTOV0PwAvmqG4+Z8Wu+ihW4ppgJyrzWtxsohlI3Eip4Vx13E6Sl0xIQ4KN2mREB0f9OpEptduiOZOodoQ84vQGFmtSUmx7AApJW1ci8KyJE9yB7ebfyKa46I7Qj4W+mKJTd3mmhpd664hxa390Wr1+7yVtGs3VpXqidIlsPAu34O2hDJ6cWKS+Fx80ag1DuJygvd8PtLIVoumqreM5MhwqA/lp4UsUnbGC/7l1/6jKmMeUo/4eeo7/robq/6qZ+bMo94kgD+MqIwlcyjGek0LwwDUmyB9emy17Dv5070TbRQgvA3k6TVqJXaKt4apq69DQ9VyIEj6xOnAjej0dQUh2UILFVfeBKdkYfpPEvCIOzmAve6m1Ssly1ryOrCPrD6BZXNM2TDkLPmfbZ66E5Q0hY8zdda555MELEOPOrzWlPttNzfFhI2LwO0zPzjCNlky4weWHmPDbOEMKPJql+F/fkvIumJZI8NojnxMfkl5/j0jX84g1ARZ6ep3YFEIEy/S/9pKkHcbXv3icoaCk8LuBA/Rarkkg6sSzlWMlWzWupo4zB9A4W8F4rEAJyghaSGxi6/NppLemRBDVPKGnDtIdbXE8wQYT6fd5cy2gcPUqKsHtd4iUOe8TTiwr8iFdL6vzUCvMu4ht9o++nUkhJ0/jtxXZzEjjO9Clpsl2ZNfAcYmaBypUsklwWFje5+ivZSEdEV7PRMAF5jZMzsitdiAtW3YTrvO9KASVKoWNKjWGpjSc8tx9gJYAB2HNDw1R0=
Dear developers and users,
I am trying to use the hybrid mesh mode of CGAL and I have two questions
regarding this. In the image bellow you will see a spheroid and a sphere.
The sphere is given by a triangulation while the spheroid is defined as an
implicit function.
<http://cgal-discuss.949826.n4.nabble.com/file/t376247/cgal_hybrid.png>
1) I would like the spheroids influence to be limited to the domain of the
sphere, i.e. only get the dark and light blue mesh on the right image with
the separation between them dictated by the spheroid (preferable with a nice
clean cut at the outer boundary). The issue I am having is that while I am
able to deactivate the orange surface on the inside of the sphere with:
//intersection with implicit domain
Implicit_domain::Intersection implicit_inter =
r_domain_.implicit_domain.construct_intersection_object()(query);
//if found, return it
if(get<2>(implicit_inter) != 0) {
const Point_3 inter_point = get<0>(implicit_inter);
if( !r_domain_.implicit_domain.is_in_domain_object()(inter_point)) {
return Intersection(inter_point, 2, get<2>(implicit_inter));
}
}
the same logic does not seem to work to deactivate the outside orange
surface of the sphere.
2) How I can activate the non-manifold tag when using such a hybrid meshes
as just adding it to the make_mesh_3 call does not seem to be the way to do
it.
Bellow you will find the code I am using to construct the hybrid domain at
the moment. Hopefully someone can enlighten me whether this things are
possible, and if they are, how I can accomplish them.
Kind regards,
Kim
/* CGAL types */
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point_3;
typedef Kernel::Sphere_3 Sphere_3;
// 3D volume meshing (from implicit domain)
typedef CGAL::Labeled_mesh_domain_3<Kernel> Implicit_domain;
typedef CGAL::Mesh_triangulation_3<Implicit_domain, CGAL::Default,
Concurrency_tag>::type VTr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<VTr> C3t3;
typedef CGAL::Mesh_criteria_3<VTr> Mesh_criteria;
// 3D volume meshing (from polyhedron domain with features)
typedef CGAL::Polyhedral_mesh_domain_with_features_3<Kernel>
F_Polyhedron_domain;
typedef CGAL::Mesh_polyhedron_3<Kernel>::type F_Polyhedron;
typedef CGAL::Mesh_triangulation_3<F_Polyhedron_domain, CGAL::Default,
Concurrency_tag>::type F_VTr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<F_VTr,
F_Polyhedron_domain::Corner_index, F_Polyhedron_domain::Curve_index> F_C3t3;
typedef CGAL::Mesh_criteria_3<F_VTr> F_Mesh_criteria;
//
class Hybrid_domain {
const Implicit_domain &implicit_domain;
const Polyhedron_domain &polyhedron_domain;
public:
Hybrid_domain(const Implicit_domain &implicit_domain, const
Polyhedron_domain &polyhedron_domain)
: implicit_domain(implicit_domain),
polyhedron_domain(polyhedron_domain) {}
// types required by the 'MeshDomain_3' concept
typedef int Surface_patch_index;
typedef int Subdomain_index;
typedef int Index;
typedef K R;
typedef K::Point_3 Point_3;
typedef std::tuple<Point_3, Index, int> Intersection;
// Set bounding box of the hybrid domain
CGAL::Bbox_3 bbox() const {
return implicit_domain.bbox() + polyhedron_domain.bbox();
}
// ???
struct Construct_initial_points {
Construct_initial_points(const Hybrid_domain& domain) :
r_domain_(domain) {}
template<class OutputIterator>
OutputIterator operator()(OutputIterator pts, const int n = 20) const {
//construct initial points on implicit domain
typedef Implicit_domain::Index Implicit_Index;
std::vector<std::pair<Point_3, Implicit_Index> >
implicit_points_vector;
Implicit_domain::Construct_initial_points cstr_implicit_initial_points
=
r_domain_.implicit_domain.construct_initial_points_object();
cstr_implicit_initial_points(std::back_inserter(implicit_points_vector),
n/2);
for(std::size_t i = 0, end = implicit_points_vector.size(); i<end;
++i) {
*pts++ = std::make_pair(implicit_points_vector[i].first, 2);
}
//construct initial points on polyhedral domain
typedef Polyhedron_domain::Index Polyhedron_Index;
std::vector<std::pair<Point_3, Polyhedron_Index> >
polyhedron_points_vector;
Polyhedron_domain::Construct_initial_points
cstr_polyhedron_initial_points =
r_domain_.polyhedron_domain.construct_initial_points_object();
cstr_polyhedron_initial_points(std::back_inserter(polyhedron_points_vector),
n/2);
for(std::size_t i = 0, end = polyhedron_points_vector.size(); i<end;
++i) {
*pts++ = std::make_pair(polyhedron_points_vector[i].first, 1);
}
return pts;
}
private:
const Hybrid_domain& r_domain_;
}; // end Construct_initial_points_object
Construct_initial_points construct_initial_points_object() const {
return Construct_initial_points(*this);
}
// Check inclusion of query points (basically label things!!!)
struct Is_in_domain {
Is_in_domain(const Hybrid_domain &domain) : r_domain_(domain) {}
boost::optional<Subdomain_index> operator()(const K::Point_3 &p)
const {
boost::optional<Subdomain_index> implicit_subdomain_index;
boost::optional<Subdomain_index> polyhedron_subdomain_index;
implicit_subdomain_index =
r_domain_.implicit_domain.is_in_domain_object()(p);
polyhedron_subdomain_index =
r_domain_.polyhedron_domain.is_in_domain_object()(p);
if(implicit_subdomain_index && polyhedron_subdomain_index) {
return 3;
} else if (implicit_subdomain_index) {
return 4;
} else if (polyhedron_subdomain_index) {
return 5;
} else {
return r_domain_.polyhedron_domain.is_in_domain_object()(p);
}
}
private:
const Hybrid_domain &r_domain_;
};
Is_in_domain is_in_domain_object() const { return Is_in_domain(*this); }
//
struct Construct_intersection {
//
Construct_intersection(const Hybrid_domain &domain) : r_domain_(domain)
{}
//
template <typename Query>
Intersection operator()(const Query &query) const {
using boost::get;
//intersection with polyhedral domain
Polyhedron_domain::Intersection polyhedron_inter =
r_domain_.polyhedron_domain.construct_intersection_object()(query);
//if found, return it
if(get<2>(polyhedron_inter) != 0) {
const Point_3 inter_point = get<0>(polyhedron_inter);
return Intersection(inter_point, 1, get<2>(polyhedron_inter));
}
//intersection with implicit domain
Implicit_domain::Intersection implicit_inter =
r_domain_.implicit_domain.construct_intersection_object()(query);
//if found, return it
if(get<2>(implicit_inter) != 0) {
const Point_3 inter_point = get<0>(implicit_inter);
if( !r_domain_.implicit_domain.is_in_domain_object()(inter_point)) {
// Deactivate orange inside
return Intersection(inter_point, 2, get<2>(implicit_inter));
}
}
//no intersection found
return Intersection();
}
private:
const Hybrid_domain &r_domain_;
}; // end Construct_intersection
Construct_intersection construct_intersection_object() const {
return Construct_intersection(*this);
}
//Index types converters
Index index_from_surface_patch_index(const Surface_patch_index &index)
const {
return index;
}
Index index_from_subdomain_index(const Subdomain_index &index) const {
return index;
}
Surface_patch_index surface_patch_index(const Index &index) const {
return index;
}
Subdomain_index subdomain_index(const Index& index) const {
return index;
}
}; // end class Hybrid_domain
// 3D volume meshing (from hybrid domain with features)
typedef CGAL::Mesh_domain_with_polyline_features_3<Hybrid_domain> H_Domain;
typedef
CGAL::Mesh_triangulation_3<H_Domain,CGAL::Default,Concurrency_tag>::type
H_VTr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<H_VTr> H_C3t3;
typedef CGAL::Mesh_criteria_3<H_VTr> H_Mesh_criteria;
typedef H_Mesh_criteria::Edge_criteria H_Edge_criteria;
typedef H_Mesh_criteria::Facet_criteria H_Facet_criteria;
typedef H_Mesh_criteria::Cell_criteria H_Cell_criteria;
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/
- [cgal-discuss] Hybrid mesh bounded by polyhedral domain, Kim, 10/18/2020
Archive powered by MHonArc 2.6.19+.