src/work/peter/canvas-test.cc
changeset 1252 4fee8e9d9014
parent 1225 4401e1aeafcf
child 1277 e4cc8e996912
equal deleted inserted replaced
3:7231cc561b31 4:e463974d7b66
   169 
   169 
   170 	double x_wp=0;
   170 	double x_wp=0;
   171 	double y_wp=0;
   171 	double y_wp=0;
   172 
   172 
   173 	Gnome::Canvas::Points coos;
   173 	Gnome::Canvas::Points coos;
   174 	for(int i=0;i<numofcoos;i++)
   174 	for(int i=0;i<numofcoos;i+=2)
   175 	{
   175 	{
   176 		coordinates[i]=coosarray[i++];
       
   177 		coordinates[i]=coosarray[i];
   176 		coordinates[i]=coosarray[i];
   178 		coos.push_back(Gnome::Art::Point(coordinates[i-1], coordinates[i]));
   177 		coordinates[i+1]=coosarray[i+1];
   179 
   178 		coos.push_back(Gnome::Art::Point(coordinates[i],
   180 		x_wp+=coordinates[i-1];
   179 						 coordinates[i+1]));
   181 		y_wp+=coordinates[i];
   180 
       
   181 		x_wp+=coordinates[i];
       
   182 		y_wp+=coordinates[i+1];
   182 
   183 
   183 	}
   184 	}
   184 
   185 
   185 	sides=new Gnome::Canvas::Polygon(triangle, coos);
   186 	sides=new Gnome::Canvas::Polygon(triangle, coos);
   186 	*sides << Gnome::Canvas::Properties::outline_color("green");
   187 	*sides << Gnome::Canvas::Properties::outline_color("green");
   244 
   245 
   245 //main():
   246 //main():
   246 
   247 
   247 int main(int argc, char *argv[])
   248 int main(int argc, char *argv[])
   248 {
   249 {
   249 	if((argc>=7)&&( (argc/2)!=( (argc+1)/2 ) ) )
   250 	if((argc>=7)&& (argc%2) )
   250 	{
   251 	{
   251 		double * coosarray=new double[argc];
   252 		double * coosarray=new double[argc];
   252 
   253 
   253 		for(int i=1;i<argc;i++)
   254 		for(int i=1;i<argc;i++)
   254 		{
   255 		{
   255 			coosarray[i-1]=atof(argv[i]);
   256 			coosarray[i-1]=atof(argv[i]);
       
   257 			printf("%g%c",coosarray[i-1],i%2?' ':'\n');
   256 		}
   258 		}
   257 
   259 
   258 		Gnome::Canvas::init();
   260 		Gnome::Canvas::init();
   259 		Gtk::Main app(argc, argv);
   261 		Gtk::Main app(argc, argv);
   260 
   262