Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] incident_facets function of a Delaunay triangulation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] incident_facets function of a Delaunay triangulation


Chronological Thread 
  • From: Query Cgal <>
  • To:
  • Subject: Re: [cgal-discuss] incident_facets function of a Delaunay triangulation
  • Date: Tue, 24 Mar 2009 11:03:35 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.hk; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=w7HA5sl+YpZ2el6M6Hv1ZGyjRqAhXljz3KsGPG9FYqhaldnfzwVZxK9SO9qyBgqDvy1hYijWOyNOtZodcMCNPECkuJlKvt7P9zD5//stqwOYxXf+7MVsRABh01VR1HC71FK2kU3nnhYqrtUuTjuWceup6pYpgB0xAl2Dfp1cZII=;

Hi. Thanks for your reply.

I got the exception when I try the following piece of code. Thanks for your help



typedef CGAL::Cartesian<double> Rep_class;
typedef CGAL::Vector_3<Rep_class> Vector;
typedef CGAL::Point_3<Rep_class> Point_3;

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_base_for_ssr<GT, Vb> *> neighbor_vertex_handle;
  double fifth_nearest_dist;


  int surface_label;
  bool is_safe;



  Vertex_base_for_ssr() : Vb()
  {
      surface_label = -1;
      is_safe = false;
  }

  Vertex_base_for_ssr(const Point& p)
    : Vb(p)
  {
      coordinate[0] = p.x();
      coordinate[1] = p.y();
      coordinate[2] = p.z();
      surface_label = -1;
      is_safe = false;
  }


  Vertex_base_for_ssr(const Point& p, Cell_handle c)
    : Vb(p, c)
  {
      surface_label = -1;
      is_safe = false;
  }

  void set_surface_normal(double x_i, double y_i, double z_i)
  {
      surface_normal = Vector(x_i, y_i, z_i);
  }

  Vector get_surface_normal()
  {
     return surface_normal;
  }

  Point get_point()
  {
      return Vb::point();
  }

  double coordinate[3];

  void set_coordiante()
  {
     coordinate[0] = point().x();
     coordinate[1] = point().y();
     coordinate[2] = point().z();
  }
};

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_data_structure_3<Vertex_base_for_ssr<K> > Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay_triangulation;

int main(array<System::String ^> ^args)
{
    Delaunay_triangulation Dt;

    Dt.insert(Point(0,0,0));
    Dt.insert(Point(10,0,0));
    Dt.insert(Point(5,10,0));
    Dt.insert(Point(8,8,0));

    vector<Vertex_handle> a;

    Finite_vertices_iterator start = Dt.finite_vertices_begin();
    Finite_vertices_iterator end = Dt.finite_vertices_end();
    Finite_vertices_iterator curr;



    list<Delaunay_triangulation::Facet> f;

    Dt.incident_facets(start, back_inserter(f));
}

--- 2009年3月24日 星期二,Andreas Fabri <> 寫道﹕

寄件人: Andreas Fabri <>
主題: Re: [cgal-discuss] incident_facets function of a Delaunay triangulation
收件人:
日期: 2009 3 24 星期二 下午 5:47


Hi Query CGAL

Can you please write a minimalistic example program that produces the error,
so that we can try to reproduce it


andreas



Query Cgal wrote:
> Excuse me, may I ask something about a strange problem I have asked beofre?
>
> The problem is that when I use the incident_facets() function of a 3D Delaunay Triangulation, I get
> System.NullReferenceException
>
>
> and I found out that the exception happens when it is executing line 662 of triangulation_data_structure_3.h
>
> I am using Microsoft Visual C++ 2005 and CGAL-3.3.1
>
> May I ask what may be the possible reason for the problem then?
>
> Thank  you very much
>
>
> --- *2009年3月23日 星期一,Query Cgal /<>/* 寫道﹕
>
>
>     寄件人: Query Cgal <>
>     主題: Re: [cgal-discuss] incident_facets function of a Delaunay
>     triangulation
>     收件人: ..fr
>     日期: 2009 3 23 星期一 下午 12:35
>
>     Thank you for your reply.
>
>     I am using C++.
>     The complier that I use is Visual Studio C++ 2005.
>     And the CGAL version that I use is 3.3.1
>
>     Thanks
>
>     --- *2009年3月23日 星期一,Andreas Fabri
>     /<>/* 寫道﹕
>
>
>         寄件人: Andreas Fabri <>
>         主題: Re: [cgal-discuss] incident_facets function of a Delaunay
>         triangulation
>         收件人: ..fr
>         日期: 2009 3 23 星期一 上午 9:44
>
>         Hello,
>
>         What programming language do you use? I ask because
>
>         int main(array<System::String ^> ^args)
>
>         and
>
>         System.NullReferenceException
>
>         don't look like C++
>
>         andreas
>
>
>         naresh wrote:
>          > Hi
>          >  Can you change kernel for Vertex_base_for_ssr class as
>         Exact_predicates_inexact_constructions_kernel  ?
>          > I donot anything wrong in code it should work try to match
>         similar kernel .
>          >          >     ----- Original Message -----
>          >     *From:* Query Cgal <mailto:cgalquery@yahoo..com.hk>
>          >     *To:*
>          >     <mailto:>
>          >     *Sent:* Monday, March 23, 2009 10:13 AM
>          >     *Subject:* Re: [cgal-discuss] incident_facets function of
>         a Delaunay
>          >     triangulation
>          >
>          >     Hi, Sorry that I have sent an empty reply before because
>         I have hot
>          >     the wrong button.
>          >
>          >     The line that I got the exception is the line
>          >
>          >     Dt.incident_facets(start, back_inserter(f));
>          >
>          >     and after I have chnaged the vector to a list, the
>         exception still
>          >     occur..
>          >
>          >     Thanks
>          >
>          >     --- *2009年3月23日 星期一,Query Cgal
>         /<
>          >     <mailto:>>/* 寫道﹕
>          >
>          >
>          >         寄件人: Query Cgal <cgalquery@yahoo..com.hk
>          >         <mailto:>>
>          >         主題: Re: [cgal-discuss] incident_facets function of
>         a Delaunay
>          >         triangulation
>          >         收件人:
>          >         日期: 2009 3 23 星期一 上午 4:41
>          >
>          >
>          >
>          >         --- *2009年3月23日 星期一,naresh
>         /<alexdowson@hotmail...com>/*
>          >         寫道﹕
>          >
>          >
>          >             寄件人: naresh <>
>          >             主題: Re: [cgal-discuss] incident_facets function
>         of a
>          >             Delaunay triangulation
>          >             收件人:
>          >             日期: 2009 3 23 星期一 上午 4:33
>          >
>          >             
>          >             Hi
>          >                          in Which line you are getting
>         System.NullReferenceException
>          >             of code ?
>          >                          Hmmm... You can try this instead of this
>          >                                              vector<Delaunay_triangulation::Facet> f;  with
>          >             list<Delaunay_triangulation::Facet> f;
>          >                          try list instead of vector.
>          >                                                >                 ----- Original Message -----
>          >                 *From:* Query Cgal
>          >                 *To:*
>          >                 *Sent:* Monday, March 23, 2009 9:47 AM
>          >                 *Subject:* Re: [cgal-discuss] incident_facets
>         function
>          >                 of a Delaunay triangulation
>          >
>          >                 Hi.
>          >
>          >                 Thank you for your reply.
>          >
>          >                 Finally, I have tried with the following code
>         to use the
>          >                 incident_facets function.
>          >
>          >                 int main(array<System::String ^> ^args)
>          >                 {
>          >                     Delaunay_triangulation Dt;
>          >
>          >                     Dt.insert(Point(0,0,0));
>          >                     Dt.insert(Point(10,0,0));
>          >                     Dt.insert(Point(5,10,0));
>          >                     Dt.insert(Point(8,8,0));
>          >                     Dt...insert(Point(-3, -20, 0));
>          >                     Dt.insert(Point(-5,10,0));
>          >
>          >
>          >                     Finite_vertices_iterator start =
>          >                 Dt.finite_vertices_begin();
>          >
>          >                     vector<Delaunay_triangulation::Facet> f;
>          >
>          >                     Dt.incident_facets(start, back_inserter(f));
>          >
>          >                 }
>          >
>          >                 However, when it has
>         "System.NullReferenceException'
>          >                 May I ask is it due to the nature of the
>         points that I
>          >                 have inserted into the triangulation?
>          >
>          >                 I am using CGAL-3.3.1 and Visual C++ 2005
>          >                 And I am using the triangulation with the
>         following
>          >                 declaration.
>          >                 Thank you very much for your help.
>          >
>          >
>          >
>          >                 typedef CGAL::Cartesian<double> Rep_class;
>          >                 typedef CGAL::Vector_3<Rep_class> Vector;
>          >                 typedef CGAL::Point_3<Rep_class> Point_3;
>          >
>          >                 typedef CGAL::Object CGAL_object;
>          >
>          >
>          >
>          >                 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_base_for_ssr<GT, Vb> *>
>          >                 neighbor_vertex_handle;
>          >                   double fifth_nearest_dist;
>          >
>          >
>          >                   int surface_label;
>          >                   bool is_safe;
>          >
>          >
>          >
>          >                   Vertex_base_for_ssr() : Vb()
>          >                   {
>          >                       surface_label = -1;
>          >                       is_safe = false;
>          >                   }
>          >
>          >                   Vertex_base_for_ssr(const Point& p)
>          >                     : Vb(p)
>          >                   {
>          >                       coordinate[0] = p.x();
>          >                       coordinate[1] = p.y();
>          >                       coordinate[2] = p.z();
>          >                       surface_label = -1;
>          >                       is_safe = false;
>          >                   }
>          >
>          >
>          >                   Vertex_base_for_ssr(const Point& p,
>         Cell_handle c)
>          >                     : Vb(p, c)
>          >                   {
>          >                       surface_label = -1;
>          >                       is_safe = false;
>          >                   }
>          >
>          >                   void set_surface_normal(double x_i, double
>         y_i, double
>          >                 z_i)
>          >                   {
>          >                       surface_normal = Vector(x_i, y_i, z_i);
>          >                   }
>          >
>          >                   Vector get_surface_normal()
>          >                   {
>          >                      return surface_normal;
>          >                   }
>          >
>          >                   Point get_point()
>          >                   {
>          >                       return Vb::point();
>          >                   }
>          >
>          >                   double coordinate[3];
>          >
>          >                   void set_coordiante()
>          >                   {
>          >                      coordinate[0] = point()..x();
>          >                      coordinate[1] = point().y();
>          >                      coordinate[2] = point().z();
>          >                   }
>          >                 };
>          >
>          >                 typedef
>          >                        CGAL::Exact_predicates_inexact_constructions_kernel K;
>          >                 typedef
>          >                        CGAL::Triangulation_data_structure_3<Vertex_base_for_ssr<K>
>          >                  > Tds;
>          >                 typedef CGAL::Delaunay_triangulation_3<K, Tds>
>          >                 Delaunay_triangulation;
>          >
>          >
>          >
>          >
>          >
>          >                 --- 2009年3月21日 星期六,naresh
>          >                 <> 寫道﹕
>          >
>          >
>          >                     寄件人: naresh <>
>          >                     主題: Re: [cgal-discuss] incident_facets
>         function of
>          >                 a Delaunay triangulation
>          >                     收件人:
>          >                     日期: 2009 3 21 星期六 下午 1:47
>          >
>          >                     
>          >                     Hi
>          >                                         >>In fact, I am
>         dealing with a 3D triangulation
>          >                 (sorry that I forgot to mention that it is 3D
>         in the
>          >                  >>previous post.)
>          >                     >>and therefore, I cannot use Facet since
>         Facet is
>          >                 not represented in 3D triangulation.
>          >                     >>So, what should I do to use
>         incident_facets() of a
>          >                 3D triangulation.
>          >                                         I donot know which
>         triangulation are you using. for
>          >                 simple triangulation here there you can
>         define Facet
>          >                 easily .. here is code..
>          >                     try to modifiy with ur code
>          >                                         typedef
>          >                        CGAL::Exact_predicates_inexact_constructions_kernel K;
>          >
>          >                     typedef CGAL::Triangulation_3<K>
>         Triangulation;
>          >
>          >                     typedef Triangulation::Facet Facet;
>          >
>          >                     If there is still confusion post some
>         code . But i
>          >                 will not able reply today because saturday
>         now and i am
>          >                 off. :)   I can reply on monday..
>          >
>          >                              >                     Hope this helps
>          >
>          >                     Alex
>          >
>          >                                                                                                 >                         ----- Original Message -----
>          >                         From: Query Cgal
>          >                         To: ..fr
>          >                         Sent: Saturday, March 21, 2009 6:46 PM
>          >                         Subject: Re: [cgal-discuss]
>         incident_facets
>          >                 function of a Delaunay triangulation
>          >
>          >                         THank you for your reply.
>          >
>          >                         In fact, I am dealing with a 3D
>         triangulation
>          >                 (sorry that I forgot to mention that it is 3D
>         in the
>          >                 previous post.)
>          >                         and therefore, I cannot use Facet
>         since Facet is
>          >                 not represented in 3D triangulation.
>          >                         So, what should I do to use
>         incident_facets() of
>          >                 a 3D triangulation.
>          >
>          >                         Thank you
>          >
>          >
>          >
>          >                         --- 2009年3月21日 星期六,naresh
>          >                 <> 寫道﹕
>          >
>          >
>          >                             寄件人: naresh
>         <>
>          >                             主題: Re: [cgal-discuss]
>         incident_facets
>          >                 function of a Delaunay triangulation
>          >                             收件人:
>         
>          >                             日期: 2009 3 21 星期六 下午 1:07
>          >
>          >                             
>          >                             Hi
>          >                                                         I
>         think you should try like this
>          >                                                                typedef Trianluation_2::Facet Facet;   //
>          >                 something here that you had used in ur
>         programme may
>          >                 different i had showed only example
>          >                                                                vector<Facet> f;
>          >                             Dt.incident_facets(start,
>         back_inserter(f));
>          >                                                                  >                                 ----- Original Message -----
>          >                                 From: Query Cgal
>          >                                 To:
>         
>          >                                 Sent: Saturday, March 21,
>         2009 5:45 PM
>          >                                 Subject: [cgal-discuss]
>         incident_facets
>          >                 function of a Delaunay triangulation
>          >
>          >                                 Hi, I have tried to use the
>         function below
>          >
>          >                                 template <class OutputIterator>
>          >                                 OutputIterator            t.incident_facets (
>          >                 Vertex_handle v, OutputIterator facets)
>          >
>          >                                                                               Copies all Facets incident to v to
>          >                 the output iterator facets. Returns the
>         resulting output
>          >                 iterator.
>          >                                 Precondition:             t...dimension() >1 , v
>          >                 Vertex_handle(), t.is_vertex(v)..
>          >                                                                        When I tried to used it in the following
>          >                 way but it didn't work,
>          >
>          >                                 vector<Finite_facets_iterator> f;
>          >                                 Dt.incident_facets(start,
>         back_inserter(f));
>          >
>          >                                 May I ask in what other way
>         should I use
>          >                 the Output iterator then ?
>          >
>          >                                 Thank you
>          >
>          >
>          >
>          >
>          >
>          >
>          >
>          >                                 Yahoo!香港提供網上安全攻略,
>         教你如何防範
>          >                 黑客!了解更多
>          >
>          >
>          >                         Yahoo!香港提供網上安全攻略,教你如何
>         防範黑客!了
>          >                 解更多
>          >
>          >
>          >                        ------------------------------------------------------------------------
>          >                 Yahoo!香港提供網上安全攻略,教你如何防範黑客!
>         *了解更多*
>          >                 <http://hk.promo.yahoo.com/security/
>         <http://hk.promo..yahoo.com/security/>>
>          >
>          >
>          >                ------------------------------------------------------------------------
>          >         Yahoo!香港提供網上安全攻略,教你如何防範黑客!*了解更多*
>          >         <http://hk.promo.yahoo.com/security/
>         <http://hk..promo.yahoo.com/security/>>
>          >
>          >
>          >            ------------------------------------------------------------------------
>          >     Yahoo!香港提供網上安全攻略,教你如何防範黑客!*了解更多*
>          >     <http://hk.promo.yahoo.com/security/>
>
>         -- You are currently subscribed to cgal-discuss.
>         To unsubscribe or access the archives, go to
>         https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
>     ------------------------------------------------------------------------
>     Yahoo!香港提供網上安全攻略,教你如何防範黑客!*了解更多*
>     <http://hk.promo.yahoo.com/security/>
>
>
> ------------------------------------------------------------------------
> Yahoo!香港提供網上安全攻略,教你如何防範黑客!*了解更多* <http://hk..promo.yahoo.com/security/>

-- You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss


Yahoo!香港提供網上安全攻略,教你如何防範黑客!了解更多


Archive powered by MHonArc 2.6.16.

Top of Page