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


C++ LineString::addPoint方法代码示例

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


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

示例1: _buildingWall

void _buildingWall( const Polygon_2& ring, const Kernel::FT& wallHeight, PolyhedralSurface& shell )
{
    size_t npt = ring.size() ;

    for ( size_t i = 0; i < npt; i++ ) {
        const Point_2& a = ring.vertex( i ) ;
        const Point_2& b = ring.vertex( ( i+1 ) % npt ) ;

        LineString wallRing ;
        wallRing.addPoint( new Point( a.x(), a.y(), Kernel::FT( 0 ) ) );
        wallRing.addPoint( new Point( b.x(), b.y(), Kernel::FT( 0 ) ) );
        wallRing.addPoint( new Point( b.x(), b.y(), wallHeight ) );
        wallRing.addPoint( new Point( a.x(), a.y(), wallHeight ) );
        wallRing.addPoint( new Point( a.x(), a.y(), Kernel::FT( 0 ) ) );
        shell.addPolygon( Polygon( wallRing ) );
    }
}
开发者ID:hjanetzek,项目名称:SFCGAL,代码行数:17,代码来源:building.cpp

示例2: Surface

PolyhedralSurface::PolyhedralSurface( const MarkedPolyhedron& poly ) :
    Surface()
{
    for ( MarkedPolyhedron::Facet_const_iterator fit = poly.facets_begin(); fit != poly.facets_end(); ++fit ) {
        LineString* face = new LineString();
        MarkedPolyhedron::Halfedge_around_facet_const_circulator hit = fit->facet_begin();

        do {
            face->addPoint( hit->vertex()->point() );
            ++hit;
        }
        while ( hit != fit->facet_begin() );

        // close the ring
        face->addPoint( hit->vertex()->point() );
        _polygons.push_back( new Polygon( face ) );
    }
}
开发者ID:HEShuang,项目名称:SFCGAL,代码行数:18,代码来源:PolyhedralSurface.cpp

示例3: bottom

std::auto_ptr< Geometry > building(
    const Polygon& g,
    const Kernel::FT& wallHeight,
    const Kernel::FT& roofSlope
)
{
    //typedef Straight_skeleton_2::Vertex_const_handle     Vertex_const_handle ;
    typedef Straight_skeleton_2::Halfedge_const_handle   Halfedge_const_handle ;
    //typedef Straight_skeleton_2::Halfedge_const_iterator Halfedge_const_iterator ;
    typedef Straight_skeleton_2::Face_const_iterator     Face_const_iterator ;


    // convert to CGAL polygon and generate straight skeleton
    Polygon_with_holes_2 polygon = g.toPolygon_with_holes_2() ;

    // fix orientation
    algorithm::makeValidOrientation( polygon ) ;

    boost::shared_ptr< Straight_skeleton_2 > skeleton = CGAL::create_interior_straight_skeleton_2( polygon ) ;

    std::auto_ptr< PolyhedralSurface > shell( new PolyhedralSurface );
    // bottom part
    {
        Polygon bottom( polygon );
        bottom.reverse();
        algorithm::force3D( bottom );
        shell->addPolygon( bottom );
    }

    // walls
    {
        //exterior rings
        _buildingWall( polygon.outer_boundary(), wallHeight, *shell ) ;

        //interior rings
        for ( Polygon_with_holes_2::Hole_const_iterator it = polygon.holes_begin(); it != polygon.holes_end(); ++it ) {
            _buildingWall( *it, wallHeight, *shell ) ;
        }
    }

    // roof
    {
        for ( Face_const_iterator it = skeleton->faces_begin(); it != skeleton->faces_end(); ++it ) {

            LineString roofFaceRing ;
            Halfedge_const_handle h = it->halfedge(), done( h ) ;
            bool infiniteTimeFound = false ;

            do {
                infiniteTimeFound = infiniteTimeFound || h->has_infinite_time() ;

                Point_2    point  = h->vertex()->point() ;
                Kernel::FT zPoint = wallHeight + h->vertex()->time() * roofSlope ;

                roofFaceRing.addPoint( Point( point.x(), point.y(), zPoint ) );

                h = h->next() ;
            }
            while ( h != done && ! infiniteTimeFound );

            if ( ! infiniteTimeFound ) {
                roofFaceRing.addPoint( roofFaceRing.startPoint() );
                shell->addPolygon( Polygon( roofFaceRing ) );
            }
        }
    }

    return std::auto_ptr< Geometry >( new Solid( shell.release() ) );
}
开发者ID:hjanetzek,项目名称:SFCGAL,代码行数:69,代码来源:building.cpp


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