geometry/doc/quickbook/arithmetic.qbk
2012-01-09 21:56:08 +00:00

233 lines
4.8 KiB
Plaintext

[/==============================================================================
Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Copyright (c) 2009-2012 Mateusz Loskot, London, UK., London, UK
Use, modification and distribution is subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
===============================================================================/]
[section Arithmetic]
__boost_geometry__ provides a set of arithmetic operations defined for point geometries.
[section add_point]
[heading Description]
Adds one point to another.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point1, typename Point2>
void add_point(Point1 &p1, Point2 const &p2);
}}
[table Parameters
[[Parameter] [Requirement] [Description]]
[[`p1`, `p2`] [Models of __concept_point__]
[First point used as operation input and output. Second point usedas input]]
]
[table Expression Semantics
[[Expression] [Return Type] [Description]]
[[__add_point__(p1, p2);] [`void`]
[Coordinates of `p2` are added to corresponding coordinates of `p1`. The `p2` is not modified]]
]
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
#include <boost/geometry/arithmetic/arithmetic.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/util/write_dsv.hpp>
#include <iostream>
int main()
{
using namespace boost::geometry;
point_xy<int> p1(1, 3);
point_xy<int> p2(2, 4);
add_point(p1, p2);
std::cout << "p1 = " << dsv(p1) << std::endl;
}
[endsect] [/ end of section add_point]
[section add_value]
[heading Description]
Adds a value to each coordinate of a point.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point>
void add_value(Point &p, typename detail::param<Point>::type value)
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section add_value]
[section divide_point]
[heading Description]
Divides a point by another.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point1 , typename Point2>
void divide_point(Point1 &p1, Point2 const &p2);
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section divide_point]
[section divide_value]
[heading Description]
Divides each coordinate of a point by a value.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point>
void divide_value(Point &p, typename detail::param< Point>::type value);
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section divide_value]
[section multiply_point]
[heading Description]
Multiplies a point by another.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point1 , typename Point2>
void multiply_point(Point1 &p1, Point2 const &p2);
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section multiply_point]
[section multiply_value]
[heading Description]
Multiplies each coordinate of a point by a value.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point>
void multiply_value(Point &p, typename detail::param<Point>::type value);
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section multiply_value]
[section subtract_point]
[heading Description]
Subtracts a point to another.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point1 , typename Point2>
void subtract_point(Point1 &p1, Point2 const &p2)
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section subtract_point]
[section subtract_value]
[heading Description]
Subtracts a value to each coordinate of a point.
[heading Synopsis]
namespace boost { namespace geometry {
template<typename Point>
void subtract_value(Point &p, typename detail::param<Point>::type value)
}}
[heading Header]
#include <boost/geometry/arithmetic/arithmetic.hpp>
[heading Example]
int foo();
[endsect] [/ end of section subtract_value]
[endsect] [/ end of section Arithmetic]