Public Member Functions

QwtRasterData::ContourPlane Class Reference

List of all members.

Public Member Functions

 ContourPlane (double z)
bool intersect (const Contour3DPoint vertex[3], QwtDoublePoint line[2], bool ignoreOnPlane) const
double z () const

Detailed Description

Definition at line 40 of file qwt_raster_data.cpp.


Constructor & Destructor Documentation

QwtRasterData::ContourPlane::ContourPlane ( double  z ) [inline]

Definition at line 43 of file qwt_raster_data.cpp.

                                 :
        d_z(z)
    {
    }

Member Function Documentation

bool QwtRasterData::ContourPlane::intersect ( const Contour3DPoint  vertex[3],
QwtDoublePoint  line[2],
bool  ignoreOnPlane 
) const [inline]

Definition at line 61 of file qwt_raster_data.cpp.

References QwtRasterData::Contour3DPoint::pos(), and z().

Referenced by QwtRasterData::contourLines().

{
    bool found = true;

    // Are the vertices below (-1), on (0) or above (1) the plan ?
    const int eq1 = compare(vertex[0].z());
    const int eq2 = compare(vertex[1].z());
    const int eq3 = compare(vertex[2].z());

    /*
        (a) All the vertices lie below the contour level.
        (b) Two vertices lie below and one on the contour level.
        (c) Two vertices lie below and one above the contour level.
        (d) One vertex lies below and two on the contour level.
        (e) One vertex lies below, one on and one above the contour level.
        (f) One vertex lies below and two above the contour level.
        (g) Three vertices lie on the contour level.
        (h) Two vertices lie on and one above the contour level.
        (i) One vertex lies on and two above the contour level.
        (j) All the vertices lie above the contour level.
     */

    static const int tab[3][3][3] =
    {
        // jump table to avoid nested case statements
        { { 0, 0, 8 }, { 0, 2, 5 }, { 7, 6, 9 } },
        { { 0, 3, 4 }, { 1, 10, 1 }, { 4, 3, 0 } },
        { { 9, 6, 7 }, { 5, 2, 0 }, { 8, 0, 0 } }
    };

    const int edgeType = tab[eq1+1][eq2+1][eq3+1];
    switch (edgeType)  
    {
        case 1:
            // d(0,0,-1), h(0,0,1)
            line[0] = vertex[0].pos();
            line[1] = vertex[1].pos();
            break;
        case 2:
            // d(-1,0,0), h(1,0,0)
            line[0] = vertex[1].pos();
            line[1] = vertex[2].pos();
            break;
        case 3:
            // d(0,-1,0), h(0,1,0)
            line[0] = vertex[2].pos();
            line[1] = vertex[0].pos();
            break;
        case 4:
            // e(0,-1,1), e(0,1,-1)
            line[0] = vertex[0].pos();
            line[1] = intersection(vertex[1], vertex[2]);
            break;
        case 5:
            // e(-1,0,1), e(1,0,-1)
            line[0] = vertex[1].pos();
            line[1] = intersection(vertex[2], vertex[0]);
            break;
        case 6:
            // e(-1,1,0), e(1,0,-1)
            line[0] = vertex[1].pos();
            line[1] = intersection(vertex[0], vertex[1]);
            break;
        case 7:
            // c(-1,1,-1), f(1,1,-1)
            line[0] = intersection(vertex[0], vertex[1]);
            line[1] = intersection(vertex[1], vertex[2]);
            break;
        case 8:
            // c(-1,-1,1), f(1,1,-1)
            line[0] = intersection(vertex[1], vertex[2]);
            line[1] = intersection(vertex[2], vertex[0]);
            break;
        case 9:
            // f(-1,1,1), c(1,-1,-1)
            line[0] = intersection(vertex[2], vertex[0]);
            line[1] = intersection(vertex[0], vertex[1]);
            break;
        case 10:
            // g(0,0,0)
            // The CONREC algorithm has no satisfying solution for
            // what to do, when all vertices are on the plane.

            if ( ignoreOnPlane )
                found = false;
            else
            {
                line[0] = vertex[2].pos();
                line[1] = vertex[0].pos();
            }
            break;
        default:
            found = false;
    }

    return found;
}
double QwtRasterData::ContourPlane::z (  ) const [inline]

Definition at line 51 of file qwt_raster_data.cpp.

Referenced by intersect().

{ return d_z; }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines