IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 22726


Ignore:
Timestamp:
Mar 1, 2009, 10:04:13 PM (17 years ago)
Author:
beaumont
Message:

bug fixing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/relastroVisual.c

    r22725 r22726  
    6464static int plotVectorField(float x[], float y[],
    6565                           float xVec[], float yVec[],
    66                            int npts, int kapaID,
    67                            Graphdata *graphdata, int overplot) {
    68 
    69     float singleX[2], singleY[2];
    70     float maxVecLength, vecScaleFactor;
    71     float graphSize;
    72     int i;
    73 
    74     if (!initWindow(&kapaID)) return 0;
    75 
    76     if (!overplot) scaleGraphdata(x, y, graphdata, npts);
     66                           int npts, int *kapaID) {
     67
     68  Graphdata graphdata; 
     69  float singleX[2], singleY[2];
     70  float maxVecLength, vecScaleFactor;
     71  float graphSize;
     72  int i;
     73
     74    if (!initWindow(kapaID)) return 0;
     75
     76    KapaInitGraph(&graphdata);
     77    KapaClearPlots(*kapaID);
     78    scaleGraphdata(x, y, &graphdata, npts);
    7779
    7880    //scale the raw xvec, yvecs down to fit into the window
     
    8688        }
    8789    }
    88     graphSize = graphdata->xmax - graphdata->xmin;
    89     if ((graphdata->ymax - graphdata->ymin) > graphSize) {
    90         graphSize = graphdata->ymax - graphdata->ymin;
     90    graphSize = graphdata.xmax - graphdata.xmin;
     91    if ((graphdata.ymax - graphdata.ymin) > graphSize) {
     92        graphSize = graphdata.ymax - graphdata.ymin;
    9193    }
    9294    vecScaleFactor = graphSize * 0.1 / maxVecLength;
    9395
    94     //plot the points as circles
    95     if (!overplot) {
    96         KapaSetFont (kapaID, "helvetica", 14);
    97         KapaSetLimits(kapaID, graphdata);
    98         KapaBox(kapaID, graphdata);
    99     }
    100 
    101     graphdata->ptype = 7;
    102     graphdata->style = 2;
    103     KapaPrepPlot(kapaID, npts, graphdata);
    104     KapaPlotVector(kapaID, npts, x, "x");
    105     KapaPlotVector(kapaID, npts, y, "y");
     96    KapaSetFont (*kapaID, "helvetica", 14);
     97    KapaSetLimits(*kapaID, &graphdata);
     98    KapaBox(*kapaID, &graphdata);
     99   
     100    graphdata.ptype = 7;
     101    graphdata.style = 2;
     102    KapaPrepPlot(*kapaID, npts, &graphdata);
     103    KapaPlotVector(*kapaID, npts, x, "x");
     104    KapaPlotVector(*kapaID, npts, y, "y");
    106105
    107106    //plot each vector individually
    108     graphdata->ptype = 0;
    109     graphdata->style = 0;
     107    graphdata.ptype = 0;
     108    graphdata.style = 0;
    110109    for(i = 0; i < npts; i++) {
    111110        singleX[0] = x[i];
     
    114113        singleY[1] = yVec[i] * vecScaleFactor;
    115114
    116         KapaPrepPlot(kapaID, 2, graphdata);
    117         KapaPlotVector(kapaID, 2, singleX, "x");
    118         KapaPlotVector(kapaID, 2, singleY, "y");
     115        KapaPrepPlot(*kapaID, 2, &graphdata);
     116        KapaPlotVector(*kapaID, 2, singleX, "x");
     117        KapaPlotVector(*kapaID, 2, singleY, "y");
    119118    }
    120119    return 1;
     
    194193  }
    195194
    196   plotVectorField(refX, refY, xVec, yVec, numFit, kapa2,
    197                   &graphdata, 0);
     195  plotVectorField(refX, refY, xVec, yVec, numFit, &kapa2);
    198196
    199197  KapaSetFont(kapa, "helvetica", 14);
Note: See TracChangeset for help on using the changeset viewer.