Minor changes for educational purposes.
authoralpar
Fri, 18 Mar 2005 06:00:20 +0000
changeset 122671fcebd3a041
parent 1225 4401e1aeafcf
child 1227 01f668e3e168
Minor changes for educational purposes.
(Much more would be necessary...)
src/work/peter/canvas-test.cc
     1.1 --- a/src/work/peter/canvas-test.cc	Thu Mar 17 17:20:37 2005 +0000
     1.2 +++ b/src/work/peter/canvas-test.cc	Fri Mar 18 06:00:20 2005 +0000
     1.3 @@ -171,14 +171,15 @@
     1.4  	double y_wp=0;
     1.5  
     1.6  	Gnome::Canvas::Points coos;
     1.7 -	for(int i=0;i<numofcoos;i++)
     1.8 +	for(int i=0;i<numofcoos;i+=2)
     1.9  	{
    1.10 -		coordinates[i]=coosarray[i++];
    1.11  		coordinates[i]=coosarray[i];
    1.12 -		coos.push_back(Gnome::Art::Point(coordinates[i-1], coordinates[i]));
    1.13 +		coordinates[i+1]=coosarray[i+1];
    1.14 +		coos.push_back(Gnome::Art::Point(coordinates[i],
    1.15 +						 coordinates[i+1]));
    1.16  
    1.17 -		x_wp+=coordinates[i-1];
    1.18 -		y_wp+=coordinates[i];
    1.19 +		x_wp+=coordinates[i];
    1.20 +		y_wp+=coordinates[i+1];
    1.21  
    1.22  	}
    1.23  
    1.24 @@ -246,13 +247,14 @@
    1.25  
    1.26  int main(int argc, char *argv[])
    1.27  {
    1.28 -	if((argc>=7)&&( (argc/2)!=( (argc+1)/2 ) ) )
    1.29 +	if((argc>=7)&& (argc%2) )
    1.30  	{
    1.31  		double * coosarray=new double[argc];
    1.32  
    1.33  		for(int i=1;i<argc;i++)
    1.34  		{
    1.35  			coosarray[i-1]=atof(argv[i]);
    1.36 +			printf("%g%c",coosarray[i-1],i%2?' ':'\n');
    1.37  		}
    1.38  
    1.39  		Gnome::Canvas::init();