]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/assign_2d_point.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
11 //` Shows the usage of assign to set point coordinates, and, besides that, shows how you can initialize ttmath points with high precision
16 #include <boost/geometry.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
19 #if defined(HAVE_TTMATH)
20 # include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
26 using boost::geometry::assign_values
;
29 boost::geometry::model::d2::point_xy
<double> p1
;
30 assign_values(p1
, 1.2345, 2.3456);
32 #if defined(HAVE_TTMATH)
33 boost::geometry::model::d2::point_xy
<ttmath::Big
<1,4> > p2
;
34 assign_values(p2
, "1.2345", "2.3456"); /*< It is possible to assign coordinates with other types than the coordinate type.
35 For ttmath, you can e.g. conveniently use strings. The advantage is that it then has higher precision, because
36 if doubles are used for assignments the double-precision is used.
41 << std::setprecision(20)
42 << boost::geometry::dsv(p1
) << std::endl
43 #if defined(HAVE_TTMATH)
44 << boost::geometry::dsv(p2
) << std::endl
54 //[assign_2d_point_output
58 (1.2344999999999999, 2.3456000000000001)