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

📄 function_objects.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 5 页
字号:
    }  };  template <typename K>  class Compute_xmax_2  {    typedef typename K::FT              FT;    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_rectangle_2& r) const    {      return (r.max)().x();    }  };  template <typename K>  class Compute_xmax_3  {    typedef typename K::FT              FT;    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_cuboid_3& r) const    {      return (r.max)().x();    }  };  template <typename K>  class Compute_ymin_2  {    typedef typename K::FT              FT;    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_rectangle_2& r) const    {      return (r.min)().y();    }  };  template <typename K>  class Compute_ymin_3  {    typedef typename K::FT              FT;    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_cuboid_3& r) const    {      return (r.min)().y();    }  };  template <typename K>  class Compute_ymax_2  {    typedef typename K::FT              FT;    typedef typename K::Iso_rectangle_2 Iso_rectangle_2;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_rectangle_2& r) const    {      return (r.max)().y();    }  };  template <typename K>  class Compute_ymax_3  {    typedef typename K::FT              FT;    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_cuboid_3& r) const    {      return (r.max)().y();    }  };  template <typename K>  class Compute_zmin_3  {    typedef typename K::FT              FT;    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_cuboid_3& r) const    {      return (r.min)().z();    }  };  template <typename K>  class Compute_zmax_3  {    typedef typename K::FT              FT;    typedef typename K::Iso_cuboid_3    Iso_cuboid_3;    typedef FT                          Cartesian_coordinate_type;    //typedef typename K::Cartesian_coordinate_type  Cartesian_coordinate_type;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    Cartesian_coordinate_type    operator()(const Iso_cuboid_3& r) const    {      return (r.max)().z();    }  };  template <typename K>  class Construct_center_2 : Has_qrt  {    typedef typename K::Point_2   Point_2;    typedef typename K::Circle_2  Circle_2;  public:    typedef Point_2          result_type;    typedef Arity_tag< 1 >   Arity;    const Point_2 &    operator()(const Circle_2& c) const    { return c.rep().center(); }  };  template <typename K>  class Construct_center_3 : Has_qrt  {    typedef typename K::Point_3   Point_3;    typedef typename K::Sphere_3  Sphere_3;  public:    typedef Point_3          result_type;    typedef Arity_tag< 1 >   Arity;    const Point_3 &    operator()(const Sphere_3& s) const    { return s.rep().center(); }  };  template <typename K>  class Construct_circle_2  {    typedef typename K::FT          FT;    typedef typename K::Point_2     Point_2;    typedef typename K::Circle_2    Circle_2;    typedef typename Circle_2::Rep  Rep;  public:    typedef Circle_2         result_type;    typedef Arity_tag< 3 >   Arity;    Rep // Circle_2    operator()( Return_base_tag,                const Point_2& center, const FT& squared_radius,	        Orientation orientation = COUNTERCLOCKWISE) const    { return Rep(center, squared_radius, orientation); }    Rep // Circle_2    operator()( Return_base_tag,                const Point_2& p, const Point_2& q, const Point_2& r) const    {      typename K::Orientation_2 orientation;      typename K::Compute_squared_distance_2 squared_distance;      typename K::Construct_circumcenter_2 circumcenter;      Orientation orient = orientation(p, q, r);      CGAL_kernel_precondition( orient != COLLINEAR);      Point_2 center = circumcenter(p, q, r);      return Rep(center, squared_distance(p, center), orient);    }    Rep // Circle_2    operator()( Return_base_tag,                const Point_2& p, const Point_2& q,	        Orientation orientation = COUNTERCLOCKWISE) const    {      CGAL_kernel_precondition( orientation != COLLINEAR);      typename K::Compute_squared_distance_2 squared_distance;      typename K::Construct_midpoint_2 midpoint;      if (p != q) {        Point_2 center = midpoint(p, q);        return Rep(center, squared_distance(p, center), orientation);      } else        return Rep(p, FT(0), orientation);    }    Rep // Circle_2    operator()( Return_base_tag,                const Point_2& p, const Point_2& q,	        const FT& bulge) const    {           typename K::Compute_squared_distance_2 squared_distance;      const FT sqr_bulge = CGAL::square(bulge);      const FT common = (FT(1) - sqr_bulge) / (FT(4)*bulge);      const FT x_coord = (p.x() + q.x())/FT(2)	                 + common*(p.y() - q.y());      const FT y_coord = (p.y() + q.y())/FT(2)                          + common*(q.x() - p.x());            const FT sqr_rad = squared_distance(p, q) 	                 * (FT(1)/sqr_bulge + FT(2) + sqr_bulge) / FT(16);       return Rep(Point_2(x_coord, y_coord), sqr_rad);     }    Rep // Circle_2    operator()( Return_base_tag, const Point_2& center,	        Orientation orientation = COUNTERCLOCKWISE) const    {      CGAL_kernel_precondition( orientation != COLLINEAR );      return Rep(center, FT(0), orientation);    }    Circle_2    operator()( const Point_2& center, const FT& squared_radius,	        Orientation orientation = COUNTERCLOCKWISE) const    {      return this->operator()(Return_base_tag(),                              center, squared_radius, orientation);    }    Circle_2    operator()( const Point_2& p, const Point_2& q, const Point_2& r) const    {      return this->operator()(Return_base_tag(), p, q, r);    }    Circle_2    operator()( const Point_2& p, const Point_2& q,	        Orientation orientation = COUNTERCLOCKWISE) const    {      return this->operator()(Return_base_tag(), p, q, orientation);    }    Circle_2    operator()( const Point_2& p, const Point_2& q,	        const FT& bulge) const    {      return this->operator()(Return_base_tag(), p, q, bulge);    }    Circle_2    operator()( const Point_2& center,	        Orientation orientation = COUNTERCLOCKWISE) const    {      return this->operator()(Return_base_tag(), center, orientation);    }  };  template <typename K>  class Construct_iso_cuboid_3  {    typedef typename K::RT            RT;    typedef typename K::Point_3       Point_3;    typedef typename K::Iso_cuboid_3  Iso_cuboid_3;    typedef typename Iso_cuboid_3::Rep  Rep;  public:    typedef Iso_cuboid_3      result_type;    typedef Arity_tag< 2 >    Arity;    Rep // Iso_cuboid_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q, int) const    { return Rep(p, q, 0); }    Rep // Iso_cuboid_3    operator()(Return_base_tag, const Point_3& p, const Point_3& q) const    { return Rep(p, q); }    Rep // Iso_cuboid_3    operator()(Return_base_tag, const Point_3 &left,   const Point_3 &right,               const Point_3 &bottom, const Point_3 &top,               const Point_3 &far_,   const Point_3 &close) const    { return Rep(left, right, bottom, top, far_, close); }    Rep // Iso_cuboid_3    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy, const RT& min_hz,               const RT& max_hx, const RT& max_hy, const RT& max_hz,               const RT& hw) const    { return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw); }    Rep // Iso_cuboid_3    operator()(Return_base_tag, const RT& min_hx, const RT& min_hy, const RT& min_hz,               const RT& max_hx, const RT& max_hy, const RT& max_hz) const    { return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); }    Iso_cuboid_3    operator()(const Point_3& p, const Point_3& q, int) const    { return this->operator()(Return_base_tag(), p, q, 0); }    Iso_cuboid_3    operator()(const Point_3& p, const Point_3& q) const    { return this->operator()(Return_base_tag(), p, q); }    Iso_cuboid_3    operator()(const Point_3 &left,   const Point_3 &right,               const Point_3 &bottom, const Point_3 &top,               const Point_3 &far_,   const Point_3 &close) const    { return this->operator()(Return_base_tag(), left, right, bottom, top, far_, close); }    Iso_cuboid_3    operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,               const RT& max_hx, const RT& max_hy, const RT& max_hz,               const RT& hw) const    { return this->operator()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw); }    Iso_cuboid_3    operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,               const RT& max_hx, const RT& max_hy, const RT& max_hz) const    { return this->operator()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); }  };  template <typename K>  class Construct_max_vertex_2 : Has_qrt  {    typedef typename K::Point_2          Point_2;    typedef typename K::Segment_2        Segment_2;    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;  public:    typedef Point_2           result_type;    typedef Arity_tag< 1 >    Arity;    const Point_2&    operator()(const Iso_rectangle_2& r) const    { return (r.rep().max)(); }    const Point_2&    operator()(const Segment_2& s) const    { return (s.max)(); }  };  template <typename K>  class Construct_min_vertex_2 : Has_qrt  {    typedef typename K::Point_2          Point_2;    typedef typename K::Segment_2        Segment_2;    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;  public:    typedef Point_2           result_type;    typedef Arity_tag< 1 >    Arity;    const Point_2&    operator()(const Iso_rectangle_2& r) const    { return (r.rep().min)(); }    const Point_2&    operator()(const Segment_2& s) const    { return (s.min)(); }  };  template <typename K>  class Construct_max_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;  public:    typedef Point_3           result_type;    typedef Arity_tag< 1 >    Arity;    Point_3    operator()(const Iso_cuboid_3& r) const    { return (r.rep().max)(); }    const Point_3&    operator()(const Segment_3& s) const    { return (s.rep().max)(); }  };  template <typename K>  class Construct_min_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;  public:    typedef Point_3           result_type;    typedef Arity_tag< 1 >    Arity;    Point_3    operator()(const Iso_cuboid_3& r) const    { return (r.rep().min)(); }    const Point_3&    operator()(const Segment_3& s) const    { return (s.rep().min)(); }  };  template <typename K>  class Construct_object_2  {    typedef typename K::Object_2   Object_2;  public:    typedef Object_2         result_type;    typedef Arity_tag< 1 >   Arity;    template <class Cls>    Object_2    operator()( const Cls& c) const    { return make_object(c); }  };  template <typename K>  class Construct_object_3  {    typedef typename K::Object_3   Object_3;  public:    typedef Object_3         result_type;    typedef Arity_tag< 1 >   Arity;    template <class Cls>    Object_3    operator()( const Cls& c) const    { return make_object(c); }  };  template <typename K>

⌨️ 快捷键说明

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