Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm constructing a terrain with constraints that can intercept themselves, so I changed the third parameter of CDT to CGAL::Exact_intersections_tag. I supouse that the only reason to got an error in insert constraint is this, crossing constraint without the correct tag but is still occurring erros on CDT::insert_constrain. The exception text comes empty so I got stucked and can′t verify the reason and fix the code. the insertion code is:

ct.insert_constraint(P.vertices_begin(), P.vertices_end(), closed);

closed is a boolean that is true when the constraint is closed (polygon).

Is a big surface with 500.000 points. On my code the error occurs on:

ct.insert_constraint(P.vertices_begin(), P.vertices_end(),closed);

the CGAL file is Polyline_constraint_hierarchy_2.h.

the exceptin data is:

expr -> false
file -> file = 0x00007ffbeb81d6b0 "C:\dev\CGAL- 
5.0\include\CGAL\Triangulation_2\internal\Polyline_constraint_hierarchy_2.h"
line -> 1016
msg -> ""

The code on the file Polyline_constraint_hierarchy_2.h is:

template <class T, class Compare, class Data>
void 
Polyline_constraint_hierarchy_2<T,Compare,Data>::
add_Steiner(T va, T vb, T vc){
Context_list* hcl=nullptr;
if(!get_contexts(va,vb,hcl)) CGAL_triangulation_assertion(false);  <<--- here

Context_list* hcl2 = new  Context_list;

Vertex_it      pos;
...

Sure the problem is on get_contexts

Thank you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
304 views
Welcome To Ask or Share your Answers For Others

1 Answer

Folow the testfile I made to show the error.

Its is not a exe file is a function that I included in my dll for CGAL functions. The error os ocurring on insertion of the polygon number 1790.

#include <iostream>
#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;

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> 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;

#define _AFXDLL 
#include "..stdafx.h"
#include <set>
#include "afxtempl.h"

int TesteCGAL()
{
  std::ifstream ArqTrian("C:\Users\carlo\Documents\CampoGolf.pon", 
  std::fstream::in);

  if (!ArqTrian.good())
  {
    AfxMessageBox("Error reading file");

    exit(0);
  }

  int C(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));
    }

    ct.insert_constraint(P.vertices_begin(), P.vertices_end(), (bool)Closed);
  }

  return 0;
}

How to post the file with the points?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...