基于osgModeling的三维管道生成

 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() );

更多资讯见xiaok海洋测绘网

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiaokcehui

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值