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


C++ BoxVolume::dump方法代码示例

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


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

示例1: main

int main (int argc, char **argv) {

    Real32 ent, ex;
    int i;

    //Lines:

    const int nlines = 10;

    Line lines[nlines];
    Pnt3f pnts[nlines * 2] = {
                        Pnt3f(0,0,0), Pnt3f(0,1,0),
                        Pnt3f(0,0,0), Pnt3f(2,1,0),
                        Pnt3f(2,0,0), Pnt3f(2,1,0),
                        Pnt3f(-2,0,0), Pnt3f(0,2,0),
                        Pnt3f(-4,2,0), Pnt3f(0,2,0),
                        Pnt3f(-3,0,0), Pnt3f(-2,1,0),
                        Pnt3f(3,4,0), Pnt3f(1,3,0),
                        Pnt3f(-1,0,0), Pnt3f(-1,1,0),
                        Pnt3f(-4,0,0), Pnt3f(-3,1,0),
                        Pnt3f(-4,6,0), Pnt3f(0,6,0)
                        };

    for ( i = 0; i < nlines; i++ )
        lines[i].setValue( pnts[i*2], pnts[i*2+1] );


    BoxVolume b;

    float xmin, ymin, zmin, xmax, ymax, zmax;

    xmin = 0;
    ymin = 0.5;
    zmin = 0;
    xmax = 1;
    ymax = .5;
    zmax = 1;

    b.setBounds(xmin, ymin, zmin, xmax, ymax, zmax);

    std::cout << std::endl;
    b.dump();
    std::cout << std::endl;

    for ( i = 0 ; i < nlines; i++ )
    {
        std::cout << "Line: (" << lines[i].getPosition() << ") ("
             << lines[i].getDirection() << ")" << std::endl;

        bool res = lines[i].intersect( b, ent, ex );
        Pnt3f   ep = lines[i].getPosition() + ent * lines[i].getDirection(),
                xp = lines[i].getPosition() + ex * lines[i].getDirection();

        std::cout << "Result: " << res;

        if ( res )
        {
            std::cout << " enter " << ent << "=(" << ep << ") ";

            bool es = ( b.isOnSurface( ep ) || b.intersect( ep ) ),
                 xs = b.isOnSurface( xp );

            if ( ( res && es ) || !res )    std::cout << "ok";
            else                            std::cout << "**BAD**";

            std::cout << ";  exit " << ex << "=(" << xp << ") ";

            if ( ( res && xs ) || !res )    std::cout << "ok";
            else                            std::cout << "**BAD**";
        }

        std::cout << std::endl;
    }

    return 0;

    SphereVolume s;

    float radius;
    Vec3f center;

    center[0] = 0;
    center[1] = 0;
    center[2] = 0;

    radius = 1;

    s.setCenter(center);
    s.setRadius(radius);

    std::cout << std::endl;
    s.dump();
    std::cout << std::endl;


    for ( i = 0 ; i < nlines; i++ )
    {
        std::cout << "Line: (" << lines[i].getPosition() << ") ("
                  << lines[i].getDirection() << ")" << std::endl;

//.........这里部分代码省略.........
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:101,代码来源:testintersect.cpp


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