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

📄 function_objects.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 5 页
字号:
    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 3 >                 Arity;    result_type    operator()(const Point_3& p, const Point_3& q, const FT& d2) const    {      return CGAL_NTS compare(squared_distance(p, q), d2);    }  };  template <typename K>  class Compare_slope_2  {    typedef typename K::Line_2             Line_2;    typedef typename K::Segment_2          Segment_2;  public:    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 2 >                 Arity;    result_type    operator()(const Line_2& l1, const Line_2& l2) const    {      return compare_slopesC2(l1.a(), l1.b(), l2.a(), l2.b());    }    result_type    operator()(const Segment_2& s1, const Segment_2& s2) const    {      return compare_slopesC2(s1.source().x(), s1.source().y(),			      s1.target().x(), s1.target().y(),			      s2.source().x(), s2.source().y(),			      s2.target().x(), s2.target().y());    }  };  template <typename K>  class Compare_x_at_y_2  {    typedef typename K::Point_2             Point_2;    typedef typename K::Line_2              Line_2;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 3 >                  Arity;    result_type    operator()( const Point_2& p, const Line_2& h) const    { return compare_y_at_xC2(p.y(), p.x(), h.b(), h.a(), h.c()); }    result_type    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const    {      return compare_y_at_xC2(p.y(), h1.b(), h1.a(), h1.c(),			      h2.b(), h2.a(), h2.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const    {      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),			      h.b(), h.a(), h.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2,	        const Line_2& h1, const Line_2& h2) const    {      return compare_y_at_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),			      h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());    }  };  template <typename K>  class Compare_xyz_3  {    typedef typename K::Point_3             Point_3;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 2 >                  Arity;    result_type    operator()( const Point_3& p, const Point_3& q) const    {      return compare_lexicographically_xyzC3(p.x(), p.y(), p.z(),					     q.x(), q.y(), q.z());    }  };  template <typename K>  class Compare_xy_2  {    typedef typename K::Point_2            Point_2;  public:    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 2 >                 Arity;    result_type    operator()( const Point_2& p, const Point_2& q) const    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }  };  template <typename K>  class Compare_xy_3  {    typedef typename K::Point_3            Point_3;  public:    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 2 >                 Arity;    result_type    operator()( const Point_3& p, const Point_3& q) const    { return compare_lexicographically_xyC2(p.x(), p.y(), q.x(), q.y()); }  };  template <typename K>  class Compare_x_2  {    typedef typename K::Point_2             Point_2;    typedef typename K::Line_2              Line_2;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 2 >                  Arity;    result_type    operator()( const Point_2& p, const Point_2& q) const    { return CGAL_NTS compare(p.x(), q.x()); }    result_type    operator()( const Point_2& p, const Line_2& l, const Line_2& h) const    { return compare_xC2(p.x(), l.a(), l.b(), l.c(), h.a(), h.b(), h.c()); }    result_type    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const    {      return compare_xC2(l.a(), l.b(), l.c(), h1.a(), h1.b(), h1.c(),			 h2.a(), h2.b(), h2.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2,	        const Line_2& h1, const Line_2& h2) const    {      return compare_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),			 h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());    }  };  template <typename K>  class Compare_x_3  {    typedef typename K::Point_3             Point_3;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 2 >                  Arity;    result_type    operator()( const Point_3& p, const Point_3& q) const    { return CGAL_NTS compare(p.x(), q.x()); }  };  template <typename K>  class Compare_yx_2  {    typedef typename K::Point_2            Point_2;  public:    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 2 >                 Arity;    result_type    operator()( const Point_2& p, const Point_2& q) const    { return compare_lexicographically_xyC2(p.y(), p.x(), q.y(), q.x()); }  };  template <typename K>  class Compare_y_at_x_2  {    typedef typename K::Point_2             Point_2;    typedef typename K::Line_2              Line_2;    typedef typename K::Segment_2           Segment_2;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 3 >                  Arity;    result_type    operator()( const Point_2& p, const Line_2& h) const    { return compare_y_at_xC2(p.x(), p.y(), h.a(), h.b(), h.c()); }    result_type    operator()( const Point_2& p, const Line_2& h1, const Line_2& h2) const    {      return compare_y_at_xC2(p.x(), h1.a(), h1.b(), h1.c(),			      h2.a(), h2.b(), h2.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2, const Line_2& h) const    {      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),			      h.a(), h.b(), h.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2,	        const Line_2& h1, const Line_2& h2) const    {      return compare_y_at_xC2(l1.a(), l1.b(), l1.c(), l2.a(), l2.b(), l2.c(),			      h1.a(), h1.b(), h1.c(), h2.a(), h2.b(), h2.c());    }    result_type    operator()( const Point_2& p, const Segment_2& s) const    {      return compare_y_at_xC2(p.x(), p.y(),			      s.source().x(), s.source().y(),			      s.target().x(), s.target().y());    }    result_type    operator()( const Point_2& p,	        const Segment_2& s1, const Segment_2& s2) const    {      return compare_y_at_x_segment_C2(p.x(),				       s1.source().x(), s1.source().y(),				       s1.target().x(), s1.target().y(),				       s2.source().x(), s2.source().y(),				       s2.target().x(), s2.target().y());    }  };  template <typename K>  class Compare_y_2  {    typedef typename K::Point_2             Point_2;    typedef typename K::Line_2              Line_2;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 2 >                  Arity;    result_type    operator()( const Point_2& p, const Point_2& q) const    { return CGAL_NTS compare(p.y(), q.y()); }    result_type    operator()( const Point_2& p, const Line_2& l1, const Line_2& l2) const    {      return compare_xC2(p.y(),			 l1.b(), l1.a(), l1.c(),			 l2.b(), l2.a(), l2.c());    }    result_type    operator()( const Line_2& l, const Line_2& h1, const Line_2& h2) const    {      return compare_xC2(l.b(), l.a(), l.c(), h1.b(), h1.a(), h1.c(),			 l.b(), l.a(), l.c(), h2.b(), h2.a(), h2.c());    }    result_type    operator()( const Line_2& l1, const Line_2& l2,	        const Line_2& h1, const Line_2& h2) const    {      return compare_xC2(l1.b(), l1.a(), l1.c(), l2.b(), l2.a(), l2.c(),			 h1.b(), h1.a(), h1.c(), h2.b(), h2.a(), h2.c());    }  };  template <typename K>  class Compare_y_3  {    typedef typename K::Point_3             Point_3;  public:    typedef typename K::Comparison_result   result_type;    typedef Arity_tag< 2 >                  Arity;    result_type    operator()( const Point_3& p, const Point_3& q) const    { return CGAL_NTS compare(p.y(), q.y()); }  };  template <typename K>  class Compare_z_3  {    typedef typename K::Point_3            Point_3;  public:    typedef typename K::Comparison_result  result_type;    typedef Arity_tag< 2 >                 Arity;    result_type    operator()( const Point_3& p, const Point_3& q) const    { return CGAL_NTS compare(p.z(), q.z()); }  };  template <typename K>  class Compute_area_2  {    typedef typename K::FT                FT;    typedef typename K::Iso_rectangle_2   Iso_rectangle_2;    typedef typename K::Triangle_2        Triangle_2;    typedef typename K::Point_2           Point_2;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    result_type    operator()( const Point_2& p, const Point_2& q, const Point_2& r ) const    {      FT v1x = q.x() - p.x();      FT v1y = q.y() - p.y();      FT v2x = r.x() - p.x();      FT v2y = r.y() - p.y();      return det2x2_by_formula(v1x, v1y, v2x, v2y)/2;    }    result_type    operator()( const Iso_rectangle_2& r ) const    { return (r.xmax()-r.xmin()) * (r.ymax()-r.ymin()); }    result_type    operator()( const Triangle_2& t ) const    { return t.area(); }  };  template <typename K>  class Compute_determinant_2  {    typedef typename K::FT                FT;    typedef typename K::Vector_2          Vector_2;  public:    typedef FT               result_type;    typedef Arity_tag< 2 >   Arity;    result_type    operator()(const Vector_2& v, const Vector_2& w) const    {	return det2x2_by_formula(v.x(), v.y(), w.x(), w.y());    }  };  template <typename K>  class Compute_determinant_3  {    typedef typename K::FT                FT;    typedef typename K::Vector_3          Vector_3;  public:    typedef FT               result_type;    typedef Arity_tag< 3 >   Arity;    result_type    operator()(const Vector_3& v, const Vector_3& w, const Vector_3& t) const    {	return det3x3_by_formula(v.x(), v.y(), v.z(),                                 w.x(), w.y(), w.z(),                                 t.x(), t.y(), t.z());    }  };  template <typename K>  class Compute_scalar_product_2  {    typedef typename K::FT                FT;    typedef typename K::Vector_2          Vector_2;  public:    typedef FT               result_type;    typedef Arity_tag< 2 >   Arity;    result_type    operator()(const Vector_2& v, const Vector_2& w) const    {	return v.x() * w.x() + v.y() * w.y();    }  };  template <typename K>  class Compute_scalar_product_3  {    typedef typename K::FT                FT;    typedef typename K::Vector_3          Vector_3;  public:    typedef FT               result_type;    typedef Arity_tag< 2 >   Arity;    result_type    operator()(const Vector_3& v, const Vector_3& w) const    {	return v.x() * w.x() + v.y() * w.y() + v.z() * w.z();    }  };  template <typename K>  class Compute_squared_area_3  {    typedef typename K::FT                FT;    typedef typename K::Point_3           Point_3;    typedef typename K::Triangle_3        Triangle_3;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    result_type    operator()( const Triangle_3& t ) const    {	return this->operator()(t.vertex(0), t.vertex(1), t.vertex(2));    }    result_type    operator()( const Point_3& p, const Point_3& q, const Point_3& r ) const    {	return squared_areaC3(p.x(), p.y(), p.z(),                              q.x(), q.y(), q.z(),                              r.x(), r.y(), r.z());    }  };  // FIXME  template <typename K>  class Compute_squared_distance_Point_Point_2  {    typedef typename K::FT       FT;    typedef typename K::Point_2  Point_2;  public:    typedef FT               result_type;    typedef Arity_tag< 2 >   Arity;    result_type    operator()( const Point_2& p, const Point_2& q) const    {      return squared_distanceC2(p.x(), p.y(), q.x(), q.y());    }  };  // TODO ...  template <typename K>  class Compute_squared_radius_2  {    typedef typename K::FT          FT;    typedef typename K::Point_2     Point_2;    typedef typename K::Circle_2    Circle_2;  public:    typedef FT               result_type;    typedef Arity_tag< 1 >   Arity;    const result_type&    operator()( const Circle_2& c) const    { return c.rep().squared_radius(); }    result_type    operator()( const Point_2& p, const Point_2& q) const    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y()); }    result_type    operator()( const Point_2& p, const Point_2& q, const Point_2& r) const    { return squared_radiusC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }  };} //namespace CartesianKernelFunctors#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCHtemplate < typename K>struct Qualified_result_of<CartesianKernelFunctors::Compute_squared_radius_2<K>,                           typename K::Circle_2>{  typedef typename K::FT const &   type;};

⌨️ 快捷键说明

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