From: <sm...@us...> - 2009-08-13 19:57:34
|
Revision: 10245 http://plplot.svn.sourceforge.net/plplot/?rev=10245&view=rev Author: smekal Date: 2009-08-13 19:57:21 +0000 (Thu, 13 Aug 2009) Log Message: ----------- Added plarc() to D bindings. Fixed D examples 2 and 3. Modified Paths: -------------- trunk/bindings/d/plplot.d trunk/examples/d/x02d.d trunk/examples/d/x03d.d Modified: trunk/bindings/d/plplot.d =================================================================== --- trunk/bindings/d/plplot.d 2009-08-13 19:16:56 UTC (rev 10244) +++ trunk/bindings/d/plplot.d 2009-08-13 19:57:21 UTC (rev 10245) @@ -1156,6 +1156,7 @@ //alias c_plbox plbox; //alias c_plbox3 plbox3; alias c_plcalc_world plcalc_world; +alias c_plarc plarc; alias c_plclear plclear; alias c_plcol0 plcol0; alias c_plcol1 plcol1; @@ -1359,11 +1360,17 @@ void c_plbox(char *xopt, PLFLT xtick, PLINT nxsub, char *yopt, PLFLT ytick, PLINT nysub); /* This is the 3-d analogue of plbox(). */ -void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, PLFLT ztick, PLINT nsubz); +void c_plbox3(char *xopt, char *xlabel, PLFLT xtick, PLINT nsubx, char *yopt, + char *ylabel, PLFLT ytick, PLINT nsuby, char *zopt, char *zlabel, + PLFLT ztick, PLINT nsubz); /* Calculate world coordinates and subpage from relative device coordinates. */ void c_plcalc_world(PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window); +/* Plot an arc */ +void c_plarc(PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, + PLBOOL fill); + /* Clear current subpage. */ void c_plclear(); Modified: trunk/examples/d/x02d.d =================================================================== --- trunk/examples/d/x02d.d 2009-08-13 19:16:56 UTC (rev 10244) +++ trunk/examples/d/x02d.d 2009-08-13 19:57:21 UTC (rev 10245) @@ -79,7 +79,7 @@ PLFLT h = (360./10.)*(i%10); /* Vary lightness uniformly from top to bottom, between min & max */ - PLFLT l = lmin + (lmax-lmin)*(i/10)/9.; + PLFLT l = lmin + (lmax-lmin)*(i/10)/9.0; /* Use max saturation */ PLFLT s = 1.0; @@ -87,9 +87,10 @@ PLFLT r1, g1, b1; plhlsrgb(h, l, s, &r1, &g1, &b1); - r[i+16] = cast(PLINT)(r1*255); - g[i+16] = cast(PLINT)(g1*255); - b[i+16] = cast(PLINT)(b1*255); + /* Use 255.001 to avoid close truncation decisions in this example. */ + r[i+16] = cast(PLINT)(r1*255.001); + g[i+16] = cast(PLINT)(g1*255.001); + b[i+16] = cast(PLINT)(b1*255.001); } /* Load default cmap0 colors into our custom set */ Modified: trunk/examples/d/x03d.d =================================================================== --- trunk/examples/d/x03d.d 2009-08-13 19:16:56 UTC (rev 10244) +++ trunk/examples/d/x03d.d 2009-08-13 19:57:21 UTC (rev 10245) @@ -16,7 +16,8 @@ int main(char[][] args) { PLFLT dtr = PI/180.0; - PLFLT[361] x0, y0; + PLFLT[] x0, y0; + x0.length = y0.length = 361; for(size_t i=0; i<x0.length; i++) { x0[i] = cos(dtr*i); y0[i] = sin(dtr*i); @@ -35,17 +36,10 @@ /* Set up viewport and window, but do not draw box */ plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); - PLFLT[361] x, y; - for(size_t i=1; i<=10; i++) { - for(size_t j=0; j<x.length; j++) { - x[j] = 0.1*i*x0[j]; - y[j] = 0.1*i*y0[j]; - } + /* Draw circles for polar grid */ + for(size_t i=1; i<11; i++) + plarc(0.0, 0.0, 0.1*i, 0.1*i, 0.0, 360.0, 0); - /* Draw circles for polar grid */ - plline(x, y); - } - plcol0(2); for(size_t i=0; i<=11; i++) { PLFLT theta = 30.0*i; @@ -75,6 +69,8 @@ /* Draw the graph */ PLFLT r; + PLFLT[] x, y; + x.length = y.length = 361; for(size_t i=0; i<x.length; i++) { r = sin(dtr*(5*i)); x[i] = x0[i]*r; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |