// ====================================================================== // // Copyright (c) 2000 The CGAL Consortium // // This software and related documentation is part of an INTERNAL release // of the Computational Geometry Algorithms Library (CGAL). It is not // intended for general use. // // ---------------------------------------------------------------------- // // release : $CGAL_Revision: CGAL-2.2-I-12 $ // release_date : $CGAL_Date: 2000/04/07 $ // // file : include/CGAL/Random_polygon_traits_2.h // package : $CGAL_Package $ // chapter : Geometric Object Generators // // revision : 1.0 // revision_date : 19 April 2000 // // author(s) : Susan Hert // // coordinator : ETH Zurich (Bernd Gaertner ) // // implementation: Random Simple Polygon Traits // ====================================================================== #ifndef CGAL_RANDOM_POLYGON_TRAITS_2_H #define CGAL_RANDOM_POLYGON_TRAITS_2_H #include #include #include #include #include #include #include #include CGAL_BEGIN_NAMESPACE //-----------------------------------------------------------------------// // Random_polygon_traits_2 //-----------------------------------------------------------------------// template class Random_polygon_traits_2 { public: typedef R_ R; typedef typename R::FT FT; typedef Point_2 Point_2; typedef ::CGAL::Segment_2 Segment_2; typedef ::CGAL::Vector_2 Vector_2; typedef ::CGAL::p_Less_yx Less_yx; bool lexicographically_yx_smaller_or_equal(const Point_2& p, const Point_2& q) const { return ::CGAL::lexicographically_yx_smaller_or_equal(p,q); } FT cross_product_2(const Vector_2& p, const Vector_2& q) const { return p.x() * q.y() - q.x() * p.y(); // there should be multiple versions of this function // to distinguish between cartesian and homogeneous coordinates // (for efficiency reasons) } bool is_negative(const FT& x) const { return CGAL_NTS is_negative(x); } bool do_intersect(const Point_2& p1, const Point_2& q1, const Point_2& p2, const Point_2& q2) const { return ::CGAL::do_intersect(Segment_2(p1,q1), Segment_2(p2,q2)); } Comparison_result compare_x(const Point_2 &p, const Point_2 &q) const { return ::CGAL::compare_x(p, q); } Comparison_result compare_y(const Point_2 &p, const Point_2 &q) const { return ::CGAL::compare_y(p, q); } bool have_equal_direction(const Vector_2& v1, const Vector_2& v2 ) const { return ::CGAL::Direction_2(v1) == ::CGAL::Direction_2(v2); } }; CGAL_END_NAMESPACE #endif // CGAL_RANDOM_POLYGON_TRAITS_2_H