...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Assign three values to a geometry (usually a 3D point)
template<typename Geometry, typename Type> void assign_values(Geometry & geometry, Type const & c1, Type const & c2, Type const & c3)
Type |
Concept |
Name |
Description |
---|---|---|---|
Geometry & |
Any type fulfilling a Geometry Concept |
geometry |
A model of the specified concept |
Type const & |
numerical type (int, double, ttmath, ...) to specify the coordinates |
c1 |
First coordinate (usually x-coordinate) |
Type const & |
numerical type (int, double, ttmath, ...) to specify the coordinates |
c2 |
Second coordinate (usually y-coordinate) |
Type const & |
numerical type (int, double, ttmath, ...) to specify the coordinates |
c3 |
Third coordinate (usually z-coordinate) |
Either
#include <boost/geometry.hpp>
Or
#include <boost/geometry/algorithms/assign.hpp>
Use assign to set three coordinates of a 3D point
#include <iostream> #include <iomanip> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point.hpp> int main() { boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian> p; boost::geometry::assign_values(p, 1.2345, 2.3456, 3.4567); std::cout << boost::geometry::dsv(p) << std::endl; return 0; }
Output:
(1.2345, 2.3456, 3.4567)