boost::geometry::point_on_surface使用演示
boost::point_on_surface使用演示
在Geometris库中,boost::point_on_surface函数用于通过在几何图形表面上采样来获取点的坐标,以便在计算中使用。该函数可以用于基本的平面几何图形(例如矩形、圆、多边形等)和3D几何体(例如球体、立方体等)。
下面是一个简单的示例程序,演示了如何使用boost::point_on_surface函数来获取圆形和正方形的表面上随机点。
#include <iostream>
#include <random>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/box.hpp>
namespace bg = boost::geometry;
BOOST_GEOMETRY_REGISTER_POINT_2D(boost::geometry::model::d2::point_xy<double>, double, bg::cs::cartesian, x, y)
BOOST_GEOMETRY_REGISTER_BOX(bg::model::box<boost::geometry::model::d2::point_xy<double>>)
int main()
{
// 定义圆形
bg::model::point<
还没有评论,来说两句吧...