Subject: CGAL users discussion list
List archive
- From: Jack Lee <>
- To: <>
- Subject: [cgal-discuss] mesh_domain_with_polyline_features_3
- Date: Sat, 26 Oct 2013 11:34:20 +0100
Hello,
I am trying to generate a 3D mesh from multi-labelled images, with polylines to preserve the corners.
Currently I'm trying it with a synthetically generated image, which is a cylinder with a step increase in the diameter along its length. I've tried the code below, which builds and executes without problem, but it doesn't preserve the lines at all (see the screenshot). It's probably (hopefully) some simple mistake, but I can't seem to find it. Could somebody help please?
I will attach the image stack if someone is interested, but for now, the code looks like:
-----------------------------
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Labeled_image_mesh_domain_3<CGAL::Image_3,K> Mesh_domainImage;
typedef CGAL::Mesh_domain_with_polyline_features_3<Mesh_domainImage> Mesh_domain;
-----------------------------
// sizing field
Sizing_field size(4.5);
size.set_size((double) 2.0, 3, (double) 128.0);
C3t3 c3t3;
Mesh_criteria criteria(facet_angle=30, facet_size=4.5, facet_distance=5,
cell_radius_edge_ratio=2, cell_size=size);
std::cout << "reading " << image_src << "..." << std::endl;
CGAL::Image_3 image;
image.read(image_src.c_str());
Mesh_domain domain(image);
// Create the edges to preserve
Polylines polylines (1);
Polyline_3& polyline = polylines.front();
for(int i = 0; i < 360; ++i)
{
Point p (std::cos(i*CGAL_PI/180)*25+49, std::sin(i*CGAL_PI/180)*25+49, 49);
polyline.push_back(p);
}
polyline.push_back(polyline.front()); // close the line
// Insert edge in domain
domain.add_features(polylines.begin(), polylines.end());
std::cout << "generating mesh ..." << std::endl;
c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
odt(time_limit=g_time/2),
lloyd(time_limit=g_time/2),
perturb(sliver_bound=20, time_limit=l_time/2),
exude(time_limit=l_time/2));
Attachment:
md.png
Description: PNG image
- [cgal-discuss] mesh_domain_with_polyline_features_3, Jack Lee, 10/26/2013
- Re: [cgal-discuss] mesh_domain_with_polyline_features_3, Laurent Rineau (CGAL/GeometryFactory), 10/28/2013
- Re: [cgal-discuss] mesh_domain_with_polyline_features_3, Laurent Rineau (CGAL/GeometryFactory), 10/28/2013
- RE: [cgal-discuss] mesh_domain_with_polyline_features_3, Lee, Jack, 10/28/2013
- Re: [cgal-discuss] mesh_domain_with_polyline_features_3, Laurent Rineau (CGAL/GeometryFactory), 10/28/2013
- Re: [cgal-discuss] mesh_domain_with_polyline_features_3, Laurent Rineau (CGAL/GeometryFactory), 10/28/2013
Archive powered by MHonArc 2.6.18.