Last active
February 8, 2021 14:00
-
-
Save lrineau/2773b59c223baa417a8d2107108c9b53 to your computer and use it in GitHub Desktop.
CGAL issue #5439
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2783,1,6 | |
246889.5581095046,4307327.8709930051,2783 | |
246891.5668480474,4307326.9729592679,2783 | |
246892.7482990468,4307324.9034922747,2783 | |
246890.5148054505,4307324.9749450302,2783 | |
246889.2726949855,4307327.0986428605,2783 | |
246889.5581095046,4307327.8709930051,2783 | |
2953,1,6 | |
246889.5742649377,4307327.8704761649,2953 | |
246891.5662656765,4307326.9547553407,2953 | |
246892.7309289156,4307324.9040479697,2953 | |
246890.5317851452,4307324.9744018223,2953 | |
246889.2887029200,4307327.0981307384,2953 | |
246889.5742649377,4307327.8704761649,2953 | |
3119,1,6 | |
246889.5904290458,4307327.8699590471,3119 | |
246891.5656833054,4307326.9365514154,3119 | |
246892.7135587832,4307324.9046036629,3119 | |
246890.5487648389,4307324.9738586145,3119 | |
246889.3047195328,4307327.0976183377,3119 | |
246889.5904290458,4307327.8699590471,3119 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.13...3.19) | |
project(issue5439) | |
find_package(CGAL REQUIRED) | |
add_executable(issue5439 TesteCGAL.cpp) | |
target_link_libraries(issue5439 CGAL::CGAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { FS="," } | |
/([0-9])+,[0-9],[0-9]+/ { polygon=$1; print $0; next; } | |
/([0-9.]+,[0-9.]+),/ { print $1 "," $2 "," polygon } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define CGAL_CDT_2_DEBUG_INTERSECTIONS 1 | |
#include <iostream> | |
#include <fstream> | |
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> | |
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | |
#include <CGAL/Projection_traits_xy_3.h> | |
#include <CGAL/Polygon_2.h> | |
#include <CGAL/Constrained_Delaunay_triangulation_2.h> | |
#include <CGAL/Constrained_triangulation_plus_2.h> | |
#include <CGAL/Polyline_simplification_2/simplify.h> | |
#include <CGAL/Polyline_simplification_2/Squared_distance_cost.h> | |
#include <CGAL/Polyline_simplification_2/Scaled_squared_distance_cost.h> | |
#include <CGAL/Constrained_triangulation_2.h> | |
namespace PS = CGAL::Polyline_simplification_2; | |
// Vertex base for CGAL_CDT_2_DEBUG_INTERSECTIONS | |
template <typename Vb> | |
class My_vertex_base : public Vb { | |
std::size_t time_stamp_; | |
public: | |
My_vertex_base() : Vb(), time_stamp_(-1) { | |
} | |
My_vertex_base(const My_vertex_base& other) : | |
Vb(other), | |
time_stamp_(other.time_stamp_) | |
{} | |
typedef CGAL::Tag_true Has_timestamp; | |
std::size_t time_stamp() const { | |
return time_stamp_; | |
} | |
void set_time_stamp(const std::size_t& ts) { | |
time_stamp_ = ts; | |
} | |
template < class TDS > | |
struct Rebind_TDS { | |
typedef typename Vb::template Rebind_TDS<TDS>::Other Vb2; | |
typedef My_vertex_base<Vb2> Other; | |
}; | |
}; | |
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic; | |
typedef CGAL::Projection_traits_xy_3<Epic> K; | |
typedef CGAL::Polygon_2<K> Polygon_2; | |
typedef PS::Vertex_base_2<K> Vb1; | |
typedef My_vertex_base<Vb1> Vb; | |
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb; | |
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS; | |
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS, CGAL::Exact_predicates_tag> | |
CDT; | |
typedef CGAL::Constrained_triangulation_plus_2<CDT> CT; | |
typedef CT::Point Point; | |
typedef CT::Constraint_iterator Constraint_iterator; | |
typedef CT::Vertices_in_constraint_iterator Vertices_in_constraint_iterator; | |
typedef CT::Points_in_constraint_iterator Points_in_constraint_iterator; | |
typedef PS::Stop_below_count_ratio_threshold Stop; | |
typedef PS::Squared_distance_cost CostSquare; | |
typedef PS::Hybrid_squared_distance_cost<double> CostHybrid; | |
typedef CGAL::Polygon_2<K> Polygon_2_2; | |
#include <set> | |
int main() | |
{ | |
std::cerr.precision(17); | |
std::ifstream ArqTrian("CampoGolf.pon", std::fstream::in); | |
if (!ArqTrian.good()) | |
{ | |
exit(0); | |
} | |
size_t QtdPoints(0); | |
char Separator; | |
int i(0), Closed(0); | |
CT ct; | |
while (ArqTrian.good()) | |
{ | |
ArqTrian >> i >> Separator >> Closed >> Separator; | |
Polygon_2_2 P; | |
double x, y, z; | |
for (ArqTrian >> QtdPoints; QtdPoints; --QtdPoints) | |
{ | |
ArqTrian >> x >> Separator >> y >> Separator >> z; | |
P.push_back(Point(x, y, z)); | |
} | |
std::cerr << "polygon #" << i << '\n'; | |
ct.insert_constraint(P.vertices_begin(), P.vertices_end(), (bool)Closed); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment