Changeset 22726
- Timestamp:
- Mar 1, 2009, 10:04:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro/src/relastroVisual.c
r22725 r22726 64 64 static int plotVectorField(float x[], float y[], 65 65 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); 77 79 78 80 //scale the raw xvec, yvecs down to fit into the window … … 86 88 } 87 89 } 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; 91 93 } 92 94 vecScaleFactor = graphSize * 0.1 / maxVecLength; 93 95 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"); 106 105 107 106 //plot each vector individually 108 graphdata ->ptype = 0;109 graphdata ->style = 0;107 graphdata.ptype = 0; 108 graphdata.style = 0; 110 109 for(i = 0; i < npts; i++) { 111 110 singleX[0] = x[i]; … … 114 113 singleY[1] = yVec[i] * vecScaleFactor; 115 114 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"); 119 118 } 120 119 return 1; … … 194 193 } 195 194 196 plotVectorField(refX, refY, xVec, yVec, numFit, kapa2, 197 &graphdata, 0); 195 plotVectorField(refX, refY, xVec, yVec, numFit, &kapa2); 198 196 199 197 KapaSetFont(kapa, "helvetica", 14);
Note:
See TracChangeset
for help on using the changeset viewer.
