On Tuesday, October 1, 2019 9:15:48 PM CEST rdzhao wrote:

> I've played with your code. It successfully captures all the components.

> That's great!

>

> Your offered treatment incorporates a subset of surface vertices as seeds.

> But when I changes the seeds at a set of points inside the surface, the

> program crashes with segmentation fault.

>

> What should I do to insert only interior points as seeds?

What you call the seeds are documented in functor Construct_initial_points of the MeshDomain_3 concept:

> A function object to construct a set of initial points on the surface of the domain.

https://doc.cgal.org/4.14.1/Mesh_3/classMeshDomain__3.html#abcf45d5a98576cad24711008e940b98fThey have to be on the surface of the domain.

If you want to insert initial points in the interior of the domain, then you will have to do the initialization of the c3t3 object by handle, using a loop, and then:

C3t3 c3t3;

C3t3::Triangulation& tr = c3t3.triangulation();

for(auto pi: seeds) {

Vertex_handle v = tr.insert(pi);

// `v` could be null if `pi` is hidden by other vertices of `tr`.

CGAL_assertion(v != Vertex_handle());

c3t3.set_dimension(v, 2); // by construction, points are on surface

c3t3.set_index(v, index);

}

See an example if the the documentation:

https://doc.cgal.org/4.14.1/Mesh_3/index.html#title26But be particularly careful with the line

c3t3.set_dimension(v, 2);

For points that are inside the interior of the domain, the 2 has to be a 3:

c3t3.set_dimension(v, 3);

Your custom initialization could be made of two loops:

C3t3 c3t3;

C3t3::Triangulation& tr = c3t3.triangulation();

for(auto pi: seeds_on_surface) {

Vertex_handle v = tr.insert(pi);

// `v` could be null if `pi` is hidden by other vertices of `tr`.

CGAL_assertion(v != Vertex_handle());

c3t3.set_dimension(v, 2);

c3t3.set_index(v, index);

}

for(auto pi: seeds_in_the_interior) {

Vertex_handle v = tr.insert(pi);

// `v` could be null if `pi` is hidden by other vertices of `tr`.

CGAL_assertion(v != Vertex_handle());

c3t3.set_dimension(v, 3);

c3t3.set_index(v, index);

}

--

Laurent Rineau, PhD

R&D Engineer at GeometryFactory

http://www.geometryfactory.com/Release Manager of the CGAL Project

http://www.cgal.org/--

You are currently subscribed to cgal-discuss.

To unsubscribe or access the archives, go to

https://sympa.inria.fr/sympa/info/cgal-discuss