⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 output.cc

📁 模糊聚类的算法实现程序
💻 CC
📖 第 1 页 / 共 5 页
字号:
//local point (ARROWWIDTHMULT,  //             0,  //             1-ARROWLENGTHMULT)  localx = arrowwidth;  localz = 1.0 - arrowlength;  x = axisframe[0][0] * localx +    axisframe[0][2] * localz +    axisframe[0][3];  y = axisframe[1][0] * localx +    axisframe[1][2] * localz +    axisframe[1][3];  z = axisframe[2][0] * localx +    axisframe[2][2] * localz +    axisframe[2][3];  y = (y * eyedistance) / (eyedistance - z);  x = (x * eyedistance) / (eyedistance - z);  points2[0].x = points[1].x = xcenter + (int) (x * scalefactor);  points2[0].y = points[1].y = ycenter - (int) (y * scalefactor);//local point (-ARROWWIDTHMULT,  //             0,  //             1-ARROWLENGTHMULT)  x = -axisframe[0][0] * localx +    axisframe[0][2] * localz +    axisframe[0][3];  y = -axisframe[1][0] * localx +    axisframe[1][2] * localz +    axisframe[1][3];  z = -axisframe[2][0] * localx +    axisframe[2][2] * localz +    axisframe[2][3];  y = (y * eyedistance) / (eyedistance - z);  x = (x * eyedistance) / (eyedistance - z);  points2[2].x = points[2].x = xcenter + (int) (x * scalefactor);  points2[2].y = points[2].y = ycenter - (int) (y * scalefactor);  XFillPolygon (display, drawable, gc, points, 3, Convex, CoordModeOrigin);// local point (0  //              ARROWWIDTHHMULT,  //              1-ARROWLENGTHMULT)  localy = arrowwidth;  localz = 1.0 - arrowlength;  x = axisframe[0][1] * localy +    axisframe[0][2] * localz +    axisframe[0][3];  y = axisframe[1][1] * localy +    axisframe[1][2] * localz +    axisframe[1][3];  z = axisframe[2][1] * localy +    axisframe[2][2] * localz +    axisframe[2][3];  y = (y * eyedistance) / (eyedistance - z);  x = (x * eyedistance) / (eyedistance - z);  points2[1].x = points[1].x = xcenter + (int) (x * scalefactor);  points2[1].y = points[1].y = ycenter - (int) (y * scalefactor);// local point (0  //              -ARROWWIDTHHMULT,  //              1-ARROWLENGTHMULT)  x = -axisframe[0][1] * localy +    axisframe[0][2] * localz +    axisframe[0][3];  y = -axisframe[1][1] * localy +    axisframe[1][2] * localz +    axisframe[1][3];  z = -axisframe[2][1] * localy +    axisframe[2][2] * localz +    axisframe[2][3];  y = (y * eyedistance) / (eyedistance - z);  x = (x * eyedistance) / (eyedistance - z);  points2[3].x = points[2].x = xcenter + (int) (x * scalefactor);  points2[3].y = points[2].y = ycenter - (int) (y * scalefactor);  XFillPolygon (display, drawable, gc, points, 3, Convex, CoordModeOrigin);  XFillPolygon (display, drawable, gc, points2, 4, Convex, CoordModeOrigin);}void Output2d_3d::DrawDVektorArray1d (int options, char pointtyp,			      DVektorArray * inputData, BVektor * eindeutig){  Drawable drawable;  if (options & DRAWINWINDOW)    drawable = window;  else    drawable = pixmap;  if (options & DRAWGREY)    XSetForeground (display, gc, shadowpix);  else    XSetForeground (display, gc, blackpix);  if (Dataset != NULL) {    int counter, number = inputData->Lese_Groesse ();    switch (pointtyp) {    case OUTPUT_POINTTYPPOINT:      XPoint * Points;      if ((Points = (XPoint *) malloc (sizeof (XPoint) * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < number; counter++)	FillPoint (&(Points[counter]),		   counter,		   inputData->Lese_Vektor (counter, xindex));      XDrawPoints (display, drawable, gc, Points, number, CoordModeOrigin);      free (Points);      break;			// OUTPUT_POINTTYPPOINT    case OUTPUT_POINTTYPCLASSES:      {	short xpos, ypos;	for (counter = 0; counter < number; counter++) {	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (counter))	      XSetForeground (display, gc, blackpix);	    else	      XSetForeground (display, gc, lightpix);	  }	  WorldtoPixel1d (counter, inputData->Lese_Vektor (counter, xindex),			  &xpos, &ypos);	  DrawSymbol (xpos, ypos,		      drawable,		      inputData->Lese_Vektor (counter).Lese_Nummer ());	}      }      break;			// OUTPUT_POINTTYPCLASSES    case OUTPUT_POINTTYPCOLOR:      {	short xpos, ypos;	for (counter = 0; counter < number; counter++) {	  WorldtoPixel1d (counter, inputData->Lese_Vektor (counter, xindex),			  &xpos, &ypos);	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (counter))	      DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (counter).Lese_Nummer ());	    else	      DrawBox (xpos, ypos, drawable);	  } else	    DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (counter).Lese_Nummer ());	}      }      break;			// OUTPUT_POINTTYPCOLOR    case OUTPUT_POINTTYPCROSS:      XSegment * lines = NULL;      int index = 0;      short xpixel, ypixel;      if ((lines = (XSegment *) malloc (sizeof (XSegment) * 2 * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < 2 * number; counter += 2) {	FillLines (&(lines[counter]),		   index,		   inputData->Lese_Vektor (index, xindex),		   &xpixel, &ypixel);	index++;      }      XDrawSegments (display, drawable, gc, lines, number * 2);      free (lines);      break;			// case OUTPUT_POINTTYPCROSS    }  }}void Output2d_3d::DrawDVektorArray2d (int options, char pointtyp,			      DVektorArray * inputData, BVektor * eindeutig){  Drawable drawable;  if (options & DRAWINWINDOW)    drawable = window;  else    drawable = pixmap;// draw points/crosses  if (options & DRAWGREY)    XSetForeground (display, gc, shadowpix);  else    XSetForeground (display, gc, blackpix);  if (inputData != NULL) {    int counter, number = inputData->Lese_Groesse ();    switch (pointtyp) {    case OUTPUT_POINTTYPPOINT:      XPoint * Points;      if ((Points = (XPoint *) malloc (sizeof (XPoint) * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < number; counter++)	FillPoint (&(Points[counter]),		   inputData->Lese_Vektor (counter, xindex),		   inputData->Lese_Vektor (counter, yindex));      XDrawPoints (display, drawable, gc, Points, number, CoordModeOrigin);      free (Points);      break;			// OUTPUT_POINTTYPPOINT    case OUTPUT_POINTTYPCLASSES:      {	short xpos, ypos;	for (counter = 0; counter < number; counter++) {	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (counter))	      XSetForeground (display, gc, blackpix);	    else	      XSetForeground (display, gc, lightpix);	  }	  WorldtoPixel2d (inputData->Lese_Vektor (counter, xindex),			  inputData->Lese_Vektor (counter, yindex),			  &xpos, &ypos);	  DrawSymbol (xpos, ypos,		      drawable,		      inputData->Lese_Vektor (counter).Lese_Nummer ());	}      }      break;			// OUTPUT_POINTTYPCLASSES    case OUTPUT_POINTTYPCOLOR:      {	short xpos, ypos;	for (counter = 0; counter < number; counter++) {	  WorldtoPixel2d (inputData->Lese_Vektor (counter, xindex),			  inputData->Lese_Vektor (counter, yindex),			  &xpos, &ypos);	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (counter))	      DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (counter).Lese_Nummer ());	    else	      DrawBox (xpos, ypos, drawable);	  } else	    DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (counter).Lese_Nummer ());	}      }      break;			// OUTPUT_POINTTYPCOLOR    case OUTPUT_POINTTYPCROSS:      XSegment * lines = NULL;      int index = 0;      short xpixel, ypixel;      if ((lines = (XSegment *) malloc (sizeof (XSegment) * 2 * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < 2 * number; counter += 2) {	FillLines (&(lines[counter]),		   inputData->Lese_Vektor (index, xindex),		   inputData->Lese_Vektor (index, yindex),		   &xpixel, &ypixel);	index++;      }      XDrawSegments (display, drawable, gc, lines, number * 2);      free (lines);      break;			// case OUTPUT_POINTTYPCROSS    }  }}void Output2d_3d::DrawDVektorArray3d (int options, char pointtyp,			      DVektorArray * inputData, BVektor * eindeutig){  Drawable drawable;  if (options & DRAWINWINDOW)    drawable = window;  else    drawable = pixmap;  if (options & DRAWGREY)    XSetForeground (display, gc, shadowpix);  else    XSetForeground (display, gc, blackpix);  if (Dataset != 0) {    int counter, number = inputData->Lese_Groesse ();    switch (pointtyp) {    case OUTPUT_POINTTYPPOINT:      XPoint * Points;      if ((Points = (XPoint *) malloc (sizeof (XPoint) * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < number; counter++)	FillPoint (&(Points[counter]),		   inputData->Lese_Vektor (counter, xindex),		   inputData->Lese_Vektor (counter, yindex),		   inputData->Lese_Vektor (counter, zindex));      XDrawPoints (display, drawable, gc, Points, number, CoordModeOrigin);      free (Points);      break;			// case OUTPUT_POINTTYPPOINT    case OUTPUT_POINTTYPCLASSES:      {	short xpos, ypos;	for (counter = 0; counter < number; counter++) {	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (counter))	      XSetForeground (display, gc, blackpix);	    else	      XSetForeground (display, gc, lightpix);	  }	  WorldtoPixel3d (inputData->Lese_Vektor (counter, xindex),			  inputData->Lese_Vektor (counter, yindex),			  inputData->Lese_Vektor (counter, zindex),			  &xpos, &ypos);	  DrawSymbol (xpos, ypos,		      drawable,		      inputData->Lese_Vektor (counter).Lese_Nummer ());	}      }      break;			// OUTPUT_POINTTYPCLASSES    case OUTPUT_POINTTYPCOLOR:      {	short xpos, ypos;	int index;//         double zpos;	for (counter = number - 1; counter > 0; counter--) {	  index = deepindex[counter];	  WorldtoZvalue (inputData->Lese_Vektor (index, xindex),			 inputData->Lese_Vektor (index, yindex),			 inputData->Lese_Vektor (index, zindex),			 &(deepvalues[counter]));//                         &zpos);	  //           deepvalues[counter]=zpos;	}	deepvalues.Quicksort (deepindex);	for (counter = 0; counter < number; counter++) {	  index = deepindex[counter];	  WorldtoPixel3d (inputData->Lese_Vektor (index, xindex),			  inputData->Lese_Vektor (index, yindex),			  inputData->Lese_Vektor (index, zindex),			  deepvalues[counter],			  &xpos, &ypos);	  if (eindeutig != NULL) {	    if (eindeutig->Lese_i (index))	      DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (index).Lese_Nummer ());	    else	      DrawBox (xpos, ypos, drawable);	  } else	    DrawColorbox (xpos, ypos, drawable, inputData->Lese_Vektor (index).Lese_Nummer ());	}/*         for(counter=0;counter<number;counter++)   {   WorldtoPixel3d(inputData->Lese_Vektor(counter,xindex),   inputData->Lese_Vektor(counter,yindex),   inputData->Lese_Vektor(counter,zindex),   &xpos, &ypos);   if(eindeutig!=NULL)   {   if(eindeutig->Lese_i(counter))   DrawColorbox(xpos,ypos,drawable,inputData->Lese_Vektor(counter).Lese_Nummer());   else   DrawBox(xpos,ypos,drawable);   }   else   DrawColorbox(xpos,ypos,drawable,inputData->Lese_Vektor(counter).Lese_Nummer());   } */      }      break;			// OUTPUT_POINTTYPCOLOR    case OUTPUT_POINTTYPCROSS:      XSegment * lines;      int index = 0;      short xpixel, ypixel;      if ((lines = (XSegment *) malloc (sizeof (XSegment) * 2 * number)) == NULL) {	printf ("Out of memory!\n");	exit (1);      }      for (counter = 0; counter < 2 * number; counter += 2) {	FillLines (&(lines[counter]),		   inputData->Lese_Vektor (index, xindex),		   inputData->Lese_Vektor (index, yindex),		   inputData->Lese_Vektor (index, zindex),		   &xpixel, &ypixel);	index++;      }      XDrawSegments (display, drawable, gc, lines, number * 2);      free (lines);      break;			// OUTPUT_POINTTYPCROSS    }  }}void Output2d_3d::FillPoint (XPoint * Point,			double xpos,			double ypos){  WorldtoPixel2d (xpos, ypos,		  &Point->x, &Point->y);}void Output2d_3d::FillLines (XSegment * lines,			double xpos,			double ypos,			short *xpixel, short *ypixel){  WorldtoPixel2d (xpos, ypos,		  xpixel, ypixel);  lines[0].y1 = lines[0].y2 = *ypixel;  lines[0].x1 = (short) (*xpixel - CROSSWIDTH);  lines[0].x2 = (short) (*xpixel + CROSSWIDTH);  lines[1].x1 = lines[1].x2 = *xpixel;  lines[1].y1 = (short) (*ypixel - CROSSWIDTH);  lines[1].y2 = (short) (*ypixel + CROSSWIDTH);}void Output2d_3d::FillPoint (XPoint * Point,			int number,			double xpos){  WorldtoPixel1d (number, xpos,		  &Point->x, &Point->y);}void Output2d_3d::FillLines (XSegment * lines,			int number,			double xpos,			short *xpixel, short *ypixel){  WorldtoPixel1d (number, xpos,		  xpixel, ypixel);  lines[0].y1 = lines[0].y2 = *ypixel;  lines[0].x1 = (short) (*xpixel - CROSSWIDTH);  lines[0].x2 = (short) (*xpixel + CROSSWIDTH);  lines[1].x1 = lines[1].x2 = *xpixel;  lines[1].y1 = (short) (*ypixel - CROSSWIDTH);  lines[1].y2 = (short) (*ypixel + CROSSWIDTH);}void Output2d_3d::FillPoint (XPoint * Point,			double xpos,			double ypos,			double zpos)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -