File: Polygon_offset_pred_ftC2.h

package info (click to toggle)
cgal 6.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (64 lines) | stat: -rw-r--r-- 2,052 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2006 Fernando Luis Cacciola Carballal. All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1.1/Straight_skeleton_2/include/CGAL/predicates/Polygon_offset_pred_ftC2.h $
// $Id: include/CGAL/predicates/Polygon_offset_pred_ftC2.h 08b27d3db14 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s)     : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef CGAL_POLYGON_OFFSET_PRED_FTC2_H
#define CGAL_POLYGON_OFFSET_PRED_FTC2_H 1

#include <CGAL/license/Straight_skeleton_2.h>

#include <CGAL/constructions/Straight_skeleton_cons_ftC2.h>
#include <CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h>
#include <CGAL/Uncertain.h>

#include <optional>

namespace CGAL {

namespace CGAL_SS_i {

// Given a triple of oriented straight line segments: (e0,e1,e2) such that
// there exists a distance 'et' for which the offsets lines at 'et' (e0',e1',e2') intersect in a single point;
// returns the relative order of 't' w.r.t. 'et'.
// PRECONDITION: There exists a positive distance et for which the offset triple intersect at a single point.
template<class K>
Uncertain<Comparison_result>
compare_offset_against_isec_timeC2 ( typename K::FT const& t,
                                     Trisegment_2_ptr< Trisegment_2<K, Segment_2_with_ID<K> > > const& tri )
{
  typedef typename K::FT FT ;

  typedef Rational<FT> Rational ;
  typedef Quotient<FT> Quotient ;

  typedef std::optional<Rational> Optional_rational ;

  Uncertain<Comparison_result> rResult = Uncertain<Comparison_result>::indeterminate();

  No_caches<K> no_caches;

  Optional_rational et_ = compute_offset_lines_isec_timeC2(tri, no_caches);
  if ( et_ )
  {
    Quotient et = et_->to_quotient();
    CGAL_assertion ( CGAL_NTS certified_is_positive(et) ) ;

    rResult = CGAL_NTS certified_compare( Quotient(t), et);
  }

  return rResult ;
}

} // namespace CGAL_SS_i

} // end namespace CGAL

#endif // CGAL_POLYGON_OFFSET_PRED_FTC2_H //
// EOF //