⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function_objects.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 5 页
字号:
  public:    typedef Point_2                result_type;    typedef Arity_tag< 1 >         Arity;    const result_type&    operator()(const Segment_2& s) const    {  return s.rep().source(); }    const result_type&    operator()(const Ray_2& r) const    {  return r.rep().source(); }  };  template <typename K>  class Construct_source_3 : Has_qrt  {    typedef typename K::Segment_3  Segment_3;    typedef typename K::Ray_3      Ray_3;    typedef typename K::Point_3    Point_3;  public:    typedef Point_3                result_type;    typedef Arity_tag< 1 >         Arity;    const result_type&    operator()(const Segment_3& s) const    {  return s.rep().source(); }    const result_type&    operator()(const Ray_3& r) const    {  return r.rep().source(); }  };  template <typename K>  class Construct_target_2 : Has_qrt  {    typedef typename K::Segment_2  Segment_2;    typedef typename K::Point_2    Point_2;  public:    typedef Point_2                result_type;    typedef Arity_tag< 1 >         Arity;    const result_type&    operator()(const Segment_2& s) const    {  return s.rep().target(); }  };  template <typename K>  class Construct_target_3 : Has_qrt  {    typedef typename K::Segment_3  Segment_3;    typedef typename K::Point_3    Point_3;  public:    typedef Point_3                result_type;    typedef Arity_tag< 1 >         Arity;    const result_type&    operator()(const Segment_3& s) const    {  return s.rep().target(); }  };  template <typename K>  class Construct_second_point_2 : Has_qrt  {    typedef typename K::Ray_2    Ray_2;    typedef typename K::Point_2  Point_2;  public:    typedef Point_2              result_type;    typedef Arity_tag< 1 >       Arity;    const result_type&    operator()(const Ray_2& r) const    {  return r.rep().second_point(); }  };  template <typename K>  class Construct_second_point_3 // : Has_qrt  {    typedef typename K::Ray_3    Ray_3;    typedef typename K::Point_3  Point_3;  public:    typedef Point_3              result_type;    typedef Arity_tag< 1 >       Arity;    result_type // const result_type& // Homogeneous...    operator()(const Ray_3& r) const    {  return r.rep().second_point(); }  };  template <typename K>  class Construct_sphere_3  {    typedef typename K::FT         FT;    typedef typename K::Point_3    Point_3;    typedef typename K::Sphere_3   Sphere_3;    typedef typename Sphere_3::Rep Rep;  public:    typedef Sphere_3               result_type;    typedef Arity_tag< 4 >         Arity;    Rep // Sphere_3    operator()(Return_base_tag, const Point_3& center, const FT& squared_radius,	        Orientation orientation = COUNTERCLOCKWISE) const    {  return Rep(center, squared_radius, orientation); }    Rep // Sphere_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q,	        const Point_3& r, const Point_3& s) const    {  return Rep(p, q, r, s); }    Rep // Sphere_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q, const Point_3& r,	        Orientation orientation = COUNTERCLOCKWISE) const    {  return Rep(p, q, r, orientation); }    Rep // Sphere_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q,	        Orientation orientation = COUNTERCLOCKWISE) const    {  return Rep(p, q, orientation); }    Rep // Sphere_3    operator()(Return_base_tag, const Point_3& center,	        Orientation orientation = COUNTERCLOCKWISE) const    {  return Rep(center, orientation); }    Sphere_3    operator()( const Point_3& center, const FT& squared_radius,	        Orientation orientation = COUNTERCLOCKWISE) const    { return this->operator()(Return_base_tag(), center, squared_radius, orientation); }    Sphere_3    operator()( const Point_3& p, const Point_3& q,	        const Point_3& r, const Point_3& s) const    { return this->operator()(Return_base_tag(), p, q, r, s); }    Sphere_3    operator()( const Point_3& p, const Point_3& q, const Point_3& r,	        Orientation /* orientation */ = COUNTERCLOCKWISE) const    { return this->operator()(Return_base_tag(), p, q, r); }    Sphere_3    operator()( const Point_3& p, const Point_3& q,	        Orientation orientation = COUNTERCLOCKWISE) const    { return this->operator()(Return_base_tag(), p, q, orientation); }    Sphere_3    operator()( const Point_3& center,	        Orientation orientation = COUNTERCLOCKWISE) const    { return this->operator()(Return_base_tag(), center, orientation); }  };#ifndef CGAL_NO_DEPRECATED_CODE  template <typename K>  class Construct_supporting_line_2  {    typedef typename K::Line_2     Line_2;    typedef typename K::Ray_2      Ray_2;    typedef typename K::Segment_2  Segment_2;  public:    typedef Line_2                 result_type;    typedef Arity_tag< 1 >         Arity;    Line_2    operator()( const Ray_2& r) const    { return r.supporting_line(); }    Line_2    operator()( const Segment_2& s) const    { return s.supporting_line(); }  };  template <typename K>  class Construct_supporting_line_3  {    typedef typename K::Line_3     Line_3;    typedef typename K::Ray_3      Ray_3;    typedef typename K::Segment_3  Segment_3;  public:    typedef Line_3                 result_type;    typedef Arity_tag< 1 >         Arity;    Line_3    operator()( const Ray_3& r) const    { return r.rep().supporting_line(); }    Line_3    operator()( const Segment_3& s) const    { return s.supporting_line(); }  };#endif // CGAL_NO_DEPRECATED_CODE  template <typename K>  class Construct_supporting_plane_3  {    typedef typename K::Triangle_3  Triangle_3;    typedef typename K::Plane_3     Plane_3;  public:    typedef Plane_3          result_type;    typedef Arity_tag< 1 >   Arity;    Plane_3    operator()( const Triangle_3& t) const    { return t.rep().supporting_plane(); }  };  template <typename K>  class Construct_tetrahedron_3  {    typedef typename K::Tetrahedron_3   Tetrahedron_3;    typedef typename K::Point_3         Point_3;    typedef typename Tetrahedron_3::Rep Rep;  public:    typedef Tetrahedron_3    result_type;    typedef Arity_tag< 4 >   Arity;    Rep // Tetrahedron_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q,	        const Point_3& r, const Point_3& s) const    { return Rep(p, q, r, s); }    Tetrahedron_3    operator()( const Point_3& p, const Point_3& q,	        const Point_3& r, const Point_3& s) const    { return this->operator()(Return_base_tag(), p, q, r, s); }  };  template <typename K>  class Construct_triangle_2  {    typedef typename K::Triangle_2   Triangle_2;    typedef typename Triangle_2::Rep  Rep;    typedef typename K::Point_2      Point_2;  public:    typedef Triangle_2       result_type;    typedef Arity_tag< 3 >   Arity;    Rep // Triangle_2    operator()(Return_base_tag, const Point_2& p, const Point_2& q, const Point_2& r) const    { return Rep(p, q, r); }    Triangle_2    operator()( const Point_2& p, const Point_2& q, const Point_2& r) const    { return this->operator()(Return_base_tag(), p, q, r); }  };  template <typename K>  class Construct_triangle_3  {    typedef typename K::Triangle_3   Triangle_3;    typedef typename K::Point_3      Point_3;    typedef typename Triangle_3::Rep Rep;  public:    typedef Triangle_3       result_type;    typedef Arity_tag< 3 >   Arity;    Rep // Triangle_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q, const Point_3& r) const    { return Rep(p, q, r); }    Triangle_3    operator()( const Point_3& p, const Point_3& q, const Point_3& r) const    { return this->operator()(Return_base_tag(), p, q, r); }  };  template <typename K>  class Construct_vertex_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Segment_3        Segment_3;    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;    typedef typename K::Triangle_3       Triangle_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;  public:    typedef Point_3          result_type;    typedef Arity_tag< 2 >   Arity;    const Point_3 &    operator()( const Segment_3& s, int i) const    { return s.rep().vertex(i); }    const Point_3 &    operator()( const Triangle_3& t, int i) const    { return t.rep().vertex(i); }    Point_3    operator()( const Iso_cuboid_3& r, int i) const    { return r.rep().vertex(i); }    const Point_3 &    operator()( const Tetrahedron_3& t, int i) const    { return t.rep().vertex(i); }  };  template <typename K>  class Construct_cartesian_const_iterator_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Cartesian_const_iterator_2    Cartesian_const_iterator_2;  public:    typedef Cartesian_const_iterator_2 result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_const_iterator_2    operator()( const Point_2& p) const      {	return p.rep().cartesian_begin();      }    Cartesian_const_iterator_2    operator()( const Point_2& p, int) const    {      return p.rep().cartesian_end();    }  };  template <typename K>  class Construct_cartesian_const_iterator_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Cartesian_const_iterator_3    Cartesian_const_iterator_3;  public:    typedef Cartesian_const_iterator_3 result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_const_iterator_3    operator()( const Point_3& p) const      {	return p.rep().cartesian_begin();      }    Cartesian_const_iterator_3    operator()( const Point_3& p, int) const    {      return p.rep().cartesian_end();    }  };  template <typename K>  class Coplanar_3  {    typedef typename K::Point_3       Point_3;    typedef typename K::Orientation_3 Orientation_3;    Orientation_3 o;  public:    typedef typename K::Bool_type     result_type;    typedef Arity_tag< 4 >            Arity;    Coplanar_3() {}    Coplanar_3(const Orientation_3& o_) : o(o_) {}    result_type    operator()( const Point_3& p, const Point_3& q,	        const Point_3& r, const Point_3& s) const    {      return o(p, q, r, s) == COPLANAR;    }  };  template <typename K>  class Counterclockwise_in_between_2  {    typedef typename K::Direction_2  Direction_2;  public:    typedef typename K::Bool_type    result_type;    typedef Arity_tag< 3 >           Arity;    result_type    operator()( const Direction_2& p, const Direction_2& q,	        const Direction_2& r) const    {        if ( q < p)            return ( p < r )||( r <= q );        else            return ( p < r )&&( r <= q );    }  };  template <typename K>  class Do_intersect_2  {  public:    typedef typename K::Bool_type   result_type;    typedef Arity_tag< 2 >          Arity;    // There are 36 combinaisons, so I use a template.    template <class T1, class T2>    result_type    operator()(const T1& t1, const T2& t2) const    { return CGALi::do_intersect(t1, t2, K()); }  };  template <typename K>  class Do_intersect_3  {  public:    typedef typename K::Bool_type   result_type;    typedef Arity_tag< 2 >          Arity;    // There are x combinaisons, so I use a template.    template <class T1, class T2>    result_type    operator()(const T1& t1, const T2& t2) const    { return CGALi::do_intersect(t1, t2, K()); }  };  template <typename K>  class Equal_2  {    typedef typename K::Point_2       Point_2;    typedef typename K::Vector_2      Vector_2;    typedef typename K::Direction_2   Direction_2;    typedef typename K::Segment_2     Segment_2;    typedef typename K::Ray_2         Ray_2;    typedef typename K::Line_2        Line_2;    typedef typename K::Triangle_2    Triangle_2;    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;    typedef typename K::Circle_2      Circle_2;  public:    typedef typename K::Bool_type     result_type;    typedef Arity_tag< 2 >            Arity;    result_type    operator()(const Point_2 &p, const Point_2 &q) const    {      return p.rep() == q.rep();    }    result_type    operator()(const Vector_2 &v1, const Vector_2 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Vector_2 &v, const Null_vector &n) const    {      return v.rep() == n;    }    result_type    operator()(const Direction_2 &d1, const Direction_2 &d2) const    {      return d1.rep() == d2.rep();    }    result_type    operator()(const Segment_2 &s1, const Segment_2 &s2) const    {      return s1.source() == s2.source() && s1.target() == s2.target();    }    result_type    operator()(const Line_2 &l1, const Line_2 &l2) const    {      return l1.rep() == l2.rep();    }    result_type    operator()(const Ray_2& r1, const Ray_2& r2) const    {      return r1.source() == r2.source() && r1.direction() == r2.direction();    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -