A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mapbox/geometry.hpp/ below:

GitHub - mapbox/geometry.hpp: C++ geometry types

Provides header-only, generic C++ interfaces for geometry types, geometry collections, and features.

These types are designed to be easy to parse and serialize to GeoJSON.

They should also be a robust and high performance container for data processing and conversion.

Using a single type directly (requires no external dependencies):

#include <mapbox/geometry/point.hpp>
#include <iostream>

using mapbox::geometry::point;

int main() {
    point<double> pt(1.0,0.0);
    std::clog << "x: " << pt.x << " y: " << pt.y << "\n";
}

Creating a geometry collection (depends on https://github.com/mapbox/variant):

#include <mapbox/geometry/geometry.hpp>
#include <mapbox/variant.hpp>
#include <iostream>

using mapbox::geometry::geometry_collection;
using mapbox::geometry::geometry;
using mapbox::geometry::point;

using point_type = point<double>;

struct printer
{
    printer() {}

    void operator()(point_type const& pt) const
    {
        std::clog << "x: " << pt.x << " y: " << pt.y << "\n";
    }

    template <typename T>
    void operator()(T const& g) const
    {
        std::clog << "encountered non-point geometry\n";
    }
};

int main() {
    geometry_collection<double> gc;
    gc.emplace_back(point_type(1.0,0.0));
    geometry<double> const& geom = gc.at(0);
    printer visitor;
    mapbox::util::apply_visitor(visitor,geom);
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4