Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext
assign_values (3 coordinate values)

Assign three values to a geometry (usually a 3D point)

Synopsis

template<typename Geometry, typename Type>
void assign_values(Geometry & geometry, Type const & c1, Type const & c2, Type const & c3)

Parameters

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)

Header

#include <boost/geometry/algorithms/detail/assign_values.hpp>

Example

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)
See also

PrevUpHomeNext