annotate DEPENDENCIES/generic/include/boost/polygon/segment_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 segment_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_SEGMENT_DATA_HPP
Chris@16 13 #define BOOST_POLYGON_SEGMENT_DATA_HPP
Chris@16 14
Chris@16 15 #include "isotropy.hpp"
Chris@16 16 #include "segment_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 segment_data {
Chris@16 23 public:
Chris@16 24 typedef T coordinate_type;
Chris@16 25 typedef point_data<T> point_type;
Chris@16 26
Chris@16 27 segment_data()
Chris@16 28 #ifndef BOOST_POLYGON_MSVC
Chris@16 29 : points_()
Chris@16 30 #endif
Chris@16 31 {}
Chris@16 32
Chris@16 33 segment_data(const point_type& low, const point_type& high) {
Chris@16 34 points_[LOW] = low;
Chris@16 35 points_[HIGH] = high;
Chris@16 36 }
Chris@16 37
Chris@16 38 segment_data(const segment_data& that) {
Chris@16 39 points_[0] = that.points_[0];
Chris@16 40 points_[1] = that.points_[1];
Chris@16 41 }
Chris@16 42
Chris@16 43 segment_data& operator=(const segment_data& that) {
Chris@16 44 points_[0] = that.points_[0];
Chris@16 45 points_[1] = that.points_[1];
Chris@16 46 return *this;
Chris@16 47 }
Chris@16 48
Chris@16 49 template <typename SegmentType>
Chris@16 50 segment_data& operator=(const SegmentType& that) {
Chris@16 51 assign(*this, that);
Chris@16 52 return *this;
Chris@16 53 }
Chris@16 54
Chris@16 55 point_type get(direction_1d dir) const {
Chris@16 56 return points_[dir.to_int()];
Chris@16 57 }
Chris@16 58
Chris@16 59 void set(direction_1d dir, const point_type& point) {
Chris@16 60 points_[dir.to_int()] = point;
Chris@16 61 }
Chris@16 62
Chris@16 63 point_type low() const {
Chris@16 64 return points_[LOW];
Chris@16 65 }
Chris@16 66
Chris@16 67 segment_data& low(const point_type& point) {
Chris@16 68 points_[LOW] = point;
Chris@16 69 return *this;
Chris@16 70 }
Chris@16 71
Chris@16 72 point_type high() const {
Chris@16 73 return points_[HIGH];
Chris@16 74 }
Chris@16 75
Chris@16 76 segment_data& high(const point_type& point) {
Chris@16 77 points_[HIGH] = point;
Chris@16 78 return *this;
Chris@16 79 }
Chris@16 80
Chris@16 81 bool operator==(const segment_data& that) const {
Chris@16 82 return (points_[0] == that.points_[0]) &&
Chris@16 83 (points_[1] == that.points_[1]);
Chris@16 84 }
Chris@16 85
Chris@16 86 bool operator!=(const segment_data& that) const {
Chris@16 87 return (points_[0] != that.points_[0]) ||
Chris@16 88 (points_[1] != that.points_[1]);
Chris@16 89 }
Chris@16 90
Chris@16 91 bool operator<(const segment_data& that) const {
Chris@16 92 if (points_[0] != that.points_[0]) {
Chris@16 93 points_[0] < that.points_[0];
Chris@16 94 }
Chris@16 95 return points_[1] < that.points_[1];
Chris@16 96 }
Chris@16 97
Chris@16 98 bool operator<=(const segment_data& that) const {
Chris@16 99 return !(that < *this);
Chris@16 100 }
Chris@16 101
Chris@16 102 bool operator>(const segment_data& that) const {
Chris@16 103 return that < *this;
Chris@16 104 }
Chris@16 105
Chris@16 106 bool operator>=(const segment_data& that) const {
Chris@16 107 return !((*this) < that);
Chris@16 108 }
Chris@16 109
Chris@16 110 private:
Chris@16 111 point_type points_[2];
Chris@16 112 };
Chris@16 113
Chris@16 114 template <typename CType>
Chris@16 115 struct geometry_concept<segment_data<CType> > {
Chris@16 116 typedef segment_concept type;
Chris@16 117 };
Chris@16 118 } // polygon
Chris@16 119 } // boost
Chris@16 120
Chris@16 121 #endif // BOOST_POLYGON_SEGMENT_DATA_HPP