// ====================================================================== // // Copyright (c) 1999 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 : // release_date : // // file : predicates_on_linesH2.h // package : H2 // revision : $Revision$ // revision_date : $Date$ // author(s) : Stefan Schirra // // // coordinator : MPI, Saarbruecken () // ====================================================================== #ifndef CGAL_PREDICATES_ON_LINESH2_H #define CGAL_PREDICATES_ON_LINESH2_H #include #include #include #include CGAL_BEGIN_NAMESPACE template CGAL_KERNEL_INLINE Comparison_result compare_x(const PointH2& p, const LineH2& l1, const LineH2& l2) { PointH2 ip = gp_linear_intersection( l1, l2 ); return compare_x( p, ip ); } template CGAL_KERNEL_INLINE Comparison_result compare_x(const LineH2& l1, const LineH2& l2, const LineH2& h1, const LineH2& h2) { PointH2 lip = gp_linear_intersection( l1, l2 ); PointH2 hip = gp_linear_intersection( h1, h2 ); return compare_x( lip, hip ); } template < class R > inline Comparison_result compare_x(const Line_2 &l, const Line_2 &h1, const Line_2 &h2) { return compare_x(l, h1, l, h2); } template CGAL_KERNEL_INLINE Comparison_result compare_y(const PointH2& p, const LineH2& l1, const LineH2& l2) { PointH2 ip = gp_linear_intersection( l1, l2 ); return compare_y( p, ip ); } template CGAL_KERNEL_INLINE Comparison_result compare_y(const LineH2& l1, const LineH2& l2, const LineH2& h1, const LineH2& h2) { PointH2 lip = gp_linear_intersection( l1, l2 ); PointH2 hip = gp_linear_intersection( h1, h2 ); return compare_y( lip, hip ); } template < class R > inline Comparison_result compare_y(const Line_2 &l, const Line_2 &h1, const Line_2 &h2) { return compare_y(l, h1, l, h2); } template CGAL_KERNEL_MEDIUM_INLINE Comparison_result compare_y_at_x(const PointH2& p, const LineH2& h) { typedef typename R::RT RT; CGAL_kernel_precondition( ! h.is_vertical() ); Oriented_side ors = h.oriented_side( p ); if ( h.b() < RT(0) ) { ors = opposite( ors ); } if ( ors == ON_POSITIVE_SIDE ) { return LARGER; } return ( ors == ON_NEGATIVE_SIDE ) ? SMALLER : EQUAL; } template CGAL_KERNEL_INLINE Comparison_result compare_y_at_x(const PointH2& p, const LineH2& h1, const LineH2& h2) { return CGAL_NTS compare(h1.y_at_x( p.x() ), h2.y_at_x( p.x() )); } template CGAL_KERNEL_INLINE Comparison_result compare_y_at_x(const LineH2& l1, const LineH2& l2, const LineH2& h) { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h); } template CGAL_KERNEL_INLINE Comparison_result compare_y_at_x(const LineH2& l1, const LineH2& l2, const LineH2& h1, const LineH2& h2) { return compare_y_at_x( gp_linear_intersection( l1, l2 ), h1, h2 ); } template CGAL_KERNEL_MEDIUM_INLINE Comparison_result compare_x_at_y(const PointH2& p, const LineH2& h) { typedef typename R::RT RT; CGAL_kernel_precondition( ! h.is_horizontal() ); Oriented_side ors = h.oriented_side( p ); if ( h.a() < RT(0) ) { ors = opposite( ors ); } if ( ors == ON_POSITIVE_SIDE ) { return LARGER; } return ( ors == ON_NEGATIVE_SIDE ) ? SMALLER : EQUAL; } template CGAL_KERNEL_INLINE Comparison_result compare_x_at_y(const PointH2& p, const LineH2& h1, const LineH2& h2) { return CGAL_NTS compare(h1.x_at_y( p.y() ), h2.x_at_y( p.y() )); } template CGAL_KERNEL_INLINE Comparison_result compare_x_at_y(const LineH2& l1, const LineH2& l2, const LineH2& h) { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h); } template CGAL_KERNEL_INLINE Comparison_result compare_x_at_y(const LineH2& l1, const LineH2& l2, const LineH2& h1, const LineH2& h2) { return compare_x_at_y( gp_linear_intersection( l1, l2 ), h1, h2 ); } CGAL_END_NAMESPACE #endif // CGAL_PREDICATES_ON_LINESH2_H