File indexing completed on 2025-01-18 09:35:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_GEOMETRY_GEOMETRIES_POINT_XYZ_HPP
0014 #define BOOST_GEOMETRY_GEOMETRIES_POINT_XYZ_HPP
0015
0016 #include <cstddef>
0017 #include <type_traits>
0018
0019 #include <boost/geometry/core/cs.hpp>
0020 #include <boost/geometry/geometries/point.hpp>
0021
0022 namespace boost { namespace geometry
0023 {
0024
0025 namespace model { namespace d3
0026 {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
0043 class point_xyz : public model::point<CoordinateType, 3, CoordinateSystem>
0044 {
0045 public:
0046
0047 constexpr point_xyz() = default;
0048
0049
0050 constexpr point_xyz(CoordinateType const& x, CoordinateType const& y, CoordinateType const& z)
0051 : model::point<CoordinateType, 3, CoordinateSystem>(x, y, z)
0052 {}
0053
0054
0055 constexpr CoordinateType const& x() const
0056 { return this->template get<0>(); }
0057
0058
0059 constexpr CoordinateType const& y() const
0060 { return this->template get<1>(); }
0061
0062
0063 constexpr CoordinateType const& z() const
0064 { return this->template get<2>(); }
0065
0066
0067 void x(CoordinateType const& v)
0068 { this->template set<0>(v); }
0069
0070
0071 void y(CoordinateType const& v)
0072 { this->template set<1>(v); }
0073
0074
0075 void z(CoordinateType const& v)
0076 { this->template set<2>(v); }
0077 };
0078
0079
0080 }}
0081
0082
0083
0084 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0085 namespace traits
0086 {
0087
0088 template <typename CoordinateType, typename CoordinateSystem>
0089 struct tag<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
0090 {
0091 typedef point_tag type;
0092 };
0093
0094 template<typename CoordinateType, typename CoordinateSystem>
0095 struct coordinate_type<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
0096 {
0097 typedef CoordinateType type;
0098 };
0099
0100 template<typename CoordinateType, typename CoordinateSystem>
0101 struct coordinate_system<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
0102 {
0103 typedef CoordinateSystem type;
0104 };
0105
0106 template<typename CoordinateType, typename CoordinateSystem>
0107 struct dimension<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
0108 : std::integral_constant<std::size_t, 3>
0109 {};
0110
0111 template<typename CoordinateType, typename CoordinateSystem, std::size_t Dimension>
0112 struct access<model::d3::point_xyz<CoordinateType, CoordinateSystem>, Dimension>
0113 {
0114 static constexpr CoordinateType get(
0115 model::d3::point_xyz<CoordinateType, CoordinateSystem> const& p)
0116 {
0117 return p.template get<Dimension>();
0118 }
0119
0120 static void set(model::d3::point_xyz<CoordinateType, CoordinateSystem>& p,
0121 CoordinateType const& value)
0122 {
0123 p.template set<Dimension>(value);
0124 }
0125 };
0126
0127 template<typename CoordinateType, typename CoordinateSystem>
0128 struct make<model::d3::point_xyz<CoordinateType, CoordinateSystem> >
0129 {
0130 typedef model::d3::point_xyz<CoordinateType, CoordinateSystem> point_type;
0131
0132 static const bool is_specialized = true;
0133
0134 static constexpr point_type apply(CoordinateType const& x,
0135 CoordinateType const& y,
0136 CoordinateType const& z)
0137 {
0138 return point_type(x, y, z);
0139 }
0140 };
0141
0142
0143 }
0144 #endif
0145
0146 }}
0147
0148 #endif