Revision: 9695
http://plplot.svn.sourceforge.net/plplot/?rev=9695&view=rev
Author: smekal
Date: 2009-03-09 22:23:53 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
Fixed svn properties and line ending issues.
Modified Paths:
--------------
trunk/examples/d/CMakeLists.txt
trunk/examples/d/x05d.d
trunk/examples/d/x07d.d
trunk/examples/d/x08d.d
trunk/examples/d/x10d.d
trunk/examples/d/x12d.d
trunk/examples/d/x13d.d
Property Changed:
----------------
trunk/examples/d/CMakeLists.txt
trunk/examples/d/x03d.d
trunk/examples/d/x04d.d
trunk/examples/d/x05d.d
trunk/examples/d/x06d.d
trunk/examples/d/x07d.d
trunk/examples/d/x08d.d
trunk/examples/d/x10d.d
trunk/examples/d/x12d.d
trunk/examples/d/x13d.d
Modified: trunk/examples/d/CMakeLists.txt
===================================================================
--- trunk/examples/d/CMakeLists.txt 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/CMakeLists.txt 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,60 +1,60 @@
-# examples/d/CMakeLists.txt
-### Process this file with cmake to produce Makefile
-###
-# Copyright (C) 2008 Werner Smekal
-#
-# This file is part of PLplot.
-#
-# PLplot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as published
-# by the Free Software Foundation; version 2 of the License.
-#
-# PLplot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with PLplot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-set(d_STRING_INDICES
-"03"
-"04"
-"05"
-"06"
-"07"
-"08"
-"10"
-"11"
-"12"
-"13"
-)
-
-if(BUILD_TEST)
- include_directories(
- ${CMAKE_SOURCE_DIR}/bindings/d
- )
-endif(BUILD_TEST)
-foreach(STRING_INDEX ${d_STRING_INDICES})
- set(d_SRCS ${d_SRCS} x${STRING_INDEX}d.d)
- if(BUILD_TEST)
- add_executable(x${STRING_INDEX}d x${STRING_INDEX}d.d)
- target_link_libraries(x${STRING_INDEX}d plplot${LIB_TAG})
- endif(BUILD_TEST)
-endforeach(STRING_INDEX ${d_STRING_INDICES})
-
-install(FILES ${d_SRCS}
- DESTINATION ${DATA_DIR}/examples/d
-)
-
-set(DC ${CMAKE_D_COMPILER})
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in
- ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
-)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
- DESTINATION ${DATA_DIR}/examples/d
- RENAME Makefile
-)
+# examples/d/CMakeLists.txt
+### Process this file with cmake to produce Makefile
+###
+# Copyright (C) 2008 Werner Smekal
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; version 2 of the License.
+#
+# PLplot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+set(d_STRING_INDICES
+"03"
+"04"
+"05"
+"06"
+"07"
+"08"
+"10"
+"11"
+"12"
+"13"
+)
+
+if(BUILD_TEST)
+ include_directories(
+ ${CMAKE_SOURCE_DIR}/bindings/d
+ )
+endif(BUILD_TEST)
+foreach(STRING_INDEX ${d_STRING_INDICES})
+ set(d_SRCS ${d_SRCS} x${STRING_INDEX}d.d)
+ if(BUILD_TEST)
+ add_executable(x${STRING_INDEX}d x${STRING_INDEX}d.d)
+ target_link_libraries(x${STRING_INDEX}d plplot${LIB_TAG})
+ endif(BUILD_TEST)
+endforeach(STRING_INDEX ${d_STRING_INDICES})
+
+install(FILES ${d_SRCS}
+ DESTINATION ${DATA_DIR}/examples/d
+)
+
+set(DC ${CMAKE_D_COMPILER})
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
+)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples
+ DESTINATION ${DATA_DIR}/examples/d
+ RENAME Makefile
+)
Property changes on: trunk/examples/d/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/examples/d/x03d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/examples/d/x04d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x05d.d
===================================================================
--- trunk/examples/d/x05d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x05d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,24 +1,24 @@
-/* $Id:
-
- Histogram demo.
-*/
-
-import plplot;
+/* $Id:
+
+ Histogram demo.
+*/
+
+import plplot;
import std.math;
-import std.string;
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Draws a histogram from sample data.
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- const int NPTS=2047;
-
- PLFLT[NPTS] data;
- PLFLT delta;
-
+import std.string;
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Draws a histogram from sample data.
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ const int NPTS=2047;
+
+ PLFLT[NPTS] data;
+ PLFLT delta;
+
/* Parse and process command line arguments */
char*[] c_args = new char*[args.length];
foreach( size_t i, char[] arg; args ) {
@@ -26,23 +26,23 @@
}
int argc = c_args.length;
plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
-
- /* Initialize plplot */
- plinit();
-
- /* Fill up data points */
-
- delta = 2.0 * PI / cast(double)NPTS;
- for( size_t i=0; i<NPTS; i++ )
- data[i] = sin(i*delta);
-
- plcol0( 1 );
- plhist( NPTS, &data[0], -1.1, 1.1, 44, 0 );
- plcol0( 2 );
- pllab( "#frValue", "#frFrequency",
- "#frPLplot Example 5 - Probability function of Oscillator" );
-
- plend();
-
- return 0;
-}
+
+ /* Initialize plplot */
+ plinit();
+
+ /* Fill up data points */
+
+ delta = 2.0 * PI / cast(double)NPTS;
+ for( size_t i=0; i<NPTS; i++ )
+ data[i] = sin(i*delta);
+
+ plcol0( 1 );
+ plhist( NPTS, &data[0], -1.1, 1.1, 44, 0 );
+ plcol0( 2 );
+ pllab( "#frValue", "#frFrequency",
+ "#frPLplot Example 5 - Probability function of Oscillator" );
+
+ plend();
+
+ return 0;
+}
Property changes on: trunk/examples/d/x05d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Property changes on: trunk/examples/d/x06d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x07d.d
===================================================================
--- trunk/examples/d/x07d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x07d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,25 +1,25 @@
-/*
-
- Font demo.
-*/
-
-import plplot;
-import std.string;
-
-int[17] base = [ 0, 200, 500, 600, 700, 800, 900,
- 2000, 2100, 2200, 2300, 2400, 2500, 2600,
- 2700, 2800, 2900];
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Displays the entire "plsym" symbol (font) set.
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- char[] text;
- PLFLT x, y;
-
+/*
+
+ Font demo.
+*/
+
+import plplot;
+import std.string;
+
+int[17] base = [ 0, 200, 500, 600, 700, 800, 900,
+ 2000, 2100, 2200, 2300, 2400, 2500, 2600,
+ 2700, 2800, 2900];
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Displays the entire "plsym" symbol (font) set.
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ char[] text;
+ PLFLT x, y;
+
/* Parse and process command line arguments */
char*[] c_args = new char*[args.length];
foreach( size_t i, char[] arg; args ) {
@@ -27,46 +27,46 @@
}
int argc = c_args.length;
plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
-
- /* Initialize plplot */
- plinit();
-
- plfontld( 1 );
- for( size_t l=0; l<17; l++) {
- pladv( 0 );
-
- /* Set up viewport and window */
- plcol0( 2 );
- plvpor( 0.15, 0.95, 0.1, 0.9 );
- plwind( 0.0, 1.0, 0.0, 1.0 );
-
- /* Draw the grid using plbox */
- plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 );
-
- /* Write the digits below the frame */
- plcol0( 15 );
- for( size_t i=0; i<=9; i++ ) {
- text=format( "%d", i);
- plmtex( "b", 1.5, (0.1*i+0.05), 0.5, toStringz(text) );
- }
-
- size_t k = 0;
- for( size_t i=0; i<=9; i++ ) {
- /* Write the digits to the left of the frame */
- text=format( "%d", base[l] + 10 * i );
- plmtex( "lv", 1.0, (0.95-0.1*i), 1.0, toStringz(text) );
- for( size_t j=0; j<=9; j++ ) {
- x = 0.1*j+0.05;
- y = 0.95-0.1*i;
-
- /* Display the symbols */
- plsym( 1, &x, &y, base[l]+k );
- k = k+1;
- }
- }
-
- plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols" );
- }
- plend();
- return 0;
-}
+
+ /* Initialize plplot */
+ plinit();
+
+ plfontld( 1 );
+ for( size_t l=0; l<17; l++) {
+ pladv( 0 );
+
+ /* Set up viewport and window */
+ plcol0( 2 );
+ plvpor( 0.15, 0.95, 0.1, 0.9 );
+ plwind( 0.0, 1.0, 0.0, 1.0 );
+
+ /* Draw the grid using plbox */
+ plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 );
+
+ /* Write the digits below the frame */
+ plcol0( 15 );
+ for( size_t i=0; i<=9; i++ ) {
+ text=format( "%d", i);
+ plmtex( "b", 1.5, (0.1*i+0.05), 0.5, toStringz(text) );
+ }
+
+ size_t k = 0;
+ for( size_t i=0; i<=9; i++ ) {
+ /* Write the digits to the left of the frame */
+ text=format( "%d", base[l] + 10 * i );
+ plmtex( "lv", 1.0, (0.95-0.1*i), 1.0, toStringz(text) );
+ for( size_t j=0; j<=9; j++ ) {
+ x = 0.1*j+0.05;
+ y = 0.95-0.1*i;
+
+ /* Display the symbols */
+ plsym( 1, &x, &y, base[l]+k );
+ k = k+1;
+ }
+ }
+
+ plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols" );
+ }
+ plend();
+ return 0;
+}
Property changes on: trunk/examples/d/x07d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x08d.d
===================================================================
--- trunk/examples/d/x08d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x08d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,216 +1,216 @@
-/*
-
- 3-d plot demo.
-
- Copyright (C) 2008 Werner Smekal
- Copyright (C) 2004 Alan W. Irwin
- Copyright (C) 2004 Rafael Laboissiere
-
- This file is part of PLplot.
-
- PLplot is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Library Public License as published
- by the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- PLplot is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with PLplot; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-import plplot;
-import std.string;
-import std.math;
-import std.c.stdlib;
-
-int sombrero;
-
-PLOptionTable[] options = [
- {
- "sombrero", /* Turns on use of Sombrero function */
- null,
- null,
- &sombrero,
- PL_OPT_BOOL,
- "-sombrero",
- "Use the \"sombrero\" function." },
- {
- null, /* option */
- null, /* handler */
- null, /* client data */
- null, /* address of variable to set */
- 0, /* mode flag */
- null, /* short syntax */
- null } /* long syntax */
-];
-
-/*--------------------------------------------------------------------------*\
- * cmap1_init1
- *
- * Initializes color map 1 in HLS space.
- * Basic grayscale variation from half-dark (which makes more interesting
- * looking plot compared to dark) to light.
- * An interesting variation on this:
- * s[1] = 1.0
-\*--------------------------------------------------------------------------*/
-void cmap1_init( bool gray )
-{
- PLFLT[2] i, h, l, s;
-
- i[] = [ 0.0, 1.0 ]; /* boundaries */
-
- if( gray ) {
- h[] = [ 0.0, 0.0 ]; /* hue -- low: red (arbitrary if s=0), high: red (arbitrary if s=0) */
- l[] = [ 0.5, 1.0]; /* lightness -- low: half-dark, high: light */
- s[] = [ 0.0, 0.0 ]; /* minimum saturation */
- } else {
- h[] = [ 240.0, 0.0 ]; /* blue -> green -> yellow -> red */
- l[] = [ 0.6, 0.6 ];
- s[] = [ 0.8, 0.8 ];
- }
-
- plscmap1n( 256 );
- c_plscmap1l( 0, 2, cast(PLFLT*)i, cast(PLFLT*)h, cast(PLFLT*)l,
- cast(PLFLT*)s, null );
-}
-
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Does a series of 3-d plots for a given data set, with different
- * viewing options in each plot.
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- const nlevel=10;
- const XPTS=35; /* Data points in x */
- const YPTS=46; /* Data points in y */
-
- PLFLT* x, y;
- PLFLT** z;
- PLFLT xx, yy, r;
- PLFLT zmin, zmax, step;
- PLFLT[nlevel] clevel;
- bool rosen=true;
-
- PLFLT[] alt = [ 60.0, 20.0 ];
- PLFLT[] az = [ 30.0, 60.0 ];
-
- char[] title[] = [ "#frPLplot Example 8 - Alt=60, Az=30",
- "#frPLplot Example 8 - Alt=20, Az=60" ];
-
- /* Parse and process command line arguments */
- plMergeOpts( cast(PLOptionTable*)options, "x08c options", null );
- char*[] c_args = new char*[args.length];
- foreach( size_t i, char[] arg; args ) {
- c_args[i] = toStringz(arg);
- }
- int argc = c_args.length;
- plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
- if( sombrero )
- rosen=false;
-
- /* Initialize plplot */
- plinit();
-
- /* Allocate data structures */
- x = cast(PLFLT*)std.c.stdlib.calloc( XPTS, PLFLT.sizeof );
- y = cast(PLFLT*)std.c.stdlib.calloc( YPTS, PLFLT.sizeof );
-
- plAlloc2dGrid( &z, XPTS, YPTS );
-
- for( int i=0; i<XPTS; i++) {
- x[i] = (cast(PLFLT)(i-(XPTS/2))/cast(PLFLT)(XPTS/2));
- if( rosen )
- x[i] *= 1.5;
- }
-
- for( int i=0; i<YPTS; i++ ) {
- y[i] = cast(PLFLT)(i-(YPTS/2))/cast(PLFLT)(YPTS/2);
- if( rosen )
- y[i] += 0.5;
- }
-
- for( size_t i=0; i<XPTS; i++ ) {
- xx = x[i];
- for( size_t j=0; j<YPTS; j++ ) {
- yy = y[j];
- if( rosen ) {
- z[i][j] = pow(1.-xx, 2.)+100.*pow(yy-pow(xx, 2.), 2.);
- /* The log argument may be zero for just the right grid. */
- if( z[i][j]>0. )
- z[i][j] = log(z[i][j]);
- else
- z[i][j] = -5.; /* -MAXFLOAT would mess-up up the scale */
- } else {
- r = sqrt(xx*xx+yy*yy);
- z[i][j] = exp(-r*r)*cos(2.0*PI*r);
- }
- }
- }
-
- plMinMax2dGrid( z, XPTS, YPTS, &zmax, &zmin );
- step = (zmax-zmin)/(nlevel+1);
- for( size_t i=0; i<nlevel; i++ )
- clevel[i] = zmin+step+step*i;
-
- pllightsource( 1.,1.,1. );
-
- for( size_t k=0; k<2; k++ ) {
- for( size_t ifshade=0; ifshade<4; ifshade++ ) {
- pladv( 0 );
- plvpor( 0.0, 1.0, 0.0, 0.9 );
- plwind( -1.0, 1.0, -0.9, 1.1 );
- plcol0( 3 );
- plmtex( "t", 1.0, 0.5, 0.5, toStringz(title[k]) );
- plcol0( 1 );
- if( rosen )
- plw3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] );
- else
- plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] );
-
- plbox3( "bnstu", "x axis", 0.0, 0,
- "bnstu", "y axis", 0.0, 0,
- "bcdmnstuv", "z axis", 0.0, 0 );
- plcol0( 2 );
-
- switch( ifshade ) {
- case 0:
- /* diffuse light surface plot */
- cmap1_init( 1 );
- plsurf3d( x, y, z, XPTS, YPTS, 0, null, 0 );
- break;
- case 1:
- /* magnitude colored plot */
- cmap1_init( 0 );
- plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR, null, 0 );
- break;
- case 2:
- /* magnitude colored plot with faceted squares */
- cmap1_init( 0 );
- plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | FACETED, null, 0 );
- break;
- default:
- /* magnitude colored plot with contours */
- cmap1_init( 0 );
- plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT,
- cast(PLFLT*)clevel, nlevel );
- break;
- }
- }
- }
-
- /* Clean up */
- std.c.stdlib.free( x );
- std.c.stdlib.free( y );
- plFree2dGrid( z, XPTS, YPTS );
-
- plend();
- return 0;
-}
+/*
+
+ 3-d plot demo.
+
+ Copyright (C) 2008 Werner Smekal
+ Copyright (C) 2004 Alan W. Irwin
+ Copyright (C) 2004 Rafael Laboissiere
+
+ This file is part of PLplot.
+
+ PLplot is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Library Public License as published
+ by the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ PLplot is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with PLplot; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+import plplot;
+import std.string;
+import std.math;
+import std.c.stdlib;
+
+int sombrero;
+
+PLOptionTable[] options = [
+ {
+ "sombrero", /* Turns on use of Sombrero function */
+ null,
+ null,
+ &sombrero,
+ PL_OPT_BOOL,
+ "-sombrero",
+ "Use the \"sombrero\" function." },
+ {
+ null, /* option */
+ null, /* handler */
+ null, /* client data */
+ null, /* address of variable to set */
+ 0, /* mode flag */
+ null, /* short syntax */
+ null } /* long syntax */
+];
+
+/*--------------------------------------------------------------------------*\
+ * cmap1_init1
+ *
+ * Initializes color map 1 in HLS space.
+ * Basic grayscale variation from half-dark (which makes more interesting
+ * looking plot compared to dark) to light.
+ * An interesting variation on this:
+ * s[1] = 1.0
+\*--------------------------------------------------------------------------*/
+void cmap1_init( bool gray )
+{
+ PLFLT[2] i, h, l, s;
+
+ i[] = [ 0.0, 1.0 ]; /* boundaries */
+
+ if( gray ) {
+ h[] = [ 0.0, 0.0 ]; /* hue -- low: red (arbitrary if s=0), high: red (arbitrary if s=0) */
+ l[] = [ 0.5, 1.0]; /* lightness -- low: half-dark, high: light */
+ s[] = [ 0.0, 0.0 ]; /* minimum saturation */
+ } else {
+ h[] = [ 240.0, 0.0 ]; /* blue -> green -> yellow -> red */
+ l[] = [ 0.6, 0.6 ];
+ s[] = [ 0.8, 0.8 ];
+ }
+
+ plscmap1n( 256 );
+ c_plscmap1l( 0, 2, cast(PLFLT*)i, cast(PLFLT*)h, cast(PLFLT*)l,
+ cast(PLFLT*)s, null );
+}
+
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Does a series of 3-d plots for a given data set, with different
+ * viewing options in each plot.
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ const nlevel=10;
+ const XPTS=35; /* Data points in x */
+ const YPTS=46; /* Data points in y */
+
+ PLFLT* x, y;
+ PLFLT** z;
+ PLFLT xx, yy, r;
+ PLFLT zmin, zmax, step;
+ PLFLT[nlevel] clevel;
+ bool rosen=true;
+
+ PLFLT[] alt = [ 60.0, 20.0 ];
+ PLFLT[] az = [ 30.0, 60.0 ];
+
+ char[] title[] = [ "#frPLplot Example 8 - Alt=60, Az=30",
+ "#frPLplot Example 8 - Alt=20, Az=60" ];
+
+ /* Parse and process command line arguments */
+ plMergeOpts( cast(PLOptionTable*)options, "x08c options", null );
+ char*[] c_args = new char*[args.length];
+ foreach( size_t i, char[] arg; args ) {
+ c_args[i] = toStringz(arg);
+ }
+ int argc = c_args.length;
+ plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
+ if( sombrero )
+ rosen=false;
+
+ /* Initialize plplot */
+ plinit();
+
+ /* Allocate data structures */
+ x = cast(PLFLT*)std.c.stdlib.calloc( XPTS, PLFLT.sizeof );
+ y = cast(PLFLT*)std.c.stdlib.calloc( YPTS, PLFLT.sizeof );
+
+ plAlloc2dGrid( &z, XPTS, YPTS );
+
+ for( int i=0; i<XPTS; i++) {
+ x[i] = (cast(PLFLT)(i-(XPTS/2))/cast(PLFLT)(XPTS/2));
+ if( rosen )
+ x[i] *= 1.5;
+ }
+
+ for( int i=0; i<YPTS; i++ ) {
+ y[i] = cast(PLFLT)(i-(YPTS/2))/cast(PLFLT)(YPTS/2);
+ if( rosen )
+ y[i] += 0.5;
+ }
+
+ for( size_t i=0; i<XPTS; i++ ) {
+ xx = x[i];
+ for( size_t j=0; j<YPTS; j++ ) {
+ yy = y[j];
+ if( rosen ) {
+ z[i][j] = pow(1.-xx, 2.)+100.*pow(yy-pow(xx, 2.), 2.);
+ /* The log argument may be zero for just the right grid. */
+ if( z[i][j]>0. )
+ z[i][j] = log(z[i][j]);
+ else
+ z[i][j] = -5.; /* -MAXFLOAT would mess-up up the scale */
+ } else {
+ r = sqrt(xx*xx+yy*yy);
+ z[i][j] = exp(-r*r)*cos(2.0*PI*r);
+ }
+ }
+ }
+
+ plMinMax2dGrid( z, XPTS, YPTS, &zmax, &zmin );
+ step = (zmax-zmin)/(nlevel+1);
+ for( size_t i=0; i<nlevel; i++ )
+ clevel[i] = zmin+step+step*i;
+
+ pllightsource( 1.,1.,1. );
+
+ for( size_t k=0; k<2; k++ ) {
+ for( size_t ifshade=0; ifshade<4; ifshade++ ) {
+ pladv( 0 );
+ plvpor( 0.0, 1.0, 0.0, 0.9 );
+ plwind( -1.0, 1.0, -0.9, 1.1 );
+ plcol0( 3 );
+ plmtex( "t", 1.0, 0.5, 0.5, toStringz(title[k]) );
+ plcol0( 1 );
+ if( rosen )
+ plw3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] );
+ else
+ plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] );
+
+ plbox3( "bnstu", "x axis", 0.0, 0,
+ "bnstu", "y axis", 0.0, 0,
+ "bcdmnstuv", "z axis", 0.0, 0 );
+ plcol0( 2 );
+
+ switch( ifshade ) {
+ case 0:
+ /* diffuse light surface plot */
+ cmap1_init( 1 );
+ plsurf3d( x, y, z, XPTS, YPTS, 0, null, 0 );
+ break;
+ case 1:
+ /* magnitude colored plot */
+ cmap1_init( 0 );
+ plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR, null, 0 );
+ break;
+ case 2:
+ /* magnitude colored plot with faceted squares */
+ cmap1_init( 0 );
+ plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | FACETED, null, 0 );
+ break;
+ default:
+ /* magnitude colored plot with contours */
+ cmap1_init( 0 );
+ plsurf3d( x, y, z, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT,
+ cast(PLFLT*)clevel, nlevel );
+ break;
+ }
+ }
+ }
+
+ /* Clean up */
+ std.c.stdlib.free( x );
+ std.c.stdlib.free( y );
+ plFree2dGrid( z, XPTS, YPTS );
+
+ plend();
+ return 0;
+}
Property changes on: trunk/examples/d/x08d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x10d.d
===================================================================
--- trunk/examples/d/x10d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x10d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,39 +1,39 @@
-/*
-
- Window positioning demo.
-*/
-
+/*
+
+ Window positioning demo.
+*/
+
import plplot;
-import std.string;
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Demonstrates absolute positioning of graphs on a page.
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- /* Parse and process command line arguments */
- char*[] c_args = new char*[args.length];
- foreach( size_t i, char[] arg; args ) {
- c_args[i] = toStringz(arg);
- }
- int argc = c_args.length;
+import std.string;
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Demonstrates absolute positioning of graphs on a page.
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ /* Parse and process command line arguments */
+ char*[] c_args = new char*[args.length];
+ foreach( size_t i, char[] arg; args ) {
+ c_args[i] = toStringz(arg);
+ }
+ int argc = c_args.length;
plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
-
- /* Initialize plplot */
- plinit();
-
- pladv( 0 );
- plvpor( 0.0, 1.0, 0.0, 1.0 );
- plwind( 0.0, 1.0, 0.0, 1.0 );
- plbox( "bc", 0.0, 0, "bc", 0.0, 0 );
-
- plsvpa( 50.0, 150.0, 50.0, 100.0 );
- plwind( 0.0, 1.0, 0.0, 1.0 );
- plbox( "bc", 0.0, 0, "bc", 0.0, 0 );
- plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" );
-
- plend();
- return 0;
-}
+
+ /* Initialize plplot */
+ plinit();
+
+ pladv( 0 );
+ plvpor( 0.0, 1.0, 0.0, 1.0 );
+ plwind( 0.0, 1.0, 0.0, 1.0 );
+ plbox( "bc", 0.0, 0, "bc", 0.0, 0 );
+
+ plsvpa( 50.0, 150.0, 50.0, 100.0 );
+ plwind( 0.0, 1.0, 0.0, 1.0 );
+ plbox( "bc", 0.0, 0, "bc", 0.0, 0 );
+ plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" );
+
+ plend();
+ return 0;
+}
Property changes on: trunk/examples/d/x10d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x12d.d
===================================================================
--- trunk/examples/d/x12d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x12d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,65 +1,65 @@
-/*
-
- Bar chart demo.
-*/
-
-import plplot;
-import std.string;
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Does a simple bar chart, using color fill. If color fill is
- * unavailable, pattern fill is used instead (automatic).
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- char[] string;
- PLFLT[10] y0;
-
- /* Parse and process command line arguments */
- char*[] c_args = new char*[args.length];
- foreach( size_t i, char[] arg; args ) {
- c_args[i] = toStringz(arg);
- }
- int argc = c_args.length;
- plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
-
- /* Initialize plplot */
- plinit();
-
- pladv( 0 );
- plvsta();
- plwind( 1980.0, 1990.0, 0.0, 35.0 );
- plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 );
- plcol0( 2 );
- pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" );
-
- y0[] = [5.0, 15.0, 12.0, 24.0, 28.0, 30.0, 20.0, 8.0, 12.0, 3.0];
-
- for( size_t i=0; i<10; i++ ) {
- plcol0( i+1 );
- plpsty( 0 );
- plfbox( (1980.+i), y0[i] );
- string = format( "%.0f", y0[i] );
- plptex( (1980.+i+.5), (y0[i]+1.), 1.0, 0.0, .5, toStringz(string) );
- string = format( "%d", 1980+i );
- plmtex( "b", 1.0, ((i+1)*.1-.05), 0.5, toStringz(string) );
- }
-
- /* Don't forget to call plend() to finish off! */
- plend();
- return 0;
-}
-
-
-void plfbox( PLFLT x0, PLFLT y0 )
-{
- PLFLT[4] x = [x0, x0, x0+1.0, x0+1.0];;
- PLFLT[4] y = [0.0, y0, y0, 0.0];
-
- plfill( 4, cast(PLFLT*)x, cast(PLFLT*)y );
- plcol0( 1 );
- pllsty( 1 );
- plline( 4, cast(PLFLT*)x, cast(PLFLT*)y );
-}
+/*
+
+ Bar chart demo.
+*/
+
+import plplot;
+import std.string;
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Does a simple bar chart, using color fill. If color fill is
+ * unavailable, pattern fill is used instead (automatic).
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ char[] string;
+ PLFLT[10] y0;
+
+ /* Parse and process command line arguments */
+ char*[] c_args = new char*[args.length];
+ foreach( size_t i, char[] arg; args ) {
+ c_args[i] = toStringz(arg);
+ }
+ int argc = c_args.length;
+ plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
+
+ /* Initialize plplot */
+ plinit();
+
+ pladv( 0 );
+ plvsta();
+ plwind( 1980.0, 1990.0, 0.0, 35.0 );
+ plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 );
+ plcol0( 2 );
+ pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" );
+
+ y0[] = [5.0, 15.0, 12.0, 24.0, 28.0, 30.0, 20.0, 8.0, 12.0, 3.0];
+
+ for( size_t i=0; i<10; i++ ) {
+ plcol0( i+1 );
+ plpsty( 0 );
+ plfbox( (1980.+i), y0[i] );
+ string = format( "%.0f", y0[i] );
+ plptex( (1980.+i+.5), (y0[i]+1.), 1.0, 0.0, .5, toStringz(string) );
+ string = format( "%d", 1980+i );
+ plmtex( "b", 1.0, ((i+1)*.1-.05), 0.5, toStringz(string) );
+ }
+
+ /* Don't forget to call plend() to finish off! */
+ plend();
+ return 0;
+}
+
+
+void plfbox( PLFLT x0, PLFLT y0 )
+{
+ PLFLT[4] x = [x0, x0, x0+1.0, x0+1.0];;
+ PLFLT[4] y = [0.0, y0, y0, 0.0];
+
+ plfill( 4, cast(PLFLT*)x, cast(PLFLT*)y );
+ plcol0( 1 );
+ pllsty( 1 );
+ plline( 4, cast(PLFLT*)x, cast(PLFLT*)y );
+}
Property changes on: trunk/examples/d/x12d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/examples/d/x13d.d
===================================================================
--- trunk/examples/d/x13d.d 2009-03-09 22:19:06 UTC (rev 9694)
+++ trunk/examples/d/x13d.d 2009-03-09 22:23:53 UTC (rev 9695)
@@ -1,81 +1,81 @@
-/*
-
- Pie chart demo.
-*/
-
-import plplot;
-import std.string;
-import std.math;
-
-char[] text[] = [ "Maurice",
- "Geoffrey",
- "Alan",
- "Rafael",
- "Vince" ];
-
-/*--------------------------------------------------------------------------*\
- * main
- *
- * Does a simple pie chart.
-\*--------------------------------------------------------------------------*/
-int main( char[][] args )
-{
- int dthet, theta0, theta1, theta;
- PLFLT just, dx, dy;
- PLFLT[500] x, y;
- PLFLT[5] per = [ 10.0, 32.0, 12.0, 30.0, 16.0 ];
-
- /* Parse and process command line arguments */
- char*[] c_args = new char*[args.length];
- foreach( size_t i, char[] arg; args ) {
- c_args[i] = toStringz(arg);
- }
- int argc = c_args.length;
- plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
-
- /* Initialize plplot */
- plinit();
-
- plenv( 0., 10., 0., 10., 1, -2 );
- plcol0( 2 );
- /* n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid
- * floating point logic problems. */
- theta0 = 0;
- dthet = 1;
- for( size_t i=0; i<=4; i++ ) {
- size_t j = 0;
- x[j] = 5.;
- y[j++] = 5.;
- /* n.b. the theta quantities multiplied by 2*M_PI/500 afterward so
- * in fact per is interpreted as a percentage. */
- theta1 = cast(int)(theta0+5.0*per[i]);
- if( i==4 )
- theta1 = 500;
- for( theta=theta0; theta<=theta1; theta+=dthet ) {
- x[j] = 5+3*cos((2.*PI/500.)*theta);
- y[j++] = 5+3*sin((2.*PI/500.)*theta);
- }
- plcol0( i+1 );
- plpsty( (i+3)%8+1 );
- plfill( j, cast(PLFLT*)x, cast(PLFLT*)y );
- plcol0( 1 );
- plline( j, cast(PLFLT*)x, cast(PLFLT*)y );
- just = (2.*PI/500.)*(theta0 + theta1)/2.;
- dx = .25*cos(just);
- dy = .25*sin(just);
- if( (theta0+theta1)<250 || (theta0+theta1)>750 )
- just = 0.;
- else
- just = 1.;
-
- plptex( (x[j/2]+dx), (y[j/2]+dy), 1.0, 0.0, just, toStringz(text[i]) );
- theta0 = theta-dthet;
- }
- plfont( 2 );
- plschr( 0., 1.3 );
- plptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" );
-
- /* Don't forget to call PLEND to finish off! */
- plend();
- return 0;
-}
+/*
+
+ Pie chart demo.
+*/
+
+import plplot;
+import std.string;
+import std.math;
+
+char[] text[] = [ "Maurice",
+ "Geoffrey",
+ "Alan",
+ "Rafael",
+ "Vince" ];
+
+/*--------------------------------------------------------------------------*\
+ * main
+ *
+ * Does a simple pie chart.
+\*--------------------------------------------------------------------------*/
+int main( char[][] args )
+{
+ int dthet, theta0, theta1, theta;
+ PLFLT just, dx, dy;
+ PLFLT[500] x, y;
+ PLFLT[5] per = [ 10.0, 32.0, 12.0, 30.0, 16.0 ];
+
+ /* Parse and process command line arguments */
+ char*[] c_args = new char*[args.length];
+ foreach( size_t i, char[] arg; args ) {
+ c_args[i] = toStringz(arg);
+ }
+ int argc = c_args.length;
+ plparseopts( &argc, cast(char**)c_args, PL_PARSE_FULL );
+
+ /* Initialize plplot */
+ plinit();
+
+ plenv( 0., 10., 0., 10., 1, -2 );
+ plcol0( 2 );
+ /* n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid
+ * floating point logic problems. */
+ theta0 = 0;
+ dthet = 1;
+ for( size_t i=0; i<=4; i++ ) {
+ size_t j = 0;
+ x[j] = 5.;
+ y[j++] = 5.;
+ /* n.b. the theta quantities multiplied by 2*M_PI/500 afterward so
+ * in fact per is interpreted as a percentage. */
+ theta1 = cast(int)(theta0+5.0*per[i]);
+ if( i==4 )
+ theta1 = 500;
+ for( theta=theta0; theta<=theta1; theta+=dthet ) {
+ x[j] = 5+3*cos((2.*PI/500.)*theta);
+ y[j++] = 5+3*sin((2.*PI/500.)*theta);
+ }
+ plcol0( i+1 );
+ plpsty( (i+3)%8+1 );
+ plfill( j, cast(PLFLT*)x, cast(PLFLT*)y );
+ plcol0( 1 );
+ plline( j, cast(PLFLT*)x, cast(PLFLT*)y );
+ just = (2.*PI/500.)*(theta0 + theta1)/2.;
+ dx = .25*cos(just);
+ dy = .25*sin(just);
+ if( (theta0+theta1)<250 || (theta0+theta1)>750 )
+ just = 0.;
+ else
+ just = 1.;
+
+ plptex( (x[j/2]+dx), (y[j/2]+dy), 1.0, 0.0, just, toStringz(text[i]) );
+ theta0 = theta-dthet;
+ }
+ plfont( 2 );
+ plschr( 0., 1.3 );
+ plptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" );
+
+ /* Don't forget to call PLEND to finish off! */
+ plend();
+ return 0;
+}
Property changes on: trunk/examples/d/x13d.d
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|