Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Boost.Polygon's polygon_with_holes_data

Boost , Chapter 1. Geometry , Boost.Polygon

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

PrevUpHomeNext

Повышаю. Полигонный тип опорных отверстий Polygon (boost::polygon::polygon_with_holes_data) адаптирован к Boost. Концепция геометрии полигона.

Description

Повышаю. Точки полигона (а также полигоны) могут использоваться Boost. Геометрия. Две библиотеки можно использовать вместе. Используя усилитель::polygon::polygon_with_holes_data<...>, алгоритмы от обоих Boost. Полигон и буст. Геометрию можно назвать

Model of

Polygon Concept

Header

#include <boost/geometry/geometries/adapted/boost_polygon.hpp>

Стандартный заголовок<boost/geometry.hpp>не включает этот заголовок.

Example

Показывает, как использовать Boost.Polygon polygon_with_holes_data в Boost. Геометрия

#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/boost_polygon.hpp>
int main()
{
    typedef boost::polygon::polygon_with_holes_data<int> polygon;
    typedef boost::polygon::polygon_traits<polygon>::point_type point;
    typedef boost::polygon::polygon_with_holes_traits<polygon>::hole_type hole;
    point pts[5] = {
        boost::polygon::construct<point>(0, 0),
        boost::polygon::construct<point>(0, 10),
        boost::polygon::construct<point>(10, 10),
        boost::polygon::construct<point>(10, 0),
        boost::polygon::construct<point>(0, 0)
    };
    point hole_pts[5] = {
        boost::polygon::construct<point>(1, 1),
        boost::polygon::construct<point>(9, 1),
        boost::polygon::construct<point>(9, 9),
        boost::polygon::construct<point>(1, 9),
        boost::polygon::construct<point>(1, 1)
    };
    hole hls[1];
    boost::polygon::set_points(hls[0], hole_pts, hole_pts+5);
    polygon poly;
    boost::polygon::set_points(poly, pts, pts+5);
    boost::polygon::set_holes(poly, hls, hls+1);
    std::cout << "Area (using Boost.Geometry): "
        << boost::geometry::area(poly) << std::endl;
    std::cout << "Area (using Boost.Polygon): "
        << boost::polygon::area(poly) << std::endl;
    return 0;
}

Результат:

Area (using Boost.Geometry): 36
Area (using Boost.Polygon): 36

PrevUpHomeNext

Статья Boost.Polygon's polygon_with_holes_data раздела Chapter 1. Geometry Boost.Polygon может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Boost.Polygon ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-07-04 23:00:13/0.0059781074523926/0