I have some polygons that use the double number type, and I need to use these polygons for precise boolean operations and relational judgments. However, if I directly use the kernel CGAL::Exact_predicates_exact_constructions_kernel or Simple_cartesian<double>, the results are usually incorrect.
So I want to first convert these polygons to precise number types before performing calculations. I plan to use a tolerance value, and if the distance between two points is less than the tolerance value, then they are considered equal. Similarly, if a point's distance to a line segment is less than the tolerance value, then the point is considered to be on the line segment.
I have read https://doc.cgal.org/latest/Number_types/index.html, then I tried specializing CGAL::compare and CGAL::bounded_side_2 or use CGAL::Cartesian_converter, but they did not achieve my goal. I also tried writing my own conversion algorithm, but it was too complex for me.
In short, my goal is to read polygon data of type double from an external source (whether it's text or binary), then convert it to CGAL::Polygon or CGAL::Polygon_with_holes, and finally perform boolean operations or relational judgments.
Source Code
no
Environment
Operating system (Windows 10 64 bits):
Compiler: MSVC or GCC
Release or debug mode: whatever
Specific flags used (if any):
CGAL version: 5.6.1
Boost version: 1.8.3
Other libraries versions if used (Eigen, TBB, etc.):
Issue Details
I have some polygons that use the double number type, and I need to use these polygons for precise boolean operations and relational judgments. However, if I directly use the kernel
CGAL::Exact_predicates_exact_constructions_kernel
orSimple_cartesian<double>
, the results are usually incorrect.So I want to first convert these polygons to precise number types before performing calculations. I plan to use a tolerance value, and if the distance between two points is less than the tolerance value, then they are considered equal. Similarly, if a point's distance to a line segment is less than the tolerance value, then the point is considered to be on the line segment.
I have read https://doc.cgal.org/latest/Number_types/index.html, then I tried specializing
CGAL::compare
andCGAL::bounded_side_2
or useCGAL::Cartesian_converter
, but they did not achieve my goal. I also tried writing my own conversion algorithm, but it was too complex for me.In short, my goal is to read polygon data of type double from an external source (whether it's text or binary), then convert it to
CGAL::Polygon
orCGAL::Polygon_with_holes
, and finally perform boolean operations or relational judgments.Source Code
no
Environment