Exemple #1
0
 std::size_t hash_value(const CGAL::Segment_2<Kernel>& segment)
 {
   std::size_t seed = 0;
   boost::hash_combine(seed, segment.source());
   boost::hash_combine(seed, segment.target());
   return seed;
 }
Exemple #2
0
// get the point position on segment
// in [0,1] if its on the interior
static Kernel::FT point_position( const CGAL::Segment_2<Kernel>& seg, const CGAL::Point_2<Kernel>& pt )
{
    CGAL::Point_2<Kernel> pA = seg.source();
    CGAL::Point_2<Kernel> pB = seg.target();
    Kernel::FT num = pt.x() - pA.x();
    Kernel::FT den = pB.x() - pA.x();

    if ( den == 0 ) {
        num = pt.y() - pA.y();
        den = pB.y() - pA.y();
    }

    return num / den;
}