CGAL::Exact_predicates_inexact_constructions_kernel CGAL::Exact_predicates_exact_constructions_kernel CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt |
#include <CGAL/MP_Float.h> #include <CGAL/Homogeneous.h> typedef CGAL::Homogeneous<CGAL::MP_Float> Kernel typedef Kernel::Point_2 Point_2 int main() { Point_2 p(0,0), q(10,3), r(12,19); if (CGAL::orientation(q,p,r) == CGAL::LEFT_TURN) return 0; return 1 } |
#include <CGAL/MP_Float.h> #include <CGAL/Homogeneous.h> typedef CGAL::Homogeneous<CGAL::MP_Float> Kernel typedef Kernel::Point_2 Point_2 typedef Kernel::Orientation_2 Orientation_2; int main() { Kernel kernel; Orientation_2 orientation = Kernel.orientation_2_object(); Point_2 p(0,0), q(10,3), r(12,19); if (orientation(q,p,r) == CGAL::LEFT_TURN) return 0; return 1 } |
template <class Iterator, class Output, class Traits> Output upper_hull1(Iterator first, Iterator beyond, Output result, Traits traits) { typename Traits::Less_xy_2 less_xy = traits.less_xy_2_object(); typename Traits::Left_turn_2 left_turn = traits.left_turn_2_object(); if (first == beyond) // empty sequence return result; std::sort(first, beyond, less_xy); // lexicographic sorting std::vector<typename Traits::Point_2> hull; hull.push_back(*first); // sentinel hull.push_back(*first); // upper convex hull (left to right) for (++first; first != beyond; ++first) { while (left_turn(hull.end()[-2], hull.back(), *first)) hull.pop_back(); hull.push_back(*first); } return std::copy(hull.begin() + 1, hull.end(), result); // return result } |
template <class Iterator, class Output, class Traits> Output upper_hull2(Iterator first, Iterator beyond, Output result, Traits traits) { typename Traits::Less_xy_2 less_xy = traits.less_xy_2_object(); typename Traits::Left_turn_2 left_turn = traits.left_turn_2_object(); if (first == beyond) // empty sequence return result; std::sort(first, beyond, less_xy); // lexicographic sorting std::vector<typename Traits::Point_2> hull; hull.push_back(*first); // sentinel typename Traits::Point_2 p = *first; // last point on the hull ++first; // next candidate for hull point // scan all points from left to right for upper convex hull for (; first != beyond; ++first) { while (left_turn(hull.back(), p, *first)) { p = hull.back(); hull.pop_back(); } hull.push_back(p); p = *first; } hull.push_back(p); return std::copy(hull.begin() + 1, hull.end(), result); // return result } |
template <class Iterator, class Output, class Traits> Output upper_hull3(Iterator first, Iterator beyond, Output result, Traits traits) { typename Traits::Less_xy_2 less_xy = traits.less_xy_2_object(); typename Traits::Left_turn_2 left_turn = traits.left_turn_2_object(); if (first == beyond) // empty sequence return result; std::sort(first, beyond, less_xy); // lexicographic sorting std::vector<Iterator> hull; hull.push_back(first); // sentinel Iterator p = first; // last point on the hull ++first; // next candidate for hull point // scan all points from left to right for upper convex hull for (; first != beyond; ++first) { while (left_turn(*(hull.back()), *p, *first)) { p = hull.back(); hull.pop_back(); } hull.push_back(p); p = first; } typename std::vector<Iterator>::iterator i = hull.begin(); ++i; // skip sentinel while (i != hull.end()) *result++ = **i++; return result; } |
template <class Iterator, class Pred> // bidirectional iterator Iterator remove_if_triple(Iterator first, Iterator beyond, Pred pred) { if (first == beyond) return first; // setup iterators i,j,k for scanning triples Iterator i = first, j = first; if (++j == beyond) // i,j mark two elements on top of stack return j; Iterator k = j; // k marks the third value in the sequence while (++k != beyond) { while ((pred(*i, *j, *k))) { j = i; // remove one element from stack if (i == first) // explicit test for stack underflow break; --i; // remove one element from the stack, part 2 } i = j; // push new element from k on stack ++j; *j = *k; } return ++j; } template <class Iterator, class Output, class Traits> Output upper_hull(Iterator first, Iterator beyond, Output result, Traits traits) { typename Traits::Less_xy_2 less_xy = traits.less_xy_2_object(); typename Traits::Left_turn_2 left_turn = traits.left_turn_2_object(); if (first == beyond) // empty sequence return result; std::sort(first, beyond, less_xy); // lexicographic sorting Iterator hull_end = remove_if_triple(first, beyond, left_turn); return std::copy(first, hull_end, result); } |
template<class Kernel, class Container> Polygon_with_holes_2 |
template<typename Traits, typename Dcel, typename OutputIterator> OutputIterator decompose(Arrangement_2<Traits,Dcel> arr, OutputIterator oi) |
template <class InputIterator, class OutputIterator> OutputIterator join(InputIterator begin, InputIterator end, OutputIterator oi) |
CGAL::Polygon_set_2<Kernel> |
CGAL::Arrangement_2<Traits,Dcel> |