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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
assign_inverse

assign to a box inverse infinite

Description

The assign_inverse function initialize a 2D or 3D box with large coordinates, the min corner is very large, the max corner is very small. This is a convenient starting point to collect the minimum bounding box of a geometry.

Synopsis

template<typename Geometry>
void assign_inverse(Geometry & geometry)

Parameters

Type

Concept

Name

Description

Geometry &

Any type fulfilling a Geometry Concept

geometry

A model of the specified concept

Header

Either

#include <boost/geometry.hpp>

Or

#include <boost/geometry/algorithms/assign.hpp>

Example

Usage of assign_inverse and expand to conveniently determine bounding 3D box of two points

#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point.hpp>

using namespace boost::geometry;

int main()
{
    typedef model::point<float, 3, cs::cartesian> point;
    typedef model::box<point> box;

    box all;
    assign_inverse(all);
    std::cout << dsv(all) << std::endl;
    expand(all, point(0, 0, 0));
    expand(all, point(1, 2, 3));
    std::cout << dsv(all) << std::endl;

    return 0;
}

Output:

((3.40282e+038, 3.40282e+038, 3.40282e+038), (-3.40282e+038, -3.40282e+038, -3.40282e+038))
((0, 0, 0), (1, 2, 3))
See also

PrevUpHomeNext