annotate DEPENDENCIES/generic/include/boost/polygon/interval_data.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Polygon library interval_data.hpp header file
Chris@16 2
Chris@16 3 // Copyright (c) Intel Corporation 2008.
Chris@16 4 // Copyright (c) 2008-2012 Simonson Lucanus.
Chris@16 5 // Copyright (c) 2012-2012 Andrii Sydorchuk.
Chris@16 6
Chris@16 7 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 8 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 10 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 11
Chris@16 12 #ifndef BOOST_POLYGON_INTERVAL_DATA_HPP
Chris@16 13 #define BOOST_POLYGON_INTERVAL_DATA_HPP
Chris@16 14
Chris@16 15 #include "isotropy.hpp"
Chris@16 16 #include "interval_concept.hpp"
Chris@16 17
Chris@16 18 namespace boost {
Chris@16 19 namespace polygon {
Chris@16 20
Chris@16 21 template <typename T>
Chris@16 22 class interval_data {
Chris@16 23 public:
Chris@16 24 typedef T coordinate_type;
Chris@16 25
Chris@16 26 interval_data()
Chris@16 27 #ifndef BOOST_POLYGON_MSVC
Chris@16 28 : coords_()
Chris@16 29 #endif
Chris@16 30 {}
Chris@16 31
Chris@16 32 interval_data(coordinate_type low, coordinate_type high) {
Chris@16 33 coords_[LOW] = low;
Chris@16 34 coords_[HIGH] = high;
Chris@16 35 }
Chris@16 36
Chris@16 37 interval_data(const interval_data& that) {
Chris@16 38 coords_[0] = that.coords_[0];
Chris@16 39 coords_[1] = that.coords_[1];
Chris@16 40 }
Chris@16 41
Chris@16 42 interval_data& operator=(const interval_data& that) {
Chris@16 43 coords_[0] = that.coords_[0];
Chris@16 44 coords_[1] = that.coords_[1];
Chris@16 45 return *this;
Chris@16 46 }
Chris@16 47
Chris@16 48 template <typename IntervalType>
Chris@16 49 interval_data& operator=(const IntervalType& that) {
Chris@16 50 assign(*this, that);
Chris@16 51 return *this;
Chris@16 52 }
Chris@16 53
Chris@16 54 coordinate_type get(direction_1d dir) const {
Chris@16 55 return coords_[dir.to_int()];
Chris@16 56 }
Chris@16 57
Chris@16 58 void set(direction_1d dir, coordinate_type value) {
Chris@16 59 coords_[dir.to_int()] = value;
Chris@16 60 }
Chris@16 61
Chris@16 62 coordinate_type low() const {
Chris@16 63 return coords_[0];
Chris@16 64 }
Chris@16 65
Chris@16 66 interval_data& low(coordinate_type value) {
Chris@16 67 coords_[LOW] = value;
Chris@16 68 return *this;
Chris@16 69 }
Chris@16 70
Chris@16 71 coordinate_type high() const {
Chris@16 72 return coords_[1];
Chris@16 73 }
Chris@16 74
Chris@16 75 interval_data& high(coordinate_type value) {
Chris@16 76 coords_[HIGH] = value;
Chris@16 77 return *this;
Chris@16 78 }
Chris@16 79
Chris@16 80 bool operator==(const interval_data& that) const {
Chris@16 81 return low() == that.low() && high() == that.high();
Chris@16 82 }
Chris@16 83
Chris@16 84 bool operator!=(const interval_data& that) const {
Chris@16 85 return low() != that.low() || high() != that.high();
Chris@16 86 }
Chris@16 87
Chris@16 88 bool operator<(const interval_data& that) const {
Chris@16 89 if (coords_[0] != that.coords_[0]) {
Chris@16 90 return coords_[0] < that.coords_[0];
Chris@16 91 }
Chris@16 92 return coords_[1] < that.coords_[1];
Chris@16 93 }
Chris@16 94
Chris@16 95 bool operator<=(const interval_data& that) const {
Chris@16 96 return !(that < *this);
Chris@16 97 }
Chris@16 98
Chris@16 99 bool operator>(const interval_data& that) const {
Chris@16 100 return that < *this;
Chris@16 101 }
Chris@16 102
Chris@16 103 bool operator>=(const interval_data& that) const {
Chris@16 104 return !((*this) < that);
Chris@16 105 }
Chris@16 106
Chris@16 107 private:
Chris@16 108 coordinate_type coords_[2];
Chris@16 109 };
Chris@16 110
Chris@16 111 template <typename CType>
Chris@16 112 struct geometry_concept< interval_data<CType> > {
Chris@16 113 typedef interval_concept type;
Chris@16 114 };
Chris@16 115 } // polygon
Chris@16 116 } // boost
Chris@16 117
Chris@16 118 #endif // BOOST_POLYGON_INTERVAL_DATA_HPP