Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:28

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2020 Digvijay Janartha, Hamirpur, India.
0004 
0005 // This file was modified by Oracle on 2020.
0006 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0008 
0009 // Use, modification and distribution is subject to the Boost Software License,
0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
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 \brief 3D point in Cartesian coordinate system
0030 \tparam CoordinateType numeric type, for example, double, float, int
0031 \tparam CoordinateSystem coordinate system, defaults to cs::cartesian
0032 
0033 \qbk{[include reference/geometries/point_xyz.qbk]}
0034 \qbk{before.synopsis,
0035 [heading Model of]
0036 [link geometry.reference.concepts.concept_point Point Concept]
0037 }
0038 
0039 \qbk{[include reference/geometries/point_assign_warning.qbk]}
0040 
0041 */
0042 template<typename CoordinateType, typename CoordinateSystem = cs::cartesian>
0043 class point_xyz : public model::point<CoordinateType, 3, CoordinateSystem>
0044 {
0045 public:
0046     /// \constructor_default_no_init
0047     constexpr point_xyz() = default;
0048 
0049     /// Constructor with x/y/z values
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     /// Get x-value
0055     constexpr CoordinateType const& x() const
0056     { return this->template get<0>(); }
0057 
0058     /// Get y-value
0059     constexpr CoordinateType const& y() const
0060     { return this->template get<1>(); }
0061 
0062     /// Get z-value
0063     constexpr CoordinateType const& z() const
0064     { return this->template get<2>(); }
0065 
0066     /// Set x-value
0067     void x(CoordinateType const& v)
0068     { this->template set<0>(v); }
0069 
0070     /// Set y-value
0071     void y(CoordinateType const& v)
0072     { this->template set<1>(v); }
0073 
0074     /// Set z-value
0075     void z(CoordinateType const& v)
0076     { this->template set<2>(v); }
0077 };
0078 
0079 
0080 }} // namespace model::d3
0081 
0082 
0083 // Adapt the point_xyz to the concept
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 } // namespace traits
0144 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0145 
0146 }} // namespace boost::geometry
0147 
0148 #endif // BOOST_GEOMETRY_GEOMETRIES_POINT_XYZ_HPP