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

📄 function_objects.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 5 页
字号:
    result_type    operator()(const Circle_2& c1, const Circle_2& c2) const    {      return c1.center() == c2.center() &&	c1.squared_radius() == c2.squared_radius() &&	c1.orientation() == c2.orientation();    }    result_type    operator()(const Triangle_2& t1, const Triangle_2& t2) const    {      int i;      for(i=0; i<3; i++)	if ( t1.vertex(0) == t2.vertex(i) )	  break;      return (i<3) && t1.vertex(1) == t2.vertex(i+1)                   && t1.vertex(2) == t2.vertex(i+2);    }    result_type    operator()(const Iso_rectangle_2& i1, const Iso_rectangle_2& i2) const    {      return ((i1.min)() == (i2.min)()) && ((i1.max)() == (i2.max)());    }  };  template <typename K>  class Equal_3  {    typedef typename K::Point_3       Point_3;    typedef typename K::Vector_3      Vector_3;    typedef typename K::Direction_3   Direction_3;    typedef typename K::Segment_3     Segment_3;    typedef typename K::Line_3        Line_3;    typedef typename K::Ray_3         Ray_3;    typedef typename K::Triangle_3    Triangle_3;    typedef typename K::Tetrahedron_3 Tetrahedron_3;    typedef typename K::Sphere_3      Sphere_3;    typedef typename K::Iso_cuboid_3  Iso_cuboid_3;    typedef typename K::Plane_3       Plane_3;  public:    typedef typename K::Bool_type     result_type;    typedef Arity_tag< 2 >            Arity;    // Point_3 is special case since the global operator== would recurse.    result_type    operator()(const Point_3 &p, const Point_3 &q) const    {      return p.x() == q.x() && p.y() == q.y() && p.z() == q.z();    }    result_type    operator()(const Plane_3 &v1, const Plane_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Iso_cuboid_3 &v1, const Iso_cuboid_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Sphere_3 &v1, const Sphere_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Tetrahedron_3 &v1, const Tetrahedron_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Triangle_3 &v1, const Triangle_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Ray_3 &v1, const Ray_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Line_3 &v1, const Line_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Direction_3 &v1, const Direction_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Segment_3 &v1, const Segment_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Vector_3 &v1, const Vector_3 &v2) const    {      return v1.rep() == v2.rep();    }    result_type    operator()(const Vector_3 &v, const Null_vector &n) const    {      return v.rep() == n;    }  };  template <typename K>  class Has_on_boundary_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;    typedef typename K::Circle_2         Circle_2;    typedef typename K::Triangle_2       Triangle_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Circle_2& c, const Point_2& p) const    { return c.has_on_boundary(p); }    result_type    operator()( const Triangle_2& t, const Point_2& p) const    { return t.has_on_boundary(p); }    result_type    operator()( const Iso_rectangle_2& r, const Point_2& p) const    { return K().bounded_side_2_object()(r,p) == ON_BOUNDARY; }  };  template <typename K>  class Has_on_boundary_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;    typedef typename K::Sphere_3         Sphere_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;    typedef typename K::Plane_3          Plane_3;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Sphere_3& s, const Point_3& p) const    { return s.rep().has_on_boundary(p); }    result_type    operator()( const Tetrahedron_3& t, const Point_3& p) const    { return t.rep().has_on_boundary(p); }    result_type    operator()( const Iso_cuboid_3& c, const Point_3& p) const    { return c.rep().has_on_boundary(p); }  };  template <typename K>  class Has_on_bounded_side_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;    typedef typename K::Circle_2         Circle_2;    typedef typename K::Triangle_2       Triangle_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Circle_2& c, const Point_2& p) const    { return c.has_on_bounded_side(p); }    result_type    operator()( const Triangle_2& t, const Point_2& p) const    { return t.has_on_bounded_side(p); }    result_type    operator()( const Iso_rectangle_2& r, const Point_2& p) const    { return K().bounded_side_2_object()(r,p) == ON_BOUNDED_SIDE; }  };  template <typename K>  class Has_on_bounded_side_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;    typedef typename K::Sphere_3         Sphere_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Sphere_3& s, const Point_3& p) const    { return s.has_on_bounded_side(p); }    result_type    operator()( const Tetrahedron_3& t, const Point_3& p) const    { return t.rep().has_on_bounded_side(p); }    result_type    operator()( const Iso_cuboid_3& c, const Point_3& p) const    { return c.rep().has_on_bounded_side(p); }  };  template <typename K>  class Has_on_negative_side_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Line_2           Line_2;    typedef typename K::Circle_2         Circle_2;    typedef typename K::Triangle_2       Triangle_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Circle_2& c, const Point_2& p) const    { return c.has_on_negative_side(p); }    result_type    operator()( const Triangle_2& t, const Point_2& p) const    { return t.has_on_negative_side(p); }    result_type    operator()( const Line_2& l, const Point_2& p) const    { return l.has_on_negative_side(p); }  };  template <typename K>  class Has_on_negative_side_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Plane_3          Plane_3;    typedef typename K::Sphere_3         Sphere_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Sphere_3& s, const Point_3& p) const    { return s.has_on_negative_side(p); }    result_type    operator()( const Tetrahedron_3& t, const Point_3& p) const    { return t.rep().has_on_negative_side(p); }    result_type    operator()( const Plane_3& pl, const Point_3& p) const    { return pl.rep().has_on_negative_side(p); }  };  template <typename K>  class Has_on_positive_side_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Line_2           Line_2;    typedef typename K::Circle_2         Circle_2;    typedef typename K::Triangle_2       Triangle_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Circle_2& c, const Point_2& p) const    { return c.has_on_positive_side(p); }    result_type    operator()( const Triangle_2& t, const Point_2& p) const    { return t.has_on_positive_side(p); }    result_type    operator()( const Line_2& l, const Point_2& p) const    { return l.has_on_positive_side(p); }  };  template <typename K>  class Has_on_positive_side_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Plane_3          Plane_3;    typedef typename K::Sphere_3         Sphere_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Sphere_3& s, const Point_3& p) const    { return s.has_on_positive_side(p); }    result_type    operator()( const Tetrahedron_3& t, const Point_3& p) const    { return t.rep().has_on_positive_side(p); }    result_type    operator()( const Plane_3& pl, const Point_3& p) const    { return pl.rep().has_on_positive_side(p); }  };  template <typename K>  class Has_on_unbounded_side_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Iso_rectangle_2  Iso_rectangle_2;    typedef typename K::Circle_2         Circle_2;    typedef typename K::Triangle_2       Triangle_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Circle_2& c, const Point_2& p) const    { return c.has_on_unbounded_side(p); }    result_type    operator()( const Triangle_2& t, const Point_2& p) const    { return t.has_on_unbounded_side(p); }    result_type    operator()( const Iso_rectangle_2& r, const Point_2& p) const    {      return K().bounded_side_2_object()(r,p)== ON_UNBOUNDED_SIDE;    }  };  template <typename K>  class Has_on_unbounded_side_3  {    typedef typename K::Point_3          Point_3;    typedef typename K::Iso_cuboid_3     Iso_cuboid_3;    typedef typename K::Sphere_3         Sphere_3;    typedef typename K::Tetrahedron_3    Tetrahedron_3;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Sphere_3& s, const Point_3& p) const    { return s.has_on_unbounded_side(p); }    result_type    operator()( const Tetrahedron_3& t, const Point_3& p) const    { return t.rep().has_on_unbounded_side(p); }    result_type    operator()( const Iso_cuboid_3& c, const Point_3& p) const    { return c.rep().has_on_unbounded_side(p); }  };  template <typename K>  class Has_on_2  {    typedef typename K::Point_2          Point_2;    typedef typename K::Line_2           Line_2;    typedef typename K::Ray_2            Ray_2;    typedef typename K::Segment_2        Segment_2;  public:    typedef typename K::Bool_type        result_type;    typedef Arity_tag< 2 >               Arity;    result_type    operator()( const Line_2& l, const Point_2& p) const    { return l.has_on(p); }    result_type    operator()( const Ray_2& r, const Point_2& p) const    { return r.has_on(p); }    result_type    operator()( const Segment_2& s, const Point_2& p) const    { return s.has_on(p); }  };  template <typename K>  class Intersect_2  {    typedef typename K::Object_2    Object_2;  public:    typedef Object_2                result_type;    typedef Arity_tag< 2 >          Arity;    // 25 possibilities, so I keep the template.    template <class T1, class T2>    Object_2    operator()(const T1& t1, const T2& t2) const    { return CGALi::intersection(t1, t2, K()); }  };  template <typename K>  class Intersect_3  {    typedef typename K::Object_3    Object_3;    typedef typename K::Plane_3     Plane_3;  public:    typedef Object_3                result_type;    typedef Arity_tag< 2 >          Arity;    // n possibilities, so I keep the template.    template <class T1, class T2>    Object_3    operator()(const T1& t1, const T2& t2) const    { return CGALi::intersection(t1, t2, K() ); }    Object_3    operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const    { return CGALi::intersection(pl1, pl2, pl3, K() ); }  };  template <typename K>  class Is_degenerate_2  {    typedef typename K::Circle_2          Circle_2;    typedef typename K::Iso_rectangle_2   Iso_rectangle_2;    typedef typename K::Line_2            Line_2;    typedef typename K::Ray_2             Ray_2;    typedef typename K::Segment_2         Segment_2;    typedef typename K::Triangle_2        Triangle_2;  public:    typedef typename K::Bool_type         result_type;    typedef Arity_tag< 1 >                Arity;    result_type    operator()( const Circle_2& c) const    { return c.is_degenerate(); }    result_type    operator()( const Iso_rectangle_2& r) const    { return (r.xmin() == r.xmax()) || (r.ymin() == r.ymax()); }    result_type    operator()( const Line_2& l) const    { return CGAL_NTS is_zero(l.a())  && CGAL_NTS is_zero(l.b()); }    result_type    operator()( const Ray_2& r) const    { return r.rep().is_degenerate(); }    result_type    operator()( const Segment_2& s) const    { return s.source() == s.target(); }    result_type    operator()( const Triangle_2& t) const    { return t.is_degenerate(); }  };  template <typename K>  class Is_degenerate_3  {    typedef typename K::Iso_cuboid_3      Iso_cuboid_3;    typedef typename K::Line_3            Line_3;    typedef typename K::Plane_3           Plane_3;    typedef typename K::Ray_3             Ray_3;    typedef typename K::Segment_3         Segment_3;    typedef typename K::Sphere_3          Sphere_3;    typedef typename K::Triangle_3        Triang

⌨️ 快捷键说明

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