Menu
  • HOME
  • TAGS

How do I iterate through all the faces in a CGAL StraightSkeleton_2 / HalfedgeDS?

cgal

So the iteration is much as I'd expected: // Each face for( auto face = iss->faces_begin(); face != iss->faces_end(); ++face ) { Ss::Halfedge_const_handle begin = face->halfedge(); Ss::Halfedge_const_handle edge = begin; // Each vertex do { std::cout << edge->vertex()->point() << std::endl; edge = edge->next(); } while (edge != begin); } The...

CGAL 2D delaunay triangulation with mixed boundary conditions

cgal,delaunay

The 2D Periodic triangulation package in CGAL only handle periodicity in the x and y direction (i.e triangulation in the two dimensional flat torus).

Boost error with CGAL SDF algorithm

c++,algorithm,boost,cgal

I found my problem, I use the MEPP library which uses the CGAL library. The MEPP library is redefining the typedef declaration of "Polyhedron" and the "pMesh" sent to the sdf_values function isn't the same type as the "Polyhedron" wanted. Of course, the type is checked with boost (eval_if) and...

CGAL: Modify an extended DCEL fetched from a locate call

c++,cgal

You have to use the overloaded member template functions non_const_handle() of the Arrangement_2 template class. There are 3 versions, which accept Vertex_const_handle, Halfedge_const_handle, and Face_const_handle, respectively; see the manual. BW, const_cast<> will not work. because, for example, Vertex_const_handle and Vertex_handle are simply different types....

get vertices index to save Triangulation

c++,triangulation,cgal

I changed the format of out put file, here is the new format: v x1 y1 v x2 y2 ... f v11 v12 v13 a11 a12 a13 f v21 v22 v23 a21 a22 a23 ... where a12 ... are triangle neighbors. the function becomes : std::ofstream Ivge_file(link); unsigned Vertx_index =...

Tag boundary vertices after 3d triangulation

3d,cgal

I managed to solve this finally by using sub-domains for (C3t3::Facets_in_complex_iterator fit = i_pTetrahedlizedMesh.facets_in_complex_begin(), end = i_pTetrahedlizedMesh.facets_in_complex_end(); fit != end; ++fit) { C3t3::Subdomain_index cell_sd = i_pTetrahedlizedMesh.subdomain_index(fit->first); C3t3::Subdomain_index opp_sd = i_pTetrahedlizedMesh.subdomain_index(fit->first->neighbor(fit->second)); if (cell_sd != 0 && opp_sd != 0) continue; //this is an inner vertex else .... //this is an outer...

Infinite loop during CGAL::Delaunay_triangulation_3

c++,infinite-loop,triangulation,cgal,delaunay

I think the bug is in your struct adjacent_vertex_back_inserter_t The operator= should be as follows: inline void operator=(const vertex_handle_t& w) { assert(! delaunay.is_infinite(v)) if ( !delaunay.is_infinite(w) && (delaunay.geom_traits().compare_distance_3_object()(p, w->point(), v->point()) == CGAL::SMALLER)){ v = w; } ...

How to linearly subdivide a 2D quad mesh?

mesh,cgal

You can use the barycentric subdivision scheme

Syntax error for CGAL Affine Transformation

c++,cgal

CGAL::Translation is the name of a class -- you want CGAL::TRANSLATION, which is the name of an instance of that class.

Get 2d alpha shape boundary vertices from set of points

c++,cgal

Ended up going over the edges instead and used that to find the vertices in order.

Triangulating Polyhedron faces in CGAL

cgal

The header file <CGAL/triangulate_polyhedron.h> contains a non-documented function template <typename Polyhedron> void triangulate_polyhedron(Polyhedron& p) that is working with CGAL::Exact_predicates_inexact_constructions_kernel for example....

setup.py check if non-python library dependency exists

python,setuptools,distutils,setup.py,cgal

Whether a particular extension module should be compiled depending on the availability of some library version, can be accomplished by dynamically generating the ext_modules argument of setup() in setup.py. For the _yaml.so module of ruamel.yaml, that only should be compiled when the libyaml development libraries have been installed on the...

CGAL error: computing the halfspace intersection without a given point cannot compile (boost::none?)

c++,boost,cgal

Actually, I managed to get it working with the following workaround: CGAL::halfspace_intersection_3(planes.begin(), planes.end(), poly, static_cast<boost::optional<Point> >(boost::none)); Thanks for relaying the bug, though!...

Tagging (or coloring) CGAL objects

cgal

Unfortunately, there is no out-of-the-box way doing it. However, it doesn't require too much (famous last words...). You need to do two things described below. The first is supported by the API. The second is not, so you will need to patch a source file. A simple example is provided...

3D alpha shape yielding unexpected convex hull of surface

cgal,delaunay,surface,lidar

You need to find the tetrahedons on the surface of the shape first. Then you can try alpha shapes and remove the edges exceeding alpha. In CGAL you Then check all tetrahedons if they are connected with a super tetrahedon. These are the tetrahedons on the surface of the shape....

What mesh file types are supported for input by the C++ library CGAL?

c++,file-io,mesh,cgal

There is a piece of code in CGAL-4.6/demo/Polyhedron/ that permits to load an STL file to a CGAL::Polyhedron_3 object. The demo allows to load an STL file, and then save to an OFF file. Alternatively, if you need to have a STL-loader inside your own code, you might copy-paste and...

Access all tetrahedrons incident on a vertex

triangulation,cgal

I had trouble using the incident_cells() function as I was not sure how to use the OutputIterators. This CGAL forum discussion exactly answers my question(with a code example).

Triangulate over a manifold using CGAL

c++,math,triangulation,cgal

(I am a CGAL developer, but I do not know well the dD triangulation package.) I think that you cannot do a computation over R^3 x S using CGAL. If S is a embedable in R, I suggest you do the computation in R^4....

CMake fails to find boost libraries (CGAL, Windows)

c++,boost,build,cmake,cgal

Alright, I finally got everything to the state I needed. What follows is essentially a description of how to get the magical libCGAL.dll and libCGAL.a (library files) that you want on Windows 7 with Code::Blocks. I downloaded and installed CMake. I downloaded and installed Boost 1.58.0, with the manual and...

CGAL 3D Delaunay Triangulation - First Vertex is Origin?

iteration,cgal,delaunay

This is the infinite vertex, which has unspecified coordinates and happens to be the origin here. You should iterate using finite_vertices_begin()/finite_vertices_end() instead. See http://doc.cgal.org/latest/Triangulation_3/ for information about the infinite vertex.

How to display CGAL exceptions in command line lldb

c++,exception,clang,lldb,cgal

I don't know quite what you want to get. You can get lldb to stop at the point where the exception is going to be thrown by setting a breakpoint on the exception throw: (lldb) break set -n __cxa_throw Then you will stop in the debugger at the point where...

Passing address of Container equivalent to OutputIterator?

c++,cgal

The advantage of OutputIterator is that you can make templates that can take any type of standard container. Another advantage compared to passing an address or a reference is that caller may choose to use to use either std::front_inserter or std::back_inserter depending on what order they want and which is...

Does CGAL 2D Conforming Mesh support fix points?

cgal

Using your wording, all the input point of the initial constrained Delaunay triangulation will be fix points, because the 2D mesh generator only insert new points in the triangulation: it never removes any point. As for the density, you can copy, paste, and modify a criteria class, such as CGAL::Delaunay_mesh_size_criteria_2<CDT>...

Run CGAL c++ program on OS X?

c++,osx,cgal

CGAl gets installed on the directory : opt/local/include/cgal steps: Write your program into a text file and save excutable.cpp In the command line go to the directory of the executable( use cd command) then write the following commands cgal_create_CMakeLists -s executable //without .cpp!! cmake -DCGAL_DIR = opt/local/include/cgal make go to...

Representing a LiDAR surface using the 3D Delaunay Triangulation as basis?

3d,cgal,delaunay,lidar

You can use Fade 2.5D, it uses triangles to mesh surface points: http://www.geom.at/fade2d/html/ The library is free for scientific use, you can find a code example in Example7 (I'm the author)....

Geometry rounding problems: object no longer convex after simple transformations

c++,geometry,rounding,cgal,convex

In the end I discovered the root of this problem was the fact that the convex hull contained lots of triangles, whereas my input shapes were often cube-shaped, making each quadrilateral region appear as 2 triangles which had extremely similar plane equations, causing some sort of problem in the algorithm...

Speed up optimization techniques in CGAL

cgal

For each polygon, first compute all the bounding boxes of the polygons. If you want to check intersections of polygons, the first thing to check is if the bounding boxes of the polygons do intersect. If they do not, then the polygons cannot intersect. Then, to avoid the quadratic computation...

Using emscripten with CMake in a simple(?) project

c++,cmake,cgal,emscripten

Hmmm, so it turns out that you can't just link in a library, the emscripten docs point out that you "...build the libraries to bitcode and then compile library and main program bitcode together to JavaScript." That sounds silly and painful but I guess that's the answer....

Vertex coordinates from General_polygon_2

c++,polygon,vertex,cgal

Something like the following should do the job: typedef Gps_traits_2::General_polygon_2 General_polygon_2; const General_polygon_2& outer_boundary = offset_poly.outer_boundary(); General_polygon_2::Curve_const_iterator cit=outer_boundary.curves_begin(), cit_end=outer_boundary.curves_end(); for(;cit!=cit_end;++cit) { bool is_linear = cit->is_linear(); std::cout << cit->source() << " " << cit->target() << "\n"; } The list of all member functions are given here....

Updating CGAL program to use AABB_face_graph_triangle_primitive

c++,boost,cgal

The syntax for the Tree constructor is incorrect for the Polyhedron_3 in the code above. The correct syntax should be Tree tree(faces(surface_poly).first, faces(surface_poly).second, surface_poly); Updating the syntax to the correct form fixes the compile-time errors....

Loop the halfedge_handle around a vertex

cgal

A halfedge circulator is convertible to a halfedge handle. Thus you simply need to write: Polyhedron::Halfedge_handle hh = hc; ...

A point CGAL transformation between two coordinate systems

c++,transformation,cgal

Well, after researching a bit, I found here the theory for the solution to my problem. https://en.wikipedia.org/wiki/Change_of_basis To clarify a bit, these definitions have built with the purpose of making the code more understandable. typedef CGAL::Cartesian<long double> KC; typedef KC::Point_3 Point; typedef KC::Vector_3 Vector; typedef CGAL::Aff_transformation_3<KC> Transform3; After considering the...

CGAL + Find edge length using EdgeIterator

c++,cgal

The only mistake that should be fixed in order to compile is: const Point& a = edgeIter->prev()->vertex()->point(); const Point& b = edgeIter->vertex()->point(); You should use CGAL::Exact_predicates_inexact_constructions_kernel instead of Kernel. You should take a const ref on mesh if you want to avoid an unneeded copy....

Get halfedge from edge in cgal

cgal

An edge is simply one of the two opposite halfedges. You can simply write Halfedge_handle h = ei; ...

How to get polygon faces from CGAL convex hull

cgal,convex-hull

There is no way to do it out-of-the box. You need to test for each edge whether the four points are coplanar.