Subject: CGAL users discussion list
List archive
- From: Kwok Jasper <>
- To: <>
- Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of
- Date: Wed, 11 Feb 2009 00:58:07 +0800
- Importance: Normal
Excuse me, I have checked the part of my code that set the vector<Vertex_handle> neighbor_vertex_handle for each of the vertex in the triangulation. In that part I have the following for(n_itr = neighbor.begin(); n_itr != neighbor.end(); ++n_itr) { //(A) // In the line below, (root -> get_handle_by_point(root, *n_itr)) is a vertex handle of a neighbor for the currently processed vertex (curr -> neighbor_vertex_handle).push_back(root -> get_handle_by_point(root, *n_itr)); //(B) // In the line below, I check if (root -> get_handle_by_point(root, *n_itr)) rellay returns a vertex handle cout << (root -> get_handle_by_point(root, *n_itr) -> get_point()).x() << endl; //(C) //In the line below, I check if the newly added vertexhandle can be retrieved cout << ((curr -> neighbor_vertex_handle).front() -> point()).x() << endl; } In the code above, when I run it, (B) does print out a floating point number However, (C) cause exception... It seems that in (B), (root -> get_handle_by_point(root, *n_itr) really return a vertex handle Howeer, after the vertex handle is pushed onto the vector<Vertex_handle> neighbor_vertex_handle of the currently processed vertex, the x coordinate cannot be retrieved through that vertex handle inside the vector vector<Vertex_handle> neighbor_vertex_handle It is strange.. In (B), a vertex handle is pushed onto the vector. After that in (C), when the vertex handle just added into the vector is retrieved, it cause exception.. May I ask what may be the possible reason for such situation? The problem has caused me to stop the progree in my project for a few days.... May I ask if any one is willing to tell me the possible reasons? Thank you very much From: To: Date: Tue, 10 Feb 2009 22:08:31 +0800 Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of Excuse me, I have tried to debug for some more time. and I found that reason seems to be due to the usage of the variable tempX2, tempY2 and tempZ2. all of them are related to the get_point() function I defined. I found that every time I used tempZ, tempY or tempZ as input to some other function, the exception occur. even when I use std::cout << tempX << tempY << tempZ << endl; this built-in function, I have the exception. It seems that the exception is really due to the get_point() function that I defined in the class "Vertex_base_for_ssr". If it is really that I defined that function in an improper way. The following is all the code related to the exception (which I have also posted in the previous message) Is it I should not define the function get_point() inside the class "Vertex_base_for_ssr" in that way?? Thanks //First, I have the following declaration and class typedef CGAL::Cartesian<double> Rep_class; typedef CGAL::Vector_3<Rep_class> Vector; template < class GT, class Vb = CGAL::Triangulation_vertex_base_3<GT> > class Vertex_base_for_ssr : public Vb { public: typedef typename Vb::Vertex_handle Vertex_handle; typedef typename Vb::Cell_handle Cell_handle; typedef typename Vb::Point Point; template < class TDS2 > struct Rebind_TDS { typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2; typedef Vertex_base_for_ssr<GT, Vb2> Other; }; Vector surface_normal; vector<Vertex_handl e> neighbor_vertex_handle; double fifth_nearest_dist; Vertex_base_for_ssr() {} Vertex_base_for_ssr(const Point& p) : Vb(p) {} Vertex_base_for_ssr(const Point& p, Cell_handle c) : Vb(p, c) {} void set_surface_normal(double x_i, double y_i, double z_i) { surface_normal = Vector(x_i, y_i, z_i); } Point get_point() { return Vb::point(); } }; typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Point_3<K> Point_k; typedef CGAL::Triangulation_data_structure_3<Vertex_base_for_ssr<K> > Tds; typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay_triangulation; typedef Delaunay_triangulation::Vertex_handle Vertex_handle; typedef Delaunay_triangulation::Point Poin t; typedef Delaunay_triangulation::Finite_vertices_iterator Finite_vertices_iterator; typedef Delaunay_triangulation::Finite_facets_iterator Finite_facets_iterator; typedef Delaunay_triangulation::Triangle Triangle; typedef Delaunay_triangulation::Segment Segment; //Then, I have a function that does the following Point * co_mean = NULL; list<Point> co_input; list<Point>::iterator co_itr; vector<Vertex_handle>::iterator nv_itr; double temp_fifth_nearest_dist; double tempX1; double tempY1; double tempZ1; double tempX2; double tempY2; double tempZ2; double dist; for(curr = start; curr != end; ++curr) ; { if (co_mean != NULL) { delete co_mean; co_mea n = NULL; } if (co_input.size() != 0) { co_input.clear(); } x_total = 0; y_total = 0; z_total = 0; x_variance = 0; y_variance = 0; z_variance = 0; x_y_covariance = 0; y_z_covariance = 0; x_z_covariance = 0; temp_fifth_nearest_dist = curr -> fifth_nearest_dist; &n bsp; nv_itr = (curr -> neighbor_vertex_handle).begin(); while(1) { if (nv_itr == (curr -> neighbor_vertex_handle).end()) { break; } tempX1 = (curr -> point()).x(); tempY1 = (curr -> point()).y(); tempZ1 = (curr -> point()).z(); tempX2 = ((*nv_itr) -> get_point()).x(); &nb sp; tempY2 = ((*nv_itr) -> get_point()).y(); tempZ2 = ((*nv_itr) -> get_point()).z(); dist = pow((tempX1 - tempX2),2); dist += pow((tempY1 - tempY2),2); dist += pow((tempZ1 - tempZ2),2); dist = sqrt(dist); co_input.push_back(Point(tempX2 - tempX1 , tempY2 - tempY1, tempZ2 - tempZ1)); co_input.push_back(p); ++nv_itr; } From: To: Date: Tue, 10 Feb 2009 12:50:59 +0800 Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of Excuse me, for the previous problem that I got.. I really do not know what is the reason for that.. May I ask if if it is that I uses the point() function incorrectly?? i.e. for the derived class below, is it I should not have the get_point() function in that way? Is it the exception is related to that? Thanks template < class GT, class Vb = CGAL::Triangulation_vertex_base_3<GT> > class Vertex_base_for_ssr : public Vb { public: typedef typename Vb::Vertex_handle Vertex_handle; typedef typename Vb::Cell_handle Cell_handle; typedef typename Vb::Point Point; template < class TDS2 > struct Rebind_TDS { typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2; typedef Vertex_base_for_ssr<GT, Vb2> Other; }; Vector surface_normal; vector<Vertex_handl e> neighbor_vertex_handle; double fifth_nearest_dist; Vertex_base_for_ssr() {} Vertex_base_for_ssr(const Point& p) : Vb(p) {} Vertex_base_for_ssr(const Point& p, Cell_handle c) : Vb(p, c) {} void set_surface_normal(double x_i, double y_i, double z_i) { surface_normal = Vector(x_i, y_i, z_i); } Point get_point() { return Vb::point(); } }; From: To: Date: Mon, 9 Feb 2009 11:04:56 +0800 Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of Excuse me, may anybody tell me for the previous code that I posted, is it in some situation using std::list will cause some problem such that the exception occur? I have spent a few days on that... but I really don't know what I can do.. I am already using the exact predicate for the triangulation I used in the program. It is strange that the exception happen at different point of execution each time the program is run... May I ask if any body has experienced something similar before? May I ask if any body is willing to tell me what is the possible reason for the exception to happen? From: To: Date: Sun, 8 Feb 2009 17:01:20 +0800 Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of Excuse me, after some further investigation, I found that I get the exception when I insert a Point object into a list (i.e.) the 2 lines of code below co_input.push_back(Point(tempX2 - tempX1 , tempY2 - tempY1, tempZ2 - tempZ1)); co_input.push_back(p); inside the following code. Point_3 * co_mean = NULL; list<Point> co_input; list<Point>::iterator co_itr; vector<Vertex_handle>::iterator nv_itr; double temp_fifth_nearest_dist; double tempX1; double tempY1; double tempZ1; double tempX2; double tempY2; double tempZ2; double dist; for(curr = start; curr != end; ++curr) { if (co_mean != NULL) { delete co_mean; co_mea n = NULL; } if (co_input.size() != 0) { co_input.clear(); } x_total = 0; y_total = 0; z_total = 0; x_variance = 0; y_variance = 0; z_variance = 0; x_y_covariance = 0; y_z_covariance = 0; x_z_covariance = 0; temp_fifth_nearest_dist = curr -> fifth_nearest_dist; nv_itr = (curr -> neighbor_vertex_handle).begin(); while(1) { if (nv_itr == (curr -> neighbor_vertex_handle).end()) { break; } tempX1 = (curr -> point()).x(); tempY1 = (curr -> point()).y(); tempZ1 = (curr -> point()).z(); &am p;am p;nb sp; cout << "b0" << endl; tempX2 = ((*nv_itr) -> get_point()).x(); tempY2 = ((*nv_itr) -> get_point()).y(); tempZ2 = ((*nv_itr) -> get_point()).z(); cout << "b1" << endl; dist = pow((tempX1 - tempX2),2); dist += pow((tempY1 - tempY2),2); dist += pow((tempZ1 - tempZ2),2); dist = sqrt(dist); co_input.push_back(Point(tempX2 - tempX1 , tempY2 - tempY1, tempZ2 - tempZ1)); co_input.push_back(p); ++nv_itr; } May I ask if is possible the problem actually relates to the use of list<Point> co_input; list<Point>::iterator co_itr; i.e. the std::list object with the Point object in CGAL? And even I change the std::list into std::vector, the same exception still exist.. Thank you From: To: Date: Sun, 8 Feb 2009 16:06:38 +0800 Subject: RE: [cgal-discuss] [HELP] about some advice related to the usage of Thanks. Windows Live Gallery 讓才華綻放,讓全世界看見你的創造。 內在氣質才是致勝之道-您是哪一 最原始的溝通是用心的交流。 內在氣質才是致勝之道-您是哪一 最原始的溝通是用心的交流。 人與人之間的距離只有一指之隔。 Windows Live Gallery 讓才華綻放,讓全世界看見你的創造。 人與人之間的距離只有一指之隔。 |
- [cgal-discuss] [HELP] about some advice related to the usage of the derived class of CGAL::Triangulation_vertex_base_3<GT>, Kwok Jasper, 02/04/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage, Monique Teillaud, 02/04/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage, Kwok Jasper, 02/05/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/07/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/07/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/09/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/09/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/08/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/07/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage of, Laurent Rineau (GeometryFactory), 02/10/2009
- RE: [cgal-discuss] [HELP] about some advice related to the usage of, Kwok Jasper, 02/11/2009
- Re: [cgal-discuss] [HELP] about some advice related to the usage, Monique Teillaud, 02/04/2009
Archive powered by MHonArc 2.6.16.