cgal | The public CGAL repository , see the README | Image Editing library
kandi X-RAY | cgal Summary
kandi X-RAY | cgal Summary
The public CGAL repository, see the README below
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cgal
cgal Key Features
cgal Examples and Code Snippets
Community Discussions
Trending Discussions on cgal
QUESTION
I am trying to use Cmake to build a program that uses CGAL. In my CMakeLists.txt file I have this:
...ANSWER
Answered 2022-Apr-02 at 16:33If you open the CGAL documentation page and type the text "data_file_path"
into the search field in the upper right corner, you'll get:
std::string CGAL::data_file_path (const std::string & filename)
returns the full path of a data file from CGAL.
The data files are located in the data directory of a CGAL release or in the directory Data/data from a git branch checkout. That function uses as prefix the environment variable CGAL_DATA_DIR if set, and the value of the macro CGAL_DATA_DIR otherwise. When using cmake and a standard CGAL setup, linking the target using that function with the target CGAL::Data will automatically set the macro CGAL_DATA_DIR pointing to the data directory of the CGAL version used. The function will attempt to open the file at the returned location and will print a warning message via std::cerr if the file could not be opened.
Also you can find examples of using the data_file_path
function in the CGAL examples
directory (which is not installed by default AFAIK).
If you don't call this function in your code, then you can ignore the CMake warning you're asking about - that's what I do for a long time. Also you can get rid of this warning, if you set the CGAL_DATA_DIR
macro in the CMakeLists.txt
, for example:
QUESTION
I would like to extract the medial axis of a MultiPolygon using CGAL.
Looking through the CGAL documentation I only see functions to make a straight skeleton.
How can I use CGAL to get the medial axis?
...ANSWER
Answered 2022-Feb-22 at 23:50If we have a polygon (a planar domain with straight edges, possibly convex) then the edges which form the medial axis of a polygon are a subset of the multipolygon's Voronoi diagram.
Our strategy, then, is to find the polygon's Voronoi diagram and then remove edges from the diagram until we are left with the medial axis. If we have a MultiPolygon we just repeat the process for each of its constituent polygons.
I'll demonstrate the process visually below and then present code to accomplish it. The data for the test polygon I'll use is this WKT:
QUESTION
I have two meshes who represent two different heads, as in not geometrically identical, but have the same topology. Also, a subset of those points represents the same features on the human face, i.e the tip of the nose, chin, angle of mouth, and so on; they are used in the topology transfer algorithm from which the modified mesh comes from.
Now, while the topologies match, as in the two meshes have the same points numbers, and the points are connected in the same way, the object are not optimally oriented in space.
I'm looking for the name of the optimization step that would better align the two meshes, and whether this concept somehow already exists in CGAL.
The distance between the two meshes could be just the sum of the distances between the matching points, or something more subtle which could give more weight to the points close to the landmarks used in the earlier step. Any linear transformation is admissible, but the ones that make more sense in this context are translations, rotations and scaling.
Files are here is you're interested in having a look
...ANSWER
Answered 2022-Feb-18 at 21:05I found a way to do it - not in CGAL, but in OpenCV
Function is: estimateAffine3D
estimateAffine3D() int cv::estimateAffine3D ( InputArray src, InputArray dst, OutputArray out, OutputArray inliers, double ransacThreshold = 3, double confidence = 0.99 )
Computes an optimal affine transformation between two 3D point sets.
It computes R and T, such that P' = RxP + T , and the distances between the matching points in each set is minimized. R rotation matrix, T translation matrix.
QUESTION
I want to draw 3d segments, and the camera can rotate, so that I can observe the segments from various perspectives. I wonder if there is a way to draw them with CGAL? I know that CGAL is not specific for visualization, so the question itself may be some kind of silly. But it will be really helpful for me if it has this function, because I have some experience with CGAL.
I have tried to learn OpenGL, but it's not possible for me to master it in a short time. And I don't want to spend much time to learn OpenGL, because I will not use it again in future work.
If CGAL doesn't have this function, could you please recommend some lightweight open source libraries which can draw 3d segments? I don't need a very feature-rich, but huge library. One easy to use and lightweight is best for me. Thanks a lot!
ANSWER
Answered 2022-Feb-10 at 11:41CGAL::Basic_viewer_qt allows to draw points, segments and faces in 2D/3D. You can define your own viewer inheriting from this class.
As suggested by Marc, have a look at the different draw_XXX.h files to see how this is achieved for several viewers in CGAL.
QUESTION
I installed with brew
the CGAL C++ library.
After doing cmake .
in the first basic example , I do make
and I got a sequence of errors, the first one and most important is:
ANSWER
Answered 2022-Jan-19 at 22:18Actually, you will need to tell cmake to activate c++17 support in the compiler commands it generates. By default, Apple clang was chosen, and that comes with an earlier default std support.
QUESTION
The question is clear from the title. I tried a ton of variants of
...ANSWER
Answered 2022-Jan-04 at 10:51No need to use addition or modular arithmetic. The solution is simpler:
QUESTION
Created simple program based on 8.3 Example: a Constrained Delaunay Triangulation. And just wanna to export it to some common mesh file format like vtk, msh etc, to be able open it in GMesh or ParaView. To do so I found that most straightforward way is to use write_VTU
. And at the beginning and at the end of example code I added next:
ANSWER
Answered 2021-Dec-17 at 08:16As documented here the face type of the triangulation must be a model of DelaunayMeshFaceBase_2
. You can for example use Delaunay_mesh_face_base_2
like in this example.
QUESTION
Problem description
I wonder if there is a way to change the color of mesh displayed by the function CGAL::draw(). I have a Surface_mesh, I want to draw it with CGAL. So I use the function CGAL::draw(), but the color of mesh is blue, which is not pretty in my view. I tried to change the code of CGAL to change the color. I found a functor called DefaultColorFunctorFaceGraph in a header file called draw_face_graoh.h, there is an annotation above the definition of DefaultColorFunctorFaceGraph, which says "// Default color functor; user can change it to have its own face color". I change the functor, in which I change the return value to CGAL::IO::gray(), but it doesn't work at all, the color of mesh is still blue.
So can I change the color of mesh by changing the code of CGAL? Is it necessary to change lower level code such as some codes calling OpenGL?
Code
Here is an example about the way I use the function draw().
ANSWER
Answered 2021-Dec-17 at 08:51Finally I found a struct named Basic_viewer_qt
in a header file called Basic_viewer_qt.h
. By changing the values of variables m_faces_mono_color
and m_ambient_color
in this struct, color of mesh can be changed.
QUESTION
Problem description
I have a list which contains many triangle_3 objects. It should look like a closed surface mesh, but I don't use a Surface_mesh to represent it for many reasons. However, I really want to check it, so I want to draw it. I read CGAL manual, but I didn't find any functions that I can use on Windows. I found a function named draw_triangles in the Geomview package, but the user manual of this package says "The functionality described in this chapter is not available on Windows". It seems that it is not possible to use draw_triangles function in my programming environment. How can I draw the triangles?
Programming environment
windows x64
VS 2017
CGAL 5.3
ANSWER
Answered 2021-Dec-17 at 08:26I would advice to build a Surface_mesh
only for display purpose. You can use the following example. If your triangle soup is not directly a valid surface mesh, you can use the functions orient_polygon_soup()
and polygon_soup_to_polygon_mesh()
.
See also this example.
EDIT I never tried it but it seems that you can change color globally or per face by adding a partial template specialization to the following class:
QUESTION
Problem description
I want to calculate all intersections between a ray and a surface mesh which was built from points cloud using the function CGAL::advancing_front_surface_reconstruction()
. The cost of time matters very much for me. So I want to use the package named Fast Intersection and Distance Computation. But when I built AABBtree from a surface mesh by the function tree()
, a bug occurs. The IDE's bugs list shows: '' can not transform to CGAL::AABB_face_graph_triangle_primitive from "initializer list"
.
I use the kernel named CGAL::Exact_predicates_inexact_constructions_kernel when I reconstruct mesh from points cloud with CGAL::advancing_front_surface_reconstruction()
, but a Simple_cartesian kernel is required in the Fast Intersection and Distance Computation. Is that the main reason? How can I use the two program package together?
Code
The code is as follows:
ANSWER
Answered 2021-Nov-15 at 02:02After I paint the point (-100,-50,-0) in the mesh sv, I got the reason why the result which seems to be ridiculous come up. Technically, it's not a wrong answer mathematically, it's just not what I was expecting. The ray starting at this point and in the direction of (0, 0, 1) is a ray intersect with many facets on the side of the grid. The CGAL library does a good job of calculating intersections in this case, but I need to filter out the intersections.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cgal
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page