Changeset 1467 for trunk


Ignore:
Timestamp:
May 27, 2009 3:00:26 PM (15 years ago)
Author:
gah
Message:

fix for boxes with 2d flow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r1465 r1467  
    179179
    180180    double sx, sy, sz;
    181     sx = 1.0;
     181    sz = sy = sx = 1.0;
    182182    sy = volPtr->height / (double)volPtr->width;
    183     sz = volPtr->depth  / (double)volPtr->width;
     183    if (volPtr->depth > 0.0) {
     184        sz = volPtr->depth  / (double)volPtr->width;
     185    }
    184186    glScaled(sx, sy, sz);
    185187
     
    190192
    191193    float x0, y0, z0, x1, y1, z1;
    192     x0 = (_sv.corner1.x - min.x) / (max.x - min.x);
    193     y0 = (_sv.corner1.y - min.y) / (max.y - min.y);
    194     z0 = (_sv.corner1.z - min.z) / (max.z - min.z);
    195     x1 = (_sv.corner2.x - min.x) / (max.x - min.x);
    196     y1 = (_sv.corner2.y - min.y) / (max.y - min.y);
    197     z1 = (_sv.corner2.z - min.z) / (max.z - min.z);
    198    
     194    x0 = y0 = z0 = 0.0f;
     195    x1 = y1 = z1 = 1.0f;
     196    if (max.y  > min.y) {
     197        y0 = (_sv.corner1.y - min.y) / (max.y - min.y);
     198        y1 = (_sv.corner2.y - min.y) / (max.y - min.y);
     199    }
     200    if (max.z > min.z) {
     201        z0 = (_sv.corner1.z - min.z) / (max.z - min.z);
     202        z1 = (_sv.corner2.z - min.z) / (max.z - min.z);
     203    }
     204    if (max.x > min.x) {
     205        x0 = (_sv.corner1.x - min.x) / (max.x - min.x);
     206        x1 = (_sv.corner2.x - min.x) / (max.x - min.x);
     207    }
    199208    Trace("rendering box %g,%g %g,%g %g,%g\n", x0, x1, y0, y1, z0, z1);
    200209
     
    18021811 *---------------------------------------------------------------------------
    18031812 *
     1813 * FlowGotoOp --
     1814 *
     1815 *      flow goto number
     1816 *
     1817 *---------------------------------------------------------------------------
     1818 */
     1819static int
     1820FlowGotoOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1821             Tcl_Obj *const *objv)
     1822{
     1823    int nSteps;
     1824    if (Tcl_GetIntFromObj(interp, objv[2], &nSteps) != TCL_OK) {
     1825        return TCL_ERROR;
     1826    }
     1827    if ((nSteps < 0) || (nSteps > SHRT_MAX)) {
     1828        Tcl_AppendResult(interp, "flow goto: bad # of steps \"",
     1829                         Tcl_GetString(objv[2]), "\"", (char *)NULL);
     1830        return TCL_ERROR;
     1831    }
     1832    NanoVis::ResetFlows();
     1833    assert(NanoVis::licRenderer != NULL);
     1834    NanoVis::licRenderer->reset();
     1835    if (NanoVis::flags & NanoVis::MAP_FLOWS) {
     1836        NanoVis::MapFlows();
     1837    }
     1838    int i;
     1839    for (i = 0; i < nSteps; i++) {
     1840        NanoVis::licRenderer->convolve();
     1841        NanoVis::AdvectFlows();
     1842    }
     1843    NanoVis::EventuallyRedraw();
     1844    return TCL_OK;
     1845}
     1846
     1847/*
     1848 *---------------------------------------------------------------------------
     1849 *
    18041850 * FlowNamesOp --
    18051851 *
     
    19712017    {"delete",   1, FlowDeleteOp,  2, 0, "name...",},
    19722018    {"exists",   1, FlowExistsOp,  3, 3, "name",},
     2019    {"goto",     1, FlowGotoOp,    3, 3, "nSteps",},
    19732020    {"names",    1, FlowNamesOp,   2, 3, "?pattern?",},
    19742021    {"next",     2, FlowNextOp,    2, 2, "",},
Note: See TracChangeset for help on using the changeset viewer.