面朝大海,春暖花开

作者:xiaokcehui2018-1-1 10:01分类: 海洋三维(OEP3D) 标签: OEP3D 三维管道

 LOFT,给螺旋加管道

无标题1.png

曲线生成方形管

无标题2.png

osg::ref_ptr<osg::Node> createLoft()

{

    // First, we would create a helicoid geometry. To finish the work with Loft class, we should have

    // at least a helix path and a cross-section shape. We may just use the Helix class to generate

// the required curve (Need to set number of coils, and radius and pitch parameters).

//螺旋管

    //osg::ref_ptr<osgModeling::Helix> helix =

     //   new osgModeling::Helix( 1.5f, 0.2f, 1.0f, osg::Vec3(-xInterval, 0.0f, 0.0f) );

//多段线管

         osg::ref_ptr<osgModeling::Curve> helix = new osgModeling::Curve;

    helix->addPathPoint( osg::Vec3(-0.5f, 0.0f, 0.0f) );

    helix->addPathPoint( osg::Vec3(-0.5f, 0.0f, 2.0f) );

         helix->addPathPoint( osg::Vec3(0.0f, 0.0f, 4.0f) );

    // And then, set the section shape and a loft model is created. The simplest section which is only a line segment

    // will be applied to the whole model. Loft class suggest use 2D curves (on XOY plane) as section shapes.

    osg::ref_ptr<osgModeling::Curve> section = new osgModeling::Curve;

    section->addPathPoint( osg::Vec3(0.5f,0.0f,0.0f) );//管道横截面

    section->addPathPoint( osg::Vec3(-0.5f,0.0f,0.0f) );

         section->addPathPoint( osg::Vec3(-0.5f,0.5f,0.0f) );

         section->addPathPoint( osg::Vec3(0.5f,0.5f,0.0f) );

         section->addPathPoint( osg::Vec3(0.5f,0.0f,0.0f) );

    osg::ref_ptr<osgModeling::Loft> geom1 =

        new osgModeling::Loft( helix.get(), section.get() );

温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,谢谢合作!

已有 0/193 人参与

发表评论:

欢迎使用手机扫描访问本站,还可以关注微信哦~