当前位置: 首页>>代码示例>>C++>>正文


C++ PointBuffer::calculateBounds方法代码示例

本文整理汇总了C++中PointBuffer::calculateBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ PointBuffer::calculateBounds方法的具体用法?C++ PointBuffer::calculateBounds怎么用?C++ PointBuffer::calculateBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointBuffer的用法示例。


在下文中一共展示了PointBuffer::calculateBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

void PcdWriter::write(const PointBuffer& data)
{
    pcl::PointCloud<XYZIRGBA>::Ptr cloud(new pcl::PointCloud<XYZIRGBA>);
    BOX3D const& buffer_bounds = data.calculateBounds();
    pclsupport::PDALtoPCD(const_cast<PointBuffer&>(data), *cloud, buffer_bounds);

    pcl::PCDWriter w;

    if (m_compressed)
        w.writeBinaryCompressed<XYZIRGBA>(m_filename, *cloud);
    else
        w.writeASCII<XYZIRGBA>(m_filename, *cloud);
}
开发者ID:pramsey,项目名称:PDAL,代码行数:13,代码来源:PcdWriter.cpp

示例2: rc

void P2gWriter::write(const PointBuffer& buf)
{
    std::string z_name = getOptions().getValueOrDefault<std::string>("Z", "Z");


    for (point_count_t idx = 0; idx < buf.size(); idx++)
    {
        double x = buf.getFieldAs<double>(Dimension::Id::X, idx);
        double y = buf.getFieldAs<double>(Dimension::Id::Y, idx);
        double z = buf.getFieldAs<double>(Dimension::Id::Z, idx);
        m_coordinates.push_back(boost::tuple<double, double, double>(x, y, z));
    }

    m_bounds = buf.calculateBounds();

    m_GRID_SIZE_X = (int)(ceil((m_bounds.maxx - m_bounds.minx)/m_GRID_DIST_X)) + 1;
    m_GRID_SIZE_Y = (int)(ceil((m_bounds.maxy - m_bounds.miny)/m_GRID_DIST_Y)) + 1;

    log()->get(LogLevel::Debug) << "X grid size: " << m_GRID_SIZE_X << std::endl;
    log()->get(LogLevel::Debug) << "Y grid size: " << m_GRID_SIZE_Y << std::endl;


    log()->floatPrecision(6);
    log()->get(LogLevel::Debug) << "X grid distance: " << m_GRID_DIST_X << std::endl;
    log()->get(LogLevel::Debug) << "Y grid distance: " << m_GRID_DIST_Y << std::endl;
    log()->clearFloat();

    boost::scoped_ptr<OutCoreInterp> p(new OutCoreInterp(m_GRID_DIST_X,
                                       m_GRID_DIST_Y,
                                       m_GRID_SIZE_X,
                                       m_GRID_SIZE_Y,
                                       m_RADIUS_SQ,
                                       m_bounds.minx,
                                       m_bounds.maxx,
                                       m_bounds.miny,
                                       m_bounds.maxy,
                                       m_fill_window_size));
    m_interpolator.swap(p);

    if (m_interpolator->init() < 0)
    {
        throw p2g_error("unable to initialize interpolator");
    }

    int rc(0);

    std::vector<boost::tuple<double, double, double> >::const_iterator i;
    for (i = m_coordinates.begin(); i!= m_coordinates.end(); ++i)
    {
        double x = i->get<0>();
        double y = i->get<1>();
        x = x - m_bounds.minx;
        y = y - m_bounds.miny;

        rc = m_interpolator->update(x, y, i->get<2>());
        if (rc < 0)
        {
            throw p2g_error("interp->update() error while processing ");
        }
    }

    double adfGeoTransform[6];
    adfGeoTransform[0] = m_bounds.minx;
    adfGeoTransform[1] = m_GRID_DIST_X;
    adfGeoTransform[2] = 0.0;
    adfGeoTransform[3] = m_bounds.maxy;
    adfGeoTransform[4] = 0.0;
    adfGeoTransform[5] = -1 * m_GRID_DIST_Y;

    SpatialReference const& srs = getSpatialReference();

    if ((rc = m_interpolator->finish(const_cast<char*>(m_filename.c_str()), m_outputFormat, m_outputTypes, adfGeoTransform, srs.getWKT().c_str())) < 0)
    {
        throw p2g_error("interp->finish() error");
    }

    return;
}
开发者ID:pramsey,项目名称:PDAL,代码行数:78,代码来源:P2gWriter.cpp


注:本文中的PointBuffer::calculateBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。