| version 1.1, 2001/09/20 14:12:00 |
version 1.2, 2002/07/07 23:57:58 |
| Line 19 typedef enum position {NONE, TOP, BELOW} |
|
| Line 19 typedef enum position {NONE, TOP, BELOW} |
|
| |
|
| // Function int CheckHiddenCrosshair() {{{ |
// Function int CheckHiddenCrosshair() {{{ |
| int CheckHiddenCrosshair(WindowType theWindow, int direction, |
int CheckHiddenCrosshair(WindowType theWindow, int direction, |
| int xIndex, int yIndex, int LeaveIndex, |
int xIndex, int yIndex, int LeaveIndex, |
| double tan_phi, double theOtherIndexStep) |
double tan_phi, double theOtherIndexStep) |
| { |
{ |
| int theCurrentIndex, theLastIndex, theIndexStep = 1; |
int theCurrentIndex, theLastIndex, theIndexStep = 1; |
| LabelType theLabel = theWindow->label; |
LabelType theLabel = theWindow->label; |
| Line 92 int CheckHiddenCrosshair(WindowType theW |
|
| Line 92 int CheckHiddenCrosshair(WindowType theW |
|
| theSurfZValue = SurfaceZ(theData,xindex2,yindex2)*theLabel->Z_Scale; |
theSurfZValue = SurfaceZ(theData,xindex2,yindex2)*theLabel->Z_Scale; |
| else |
else |
| theSurfZValue = - (((int)theOtherIndex - theOtherIndex) * |
theSurfZValue = - (((int)theOtherIndex - theOtherIndex) * |
| SurfaceZ(theData,xindex1,yindex1)) * |
SurfaceZ(theData,xindex1,yindex1)) * |
| theLabel->Z_Scale + |
theLabel->Z_Scale + |
| (((int)(fabs(theOtherIndex)+1)-theOtherIndex)* |
(((int)(fabs(theOtherIndex)+1)-theOtherIndex)* |
| SurfaceZ(theData,xindex2,yindex2)) |
SurfaceZ(theData,xindex2,yindex2)) |
| Line 135 void DrawCrosshair(WindowType theWindow, |
|
| Line 135 void DrawCrosshair(WindowType theWindow, |
|
| theClientArea.width = Tk_Width(tkwin); |
theClientArea.width = Tk_Width(tkwin); |
| theClientArea.height = Tk_Height(tkwin); |
theClientArea.height = Tk_Height(tkwin); |
| XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, &theClientArea, |
XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, &theClientArea, |
| 1, Unsorted); |
1, Unsorted); |
| |
|
| pm = XCreatePixmap(theDisplay, Tk_WindowId(tkwin), Tk_Width(tkwin), |
pm = XCreatePixmap(theDisplay, Tk_WindowId(tkwin), Tk_Width(tkwin), |
| Tk_Height(tkwin), Tk_Depth(tkwin)); |
Tk_Height(tkwin), Tk_Depth(tkwin)); |
| XCopyArea(theDisplay, theWindow->pixmap_buffer, pm, theWindow->xwingc, 0, |
XCopyArea(theDisplay, theWindow->pixmap_buffer, pm, theWindow->xwingc, 0, |
| 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, 0); |
0, Tk_Width(tkwin), Tk_Height(tkwin), 0, 0); |
| |
|
| phi = theWindow->phi; |
phi = theWindow->phi; |
| theta = theWindow->theta; |
theta = theWindow->theta; |
| Line 153 void DrawCrosshair(WindowType theWindow, |
|
| Line 153 void DrawCrosshair(WindowType theWindow, |
|
| theWindow->data->yCoord = yindex; |
theWindow->data->yCoord = yindex; |
| |
|
| if ( |
if ( |
| (xindex == theWindow->mstart && |
(xindex == theWindow->mstart && |
| 90.0 < phi && phi < 270.0) || |
90.0 < phi && phi < 270.0) || |
| (xindex == theWindow->mend-1 && |
(xindex == theWindow->mend-1 && |
| (phi < 90.0 || phi > 270.0)) || |
(phi < 90.0 || phi > 270.0)) || |
| (yindex == theWindow->nend-1 && |
(yindex == theWindow->nend-1 && |
| 0.0 < phi && phi < 180.0) || |
0.0 < phi && phi < 180.0) || |
| (yindex == theWindow->nstart && |
(yindex == theWindow->nstart && |
| 180.0 < phi && phi < 360.0) || |
180.0 < phi && phi < 360.0) || |
| (theta == 0.0) || |
(theta == 0.0) || |
| (theta == 180.0)) { |
(theta == 180.0)) { |
| |
|
| result = 1; |
result = 1; |
| } |
} |
| Line 180 void DrawCrosshair(WindowType theWindow, |
|
| Line 180 void DrawCrosshair(WindowType theWindow, |
|
| |
|
| if (phi == 0.0) { |
if (phi == 0.0) { |
| result = CheckHiddenCrosshair(theWindow, 0, xindex, yindex, |
result = CheckHiddenCrosshair(theWindow, 0, xindex, yindex, |
| theWindow->mend-1, tan_phi, 0); |
theWindow->mend-1, tan_phi, 0); |
| } |
} |
| else if (0.0 < phi && phi < 90.0) { |
else if (0.0 < phi && phi < 90.0) { |
| gamma = rad2deg(atan( |
gamma = rad2deg(atan( |
| (double) (theWindow->nend - 1 - yindex)/ |
(double) (theWindow->nend - 1 - yindex)/ |
| (double) (theWindow->mend - 1 - xindex)* |
(double) (theWindow->mend - 1 - xindex)* |
| (double) (theWindow->mend - 1 - |
(double) (theWindow->mend - 1 - |
| theWindow->mstart)/ |
theWindow->mstart)/ |
| (double) (theWindow->nend - 1 - |
(double) (theWindow->nend - 1 - |
| theWindow->nstart))); |
theWindow->nstart))); |
| if (gamma >= phi) { |
if (gamma >= phi) { |
| LeaveIndex1 = theWindow->mend-1; |
LeaveIndex1 = theWindow->mend-1; |
| theOtherIndexStep1 = tan_phi; |
theOtherIndexStep1 = tan_phi; |
| Line 206 void DrawCrosshair(WindowType theWindow, |
|
| Line 206 void DrawCrosshair(WindowType theWindow, |
|
| } |
} |
| |
|
| result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
| yindex, LeaveIndex1, tan_phi, |
yindex, LeaveIndex1, tan_phi, |
| theOtherIndexStep1) && |
theOtherIndexStep1) && |
| CheckHiddenCrosshair(theWindow, 1, xindex, |
CheckHiddenCrosshair(theWindow, 1, xindex, |
| yindex, LeaveIndex2, tan_phi, |
yindex, LeaveIndex2, tan_phi, |
| theOtherIndexStep2)); |
theOtherIndexStep2)); |
| } |
} |
| else if (phi == 90.0) { |
else if (phi == 90.0) { |
| result = CheckHiddenCrosshair(theWindow, 1, xindex, yindex, |
result = CheckHiddenCrosshair(theWindow, 1, xindex, yindex, |
| theWindow->nend-1, tan_phi, 0); |
theWindow->nend-1, tan_phi, 0); |
| } |
} |
| else if (90.0 < phi && phi < 180.0) { |
else if (90.0 < phi && phi < 180.0) { |
| gamma = rad2deg(atan( |
gamma = rad2deg(atan( |
| (double) (theWindow->nend - 1 - yindex)/ |
(double) (theWindow->nend - 1 - yindex)/ |
| (double) (xindex-theWindow->mstart)* |
(double) (xindex-theWindow->mstart)* |
| (double) (theWindow->mend - 1 - |
(double) (theWindow->mend - 1 - |
| theWindow->mstart)/ |
theWindow->mstart)/ |
| (double) (theWindow->nend - 1 - |
(double) (theWindow->nend - 1 - |
| theWindow->nstart))); |
theWindow->nstart))); |
| if (gamma >= (180.0 - phi)) { |
if (gamma >= (180.0 - phi)) { |
| LeaveIndex1 = theWindow->mstart; |
LeaveIndex1 = theWindow->mstart; |
| theOtherIndexStep1 = tan_180minusphi; |
theOtherIndexStep1 = tan_180minusphi; |
| Line 240 void DrawCrosshair(WindowType theWindow, |
|
| Line 240 void DrawCrosshair(WindowType theWindow, |
|
| theOtherIndexStep2 = -1.0/tan_180minusphi; |
theOtherIndexStep2 = -1.0/tan_180minusphi; |
| } |
} |
| result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
| yindex, LeaveIndex1, tan_phi, |
yindex, LeaveIndex1, tan_phi, |
| theOtherIndexStep1) && |
theOtherIndexStep1) && |
| CheckHiddenCrosshair(theWindow, 1, xindex, |
CheckHiddenCrosshair(theWindow, 1, xindex, |
| yindex, LeaveIndex2, tan_phi, |
yindex, LeaveIndex2, tan_phi, |
| theOtherIndexStep2)); |
theOtherIndexStep2)); |
| } |
} |
| else if (phi == 180.0) { |
else if (phi == 180.0) { |
| result = CheckHiddenCrosshair(theWindow, 0, xindex, yindex, |
result = CheckHiddenCrosshair(theWindow, 0, xindex, yindex, |
| theWindow->mstart, tan_phi, 0); |
theWindow->mstart, tan_phi, 0); |
| } |
} |
| else if (180.0 < phi && phi < 270.0) { |
else if (180.0 < phi && phi < 270.0) { |
| gamma = rad2deg(atan( |
gamma = rad2deg(atan( |
| (double) (yindex-theWindow->nstart)/ |
(double) (yindex-theWindow->nstart)/ |
| (double) (xindex-theWindow->mstart)* |
(double) (xindex-theWindow->mstart)* |
| (double) (theWindow->mend - 1 - |
(double) (theWindow->mend - 1 - |
| theWindow->mstart)/ |
theWindow->mstart)/ |
| (double) (theWindow->nend - 1 - |
(double) (theWindow->nend - 1 - |
| theWindow->nstart))); |
theWindow->nstart))); |
| if (gamma >= (phi - 180.0)) { |
if (gamma >= (phi - 180.0)) { |
| LeaveIndex1 = theWindow->mstart; |
LeaveIndex1 = theWindow->mstart; |
| theOtherIndexStep1 = 0.0 - tan_phi; |
theOtherIndexStep1 = 0.0 - tan_phi; |
| Line 273 void DrawCrosshair(WindowType theWindow, |
|
| Line 273 void DrawCrosshair(WindowType theWindow, |
|
| theOtherIndexStep2 = -1.0/tan_phi; |
theOtherIndexStep2 = -1.0/tan_phi; |
| } |
} |
| result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
| yindex, LeaveIndex1, tan_phi, |
yindex, LeaveIndex1, tan_phi, |
| theOtherIndexStep1) && |
theOtherIndexStep1) && |
| CheckHiddenCrosshair(theWindow, 1, xindex, |
CheckHiddenCrosshair(theWindow, 1, xindex, |
| yindex, LeaveIndex2, tan_phi, |
yindex, LeaveIndex2, tan_phi, |
| theOtherIndexStep2)); |
theOtherIndexStep2)); |
| } |
} |
| else if (phi == 270.0) { |
else if (phi == 270.0) { |
| result = CheckHiddenCrosshair(theWindow, 1, xindex, yindex, |
result = CheckHiddenCrosshair(theWindow, 1, xindex, yindex, |
| theWindow->nstart, tan_phi, 0); |
theWindow->nstart, tan_phi, 0); |
| } |
} |
| else { |
else { |
| gamma = rad2deg(atan( |
gamma = rad2deg(atan( |
| (double) (yindex-theWindow->nstart)/ |
(double) (yindex-theWindow->nstart)/ |
| (double) (theWindow->mend - 1 - xindex)* |
(double) (theWindow->mend - 1 - xindex)* |
| (double) (theWindow->mend - 1 - |
(double) (theWindow->mend - 1 - |
| theWindow->mstart)/ |
theWindow->mstart)/ |
| (double) (theWindow->nend - 1 - |
(double) (theWindow->nend - 1 - |
| theWindow->nstart))); |
theWindow->nstart))); |
| if (gamma >= 360.0 - phi) { |
if (gamma >= 360.0 - phi) { |
| LeaveIndex1 = theWindow->mend-1; |
LeaveIndex1 = theWindow->mend-1; |
| theOtherIndexStep1 = -tan_360minusphi; |
theOtherIndexStep1 = -tan_360minusphi; |
| Line 308 void DrawCrosshair(WindowType theWindow, |
|
| Line 308 void DrawCrosshair(WindowType theWindow, |
|
| theOtherIndexStep2 = 1.0/tan_360minusphi; |
theOtherIndexStep2 = 1.0/tan_360minusphi; |
| } |
} |
| result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
result = (CheckHiddenCrosshair(theWindow, 0, xindex, |
| yindex, LeaveIndex1, tan_phi, |
yindex, LeaveIndex1, tan_phi, |
| theOtherIndexStep1) && |
theOtherIndexStep1) && |
| CheckHiddenCrosshair(theWindow, 1, xindex, |
CheckHiddenCrosshair(theWindow, 1, xindex, |
| yindex, LeaveIndex2, tan_phi, |
yindex, LeaveIndex2, tan_phi, |
| theOtherIndexStep2)); |
theOtherIndexStep2)); |
| } |
} |
| } |
} |
| |
|
| Line 322 void DrawCrosshair(WindowType theWindow, |
|
| Line 322 void DrawCrosshair(WindowType theWindow, |
|
| |
|
| if (result) { |
if (result) { |
| XFillArc(theDisplay, pm, theWindow->xwingc, xtemp, |
XFillArc(theDisplay, pm, theWindow->xwingc, xtemp, |
| ytemp, 8, 8, 0, 23040); |
ytemp, 8, 8, 0, 23040); |
| |
|
| } |
} |
| else { |
else { |
| XDrawArc(theDisplay, pm, theWindow->xwingc, xtemp, |
XDrawArc(theDisplay, pm, theWindow->xwingc, xtemp, |
| ytemp, 8, 8, 0, 23040); |
ytemp, 8, 8, 0, 23040); |
| } |
} |
| |
|
| XCopyArea(theDisplay, pm, Tk_WindowId(tkwin), |
XCopyArea(theDisplay, pm, Tk_WindowId(tkwin), |
| theWindow->xwingc, 0, 0, |
theWindow->xwingc, 0, 0, |
| Tk_Width(tkwin), |
Tk_Width(tkwin), |
| Tk_Height(tkwin), |
Tk_Height(tkwin), |
| 0, 0); |
0, 0); |
| XFlush(theDisplay); |
XFlush(theDisplay); |
| XFreePixmap(theDisplay, pm); |
XFreePixmap(theDisplay, pm); |
| XSetClipMask(theDisplay, theWindow->xwingc, None); |
XSetClipMask(theDisplay, theWindow->xwingc, None); |
| |
|
| sprintf(TclCommand,"Update3dCrosshairValues \"%s\" %g %g %g\n", |
if (snprintf(TclCommand, TclCommand_MAX, |
| theWindow->plot_title, |
"Update3dCrosshairValues \"%s\" %g %g %g\n", |
| SurfaceX(theData,xindex)*theLabel->X_Scale, |
theWindow->plot_title, |
| SurfaceY(theData,yindex)*theLabel->Y_Scale, |
SurfaceX(theData,xindex)*theLabel->X_Scale, |
| SurfaceZ(theData,xindex,yindex)*theLabel->Z_Scale); |
SurfaceY(theData,yindex)*theLabel->Y_Scale, |
| |
SurfaceZ(theData,xindex,yindex)*theLabel->Z_Scale) == -1) { |
| |
fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__); |
| |
} |
| Tcl_Eval(interp,TclCommand); |
Tcl_Eval(interp,TclCommand); |
| |
|
| } // }}} |
} // }}} |
| |
|
| // Function void DrawWall() {{{ |
// Function void DrawWall() {{{ |
| void DrawWall(WindowType theWindow, MeshType *theBox, double c1, double d1, |
void DrawWall(WindowType theWindow, MeshType *theBox, double c1, double d1, |
| double c2, double d2, int wall, int side) |
double c2, double d2, int wall, int side) |
| { |
{ |
| XPoint thePoint[4]; |
XPoint thePoint[4]; |
| |
|
| Line 417 void DrawWall(WindowType theWindow, Mesh |
|
| Line 420 void DrawWall(WindowType theWindow, Mesh |
|
| if (side == BACK) { |
if (side == BACK) { |
| XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
| XFillPolygon(theDisplay, theWindow->pixmap_buffer, |
XFillPolygon(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| thePoint, 4, Complex, CoordModeOrigin); |
thePoint, 4, Complex, CoordModeOrigin); |
| } |
} |
| XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel); |
XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel); |
| XDrawLines(theDisplay, theWindow->pixmap_buffer, |
XDrawLines(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| thePoint, 4, CoordModeOrigin); |
thePoint, 4, CoordModeOrigin); |
| } // }}} |
} // }}} |
| |
|
| // Function void Paint_ThreeD_Window() {{{ |
// Function void Paint_ThreeD_Window() {{{ |
| Line 494 void Paint_ThreeD_Window(WindowType theW |
|
| Line 497 void Paint_ThreeD_Window(WindowType theW |
|
| RescaleThreeDWindow(theWindow,&mstart,&mend,&nstart,&nend); |
RescaleThreeDWindow(theWindow,&mstart,&mend,&nstart,&nend); |
| |
|
| if (label_Ptr->Z_Max == label_Ptr->Z_Min || |
if (label_Ptr->Z_Max == label_Ptr->Z_Min || |
| label_Ptr->Y_Max == label_Ptr->Y_Min || |
label_Ptr->Y_Max == label_Ptr->Y_Min || |
| label_Ptr->X_Max == label_Ptr->X_Min) |
label_Ptr->X_Max == label_Ptr->X_Min) |
| return; |
return; |
| |
|
| x1 = 0; |
x1 = 0; |
| Line 515 void Paint_ThreeD_Window(WindowType theW |
|
| Line 518 void Paint_ThreeD_Window(WindowType theW |
|
| theClientArea.width = x2 - x1; |
theClientArea.width = x2 - x1; |
| theClientArea.height = y2 + (theFontAscent + theFontDescent + 7); |
theClientArea.height = y2 + (theFontAscent + theFontDescent + 7); |
| XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, |
XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, |
| &theClientArea, 1, Unsorted); |
&theClientArea, 1, Unsorted); |
| |
|
| /*******************************************************************/ |
/*******************************************************************/ |
| |
|
| XSetForeground(theDisplay, theWindow->xwingc, GrayShade[3]); |
XSetForeground(theDisplay, theWindow->xwingc, GrayShade[3]); |
| XFillRectangle(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XFillRectangle(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| 0, 0, Tk_Width(tkwin), Tk_Height(tkwin)); |
0, 0, Tk_Width(tkwin), Tk_Height(tkwin)); |
| |
|
| /******************************************************/ |
/******************************************************/ |
| /* Determining the octant where the viewer is located */ |
/* Determining the octant where the viewer is located */ |
| Line 852 void Paint_ThreeD_Window(WindowType theW |
|
| Line 855 void Paint_ThreeD_Window(WindowType theW |
|
| thePolygon[1].x = theWindow->ulxc + i; |
thePolygon[1].x = theWindow->ulxc + i; |
| thePolygon[1].y = theWindow->ulyc; |
thePolygon[1].y = theWindow->ulyc; |
| XDrawLines(theDisplay, theWindow->pixmap_buffer, |
XDrawLines(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| thePolygon, 2, CoordModeOrigin); |
thePolygon, 2, CoordModeOrigin); |
| |
|
| thePolygon[0].x = theWindow->ulxc + i + 1; |
thePolygon[0].x = theWindow->ulxc + i + 1; |
| thePolygon[0].y = 0; |
thePolygon[0].y = 0; |
| thePolygon[1].x = theWindow->ulxc + i + 1; |
thePolygon[1].x = theWindow->ulxc + i + 1; |
| thePolygon[1].y = theWindow->ulyc; |
thePolygon[1].y = theWindow->ulyc; |
| XDrawLines(theDisplay, theWindow->pixmap_buffer, |
XDrawLines(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| thePolygon, 2, CoordModeOrigin); |
thePolygon, 2, CoordModeOrigin); |
| } |
} |
| XSetForeground(theDisplay, theWindow->xwingc, ThreeDColor[0]); |
XSetForeground(theDisplay, theWindow->xwingc, ThreeDColor[0]); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| theWindow->ulxc, |
theWindow->ulxc, |
| theWindow->ulyc + theFontAscent + 2, "L", 1); |
theWindow->ulyc + theFontAscent + 2, "L", 1); |
| |
|
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| ThreeDColor[MAXTHREEDCOLORS - 1]); |
ThreeDColor[MAXTHREEDCOLORS - 1]); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| theWindow->ulxc + 2 * MAXTHREEDCOLORS - |
theWindow->ulxc + 2 * MAXTHREEDCOLORS - |
| XTextWidth(theFontStruct, "H", 1), |
XTextWidth(theFontStruct, "H", 1), |
| theWindow->ulyc + theFontAscent + 2, "H", 1); |
theWindow->ulyc + theFontAscent + 2, "H", 1); |
| y1 += theFontHeight + 2; |
y1 += theFontHeight + 2; |
| } |
} |
| /***************************************/ |
/***************************************/ |
| Line 896 void Paint_ThreeD_Window(WindowType theW |
|
| Line 899 void Paint_ThreeD_Window(WindowType theW |
|
| maxlen = (k1 > maxlen) ? k1 : maxlen; |
maxlen = (k1 > maxlen) ? k1 : maxlen; |
| |
|
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x1 + maxlen - i1, y1 + theFontAscent, |
x1 + maxlen - i1, y1 + theFontAscent, |
| theString[0].buffer, i); |
theString[0].buffer, i); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x1 + (maxlen - j1) / 2, (y1 + y2) / 2, |
x1 + (maxlen - j1) / 2, (y1 + y2) / 2, |
| theString[1].buffer, j); |
theString[1].buffer, j); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x1 + maxlen - k1, y2 - theFontDescent, |
x1 + maxlen - k1, y2 - theFontDescent, |
| theString[2].buffer, k); |
theString[2].buffer, k); |
| x1 += maxlen + 2; |
x1 += maxlen + 2; |
| |
|
| i = strlen(theString[3].buffer); |
i = strlen(theString[3].buffer); |
| Line 912 void Paint_ThreeD_Window(WindowType theW |
|
| Line 915 void Paint_ThreeD_Window(WindowType theW |
|
| k1 = XTextWidth(theFontStruct, theString[5].buffer, k); |
k1 = XTextWidth(theFontStruct, theString[5].buffer, k); |
| |
|
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x1, y2 + theFontAscent + 2, |
x1, y2 + theFontAscent + 2, |
| theString[3].buffer, i); |
theString[3].buffer, i); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| (x1 + x2) / 2, y2 + theFontAscent + 2, |
(x1 + x2) / 2, y2 + theFontAscent + 2, |
| theString[4].buffer, j); |
theString[4].buffer, j); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x2 - k1 - 1, y2 + theFontAscent + 2, |
x2 - k1 - 1, y2 + theFontAscent + 2, |
| theString[5].buffer, k); |
theString[5].buffer, k); |
| |
|
| theWindow->c1 = c1 = (x2 - x1) / (xprojmax - xprojmin + DBL_MIN); |
theWindow->c1 = c1 = (x2 - x1) / (xprojmax - xprojmin + DBL_MIN); |
| theWindow->d1 = d1 = (xprojmax * x1 - xprojmin * x2) / |
theWindow->d1 = d1 = (xprojmax * x1 - xprojmin * x2) / |
| Line 928 void Paint_ThreeD_Window(WindowType theW |
|
| Line 931 void Paint_ThreeD_Window(WindowType theW |
|
| if (Is_Scatter(data_Ptr)) { |
if (Is_Scatter(data_Ptr)) { |
| XSetForeground(theDisplay, theWindow->xwingc, theBKGDColor); |
XSetForeground(theDisplay, theWindow->xwingc, theBKGDColor); |
| XFillRectangle(theDisplay, theWindow->pixmap_buffer, |
XFillRectangle(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| x1, y1, x2 - x1, y2 - y1 + 1); |
x1, y1, x2 - x1, y2 - y1 + 1); |
| XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel); |
XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel); |
| XDrawRectangle(theDisplay, theWindow->pixmap_buffer, |
XDrawRectangle(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| x1, y1, x2 - x1, y2 - y1); |
x1, y1, x2 - x1, y2 - y1); |
| } |
} |
| } |
} |
| else { |
else { |
| i = strlen(theString[0].buffer); |
i = strlen(theString[0].buffer); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x1, (int) (c2 * theString[0].y + d2 + |
x1, (int) (c2 * theString[0].y + d2 + |
| theFontAscent), |
theFontAscent), |
| theString[0].buffer, i); |
theString[0].buffer, i); |
| x1 += XTextWidth(theFontStruct, theString[0].buffer, i) + 2; |
x1 += XTextWidth(theFontStruct, theString[0].buffer, i) + 2; |
| |
|
| i = strlen(theString[5].buffer); |
i = strlen(theString[5].buffer); |
| Line 956 void Paint_ThreeD_Window(WindowType theW |
|
| Line 959 void Paint_ThreeD_Window(WindowType theW |
|
| x2 -= maxlen; |
x2 -= maxlen; |
| |
|
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x2, (int) (c2 * theString[5].y + d2 + |
x2, (int) (c2 * theString[5].y + d2 + |
| theFontAscent + 5), |
theFontAscent + 5), |
| theString[5].buffer, i); |
theString[5].buffer, i); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x2 + maxlen - j1, |
x2 + maxlen - j1, |
| (int) (c2 * theString[6].y + d2 - |
(int) (c2 * theString[6].y + d2 - |
| theFontDescent - 2), |
theFontDescent - 2), |
| theString[6].buffer, j); |
theString[6].buffer, j); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| x2 + maxlen - k1, |
x2 + maxlen - k1, |
| (int) (c2 * theString[7].y + d2 + |
(int) (c2 * theString[7].y + d2 + |
| theFontAscent), |
theFontAscent), |
| theString[7].buffer, k); |
theString[7].buffer, k); |
| x2 -= 2; |
x2 -= 2; |
| |
|
| theWindow->c1 = c1 = (x2 - x1) / (xprojmax - xprojmin + DBL_MIN); |
theWindow->c1 = c1 = (x2 - x1) / (xprojmax - xprojmin + DBL_MIN); |
| Line 978 void Paint_ThreeD_Window(WindowType theW |
|
| Line 981 void Paint_ThreeD_Window(WindowType theW |
|
| i = strlen(theString[2].buffer); |
i = strlen(theString[2].buffer); |
| i1 = XTextWidth(theFontStruct, theString[2].buffer, i); |
i1 = XTextWidth(theFontStruct, theString[2].buffer, i); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| (int) (c1 * theString[2].x + d1 - i1 - 5), |
(int) (c1 * theString[2].x + d1 - i1 - 5), |
| y2 + theFontAscent + 2, |
y2 + theFontAscent + 2, |
| theString[2].buffer, i); |
theString[2].buffer, i); |
| |
|
| j = strlen(theString[3].buffer); |
j = strlen(theString[3].buffer); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| (int) (c1 * theString[3].x + d1 + 5), |
(int) (c1 * theString[3].x + d1 + 5), |
| y2 + theFontAscent + 2, |
y2 + theFontAscent + 2, |
| theString[3].buffer, j); |
theString[3].buffer, j); |
| |
|
| i = strlen(theString[1].buffer); |
i = strlen(theString[1].buffer); |
| i1 = XTextWidth(theFontStruct, theString[1].buffer, i); |
i1 = XTextWidth(theFontStruct, theString[1].buffer, i); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| (int) (c1 * theString[1].x + d1 - i1 - 5), |
(int) (c1 * theString[1].x + d1 - i1 - 5), |
| (int) (c2 * theString[1].y + d2 + theFontAscent), |
(int) (c2 * theString[1].y + d2 + theFontAscent), |
| theString[1].buffer, i); |
theString[1].buffer, i); |
| |
|
| j = strlen(theString[4].buffer); |
j = strlen(theString[4].buffer); |
| XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
XDrawString(theDisplay, theWindow->pixmap_buffer, theWindow->xwingc, |
| (int) (c1 * theString[4].x + d1 + 5), |
(int) (c1 * theString[4].x + d1 + 5), |
| (int) (c2 * theString[4].y + d2 + |
(int) (c2 * theString[4].y + d2 + |
| theFontAscent + 5), |
theFontAscent + 5), |
| theString[4].buffer, j); |
theString[4].buffer, j); |
| } |
} |
| |
|
| theClientArea.x = x1; |
theClientArea.x = x1; |
| Line 1008 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1011 void Paint_ThreeD_Window(WindowType theW |
|
| theClientArea.width = x2 - x1 + 1; |
theClientArea.width = x2 - x1 + 1; |
| theClientArea.height = y2 - y1 + 1; |
theClientArea.height = y2 - y1 + 1; |
| XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, |
XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, |
| &theClientArea, 1, Unsorted); |
&theClientArea, 1, Unsorted); |
| |
|
| /***********************/ |
/***********************/ |
| /* Draw the back walls */ |
/* Draw the back walls */ |
| Line 1057 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1060 void Paint_ThreeD_Window(WindowType theW |
|
| |
|
| if (Is_X_Log(theWindow)) { |
if (Is_X_Log(theWindow)) { |
| a1 = 1.0 / log10(max(label_Ptr->X_Max / (label_Ptr->X_Min + DBL_MIN), |
a1 = 1.0 / log10(max(label_Ptr->X_Max / (label_Ptr->X_Min + DBL_MIN), |
| DBL_MIN)); |
DBL_MIN)); |
| b1 = log10(max(label_Ptr->X_Min / (label_Ptr->X_Scale+DBL_MIN),DBL_MIN))/ |
b1 = log10(max(label_Ptr->X_Min / (label_Ptr->X_Scale+DBL_MIN),DBL_MIN))/ |
| log10(max(label_Ptr->X_Max / (label_Ptr->X_Min+DBL_MIN), DBL_MIN)); |
log10(max(label_Ptr->X_Max / (label_Ptr->X_Min+DBL_MIN), DBL_MIN)); |
| } |
} |
| Line 1067 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1070 void Paint_ThreeD_Window(WindowType theW |
|
| } |
} |
| if (Is_Y_Log(theWindow)) { |
if (Is_Y_Log(theWindow)) { |
| a2 = 1.0 / log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN), |
a2 = 1.0 / log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN), |
| DBL_MIN)); |
DBL_MIN)); |
| b2 = log10(max(label_Ptr->Y_Min/(label_Ptr->Y_Scale+DBL_MIN),DBL_MIN)) / |
b2 = log10(max(label_Ptr->Y_Min/(label_Ptr->Y_Scale+DBL_MIN),DBL_MIN)) / |
| log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN),DBL_MIN)); |
log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN),DBL_MIN)); |
| } |
} |
| Line 1077 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1080 void Paint_ThreeD_Window(WindowType theW |
|
| } |
} |
| if (Is_Z_Log(theWindow)) { |
if (Is_Z_Log(theWindow)) { |
| a3 = 1.0 / log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN), |
a3 = 1.0 / log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN), |
| DBL_MIN)); |
DBL_MIN)); |
| b3 = log10(max(label_Ptr->Z_Min/(label_Ptr->Z_Scale+DBL_MIN),DBL_MIN)) / |
b3 = log10(max(label_Ptr->Z_Min/(label_Ptr->Z_Scale+DBL_MIN),DBL_MIN)) / |
| log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN),DBL_MIN)); |
log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN),DBL_MIN)); |
| } |
} |
| Line 1094 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1097 void Paint_ThreeD_Window(WindowType theW |
|
| for (i = 0; i < n; i++) { |
for (i = 0; i < n; i++) { |
| if (Is_X_Log(theWindow)) |
if (Is_X_Log(theWindow)) |
| xtemp = max(a1 * log10(fabs(ScatterX(data_Ptr,i)) + DBL_MIN) - |
xtemp = max(a1 * log10(fabs(ScatterX(data_Ptr,i)) + DBL_MIN) - |
| b1,DBL_MIN); |
b1,DBL_MIN); |
| else |
else |
| xtemp = a1 * ScatterX(data_Ptr,i) - b1; |
xtemp = a1 * ScatterX(data_Ptr,i) - b1; |
| if (Is_Y_Log(theWindow)) |
if (Is_Y_Log(theWindow)) |
| ytemp = max(a2 * log10(fabs(ScatterY(data_Ptr,i)) + DBL_MIN) - |
ytemp = max(a2 * log10(fabs(ScatterY(data_Ptr,i)) + DBL_MIN) - |
| b2,DBL_MIN); |
b2,DBL_MIN); |
| else |
else |
| ytemp = a2 * ScatterY(data_Ptr,i) - b2; |
ytemp = a2 * ScatterY(data_Ptr,i) - b2; |
| if (Is_Z_Log(theWindow)) |
if (Is_Z_Log(theWindow)) |
| ztemp = max(a3 * log10(fabs(ScatterZ(data_Ptr,i)) + DBL_MIN) - |
ztemp = max(a3 * log10(fabs(ScatterZ(data_Ptr,i)) + DBL_MIN) - |
| b3,DBL_MIN); |
b3,DBL_MIN); |
| else |
else |
| ztemp = a3 * ScatterZ(data_Ptr,i) - b3; |
ztemp = a3 * ScatterZ(data_Ptr,i) - b3; |
| if (0.0 < xtemp && xtemp < 1.0 && |
if (0.0 < xtemp && xtemp < 1.0 && |
| 0.0 < ytemp && ytemp < 1.0 && |
0.0 < ytemp && ytemp < 1.0 && |
| 0.0 < ztemp && ztemp < 1.0) { |
0.0 < ztemp && ztemp < 1.0) { |
| if (Is_ColorCode_On(theWindow)) { |
if (Is_ColorCode_On(theWindow)) { |
| if (Is_Z_Log(theWindow)) |
if (Is_Z_Log(theWindow)) |
| colornumber = MAXTHREEDCOLORS * |
colornumber = MAXTHREEDCOLORS * |
| Line 1123 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1126 void Paint_ThreeD_Window(WindowType theW |
|
| else if (colornumber < 0) |
else if (colornumber < 0) |
| colornumber = 0; |
colornumber = 0; |
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| ThreeDColor[colornumber]); |
ThreeDColor[colornumber]); |
| } |
} |
| XDrawPoint(theDisplay, theWindow->pixmap_buffer, |
XDrawPoint(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, |
theWindow->xwingc, |
| (int) (c1 * (u1 * xtemp + |
(int) (c1 * (u1 * xtemp + |
| u2 * ytemp + |
u2 * ytemp + |
| u3 * ztemp) + d1), |
u3 * ztemp) + d1), |
| (int) (c2 * (v1 * xtemp + |
(int) (c2 * (v1 * xtemp + |
| v2 * ytemp + |
v2 * ytemp + |
| v3 * ztemp) + d2)); |
v3 * ztemp) + d2)); |
| } |
} |
| } |
} |
| } |
} |
| Line 1143 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1146 void Paint_ThreeD_Window(WindowType theW |
|
| for (j = 0; j < n; j++) { |
for (j = 0; j < n; j++) { |
| if (Is_X_Log(theWindow)) |
if (Is_X_Log(theWindow)) |
| xtemp = max(a1 * log10(fabs(IrregularX(data_Ptr,i,j)) + |
xtemp = max(a1 * log10(fabs(IrregularX(data_Ptr,i,j)) + |
| DBL_MIN) - b1, DBL_MIN); |
DBL_MIN) - b1, DBL_MIN); |
| else |
else |
| xtemp = a1 * IrregularX(data_Ptr,i,j) - b1; |
xtemp = a1 * IrregularX(data_Ptr,i,j) - b1; |
| if (Is_Y_Log(theWindow)) |
if (Is_Y_Log(theWindow)) |
| ytemp = max(a2 * log10(fabs(IrregularY(data_Ptr,i,j)) + |
ytemp = max(a2 * log10(fabs(IrregularY(data_Ptr,i,j)) + |
| DBL_MIN) - b2,DBL_MIN); |
DBL_MIN) - b2,DBL_MIN); |
| else |
else |
| ytemp = a2 * IrregularY(data_Ptr,i,j) - b2; |
ytemp = a2 * IrregularY(data_Ptr,i,j) - b2; |
| if (Is_Z_Log(theWindow)) |
if (Is_Z_Log(theWindow)) |
| ztemp = max(a3 * log10(fabs(IrregularZ(data_Ptr,i,j)) + |
ztemp = max(a3 * log10(fabs(IrregularZ(data_Ptr,i,j)) + |
| DBL_MIN) - b3,DBL_MIN); |
DBL_MIN) - b3,DBL_MIN); |
| else |
else |
| ztemp = a3 * IrregularZ(data_Ptr,i,j) - b3; |
ztemp = a3 * IrregularZ(data_Ptr,i,j) - b3; |
| if (ztemp > 1.0) |
if (ztemp > 1.0) |
| Line 1168 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1171 void Paint_ThreeD_Window(WindowType theW |
|
| for (j = 0; j < n; j++) { |
for (j = 0; j < n; j++) { |
| if (Is_X_Log(theWindow)) |
if (Is_X_Log(theWindow)) |
| xtemp = max(a1 * log10(fabs(SurfaceX(data_Ptr,i) + |
xtemp = max(a1 * log10(fabs(SurfaceX(data_Ptr,i) + |
| DBL_MIN)) - b1,DBL_MIN); |
DBL_MIN)) - b1,DBL_MIN); |
| else |
else |
| xtemp = a1 * SurfaceX(data_Ptr,i) - b1; |
xtemp = a1 * SurfaceX(data_Ptr,i) - b1; |
| if (Is_Y_Log(theWindow)) |
if (Is_Y_Log(theWindow)) |
| ytemp = max(a2 * log10(fabs(SurfaceY(data_Ptr,j) + |
ytemp = max(a2 * log10(fabs(SurfaceY(data_Ptr,j) + |
| DBL_MIN)) - b2,DBL_MIN); |
DBL_MIN)) - b2,DBL_MIN); |
| else |
else |
| ytemp = a2 * SurfaceY(data_Ptr,j) - b2; |
ytemp = a2 * SurfaceY(data_Ptr,j) - b2; |
| if (Is_Z_Log(theWindow)) |
if (Is_Z_Log(theWindow)) |
| ztemp = max(a3 * log10(fabs(SurfaceZ(data_Ptr,i,j) + |
ztemp = max(a3 * log10(fabs(SurfaceZ(data_Ptr,i,j) + |
| DBL_MIN)) - b3,DBL_MIN); |
DBL_MIN)) - b3,DBL_MIN); |
| else |
else |
| ztemp = a3 * SurfaceZ(data_Ptr,i,j) - b3; |
ztemp = a3 * SurfaceZ(data_Ptr,i,j) - b3; |
| if (ztemp > 1.0) |
if (ztemp > 1.0) |
| Line 1244 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1247 void Paint_ThreeD_Window(WindowType theW |
|
| theWindow->data->yCoord = nstart; |
theWindow->data->yCoord = nstart; |
| else if (theWindow->data->yCoord > nend-1) |
else if (theWindow->data->yCoord > nend-1) |
| theWindow->data->yCoord = nend; |
theWindow->data->yCoord = nend; |
| sprintf(TclCommand,"Set3dCross \"%s\" %d %d %d %d\n", |
if (snprintf(TclCommand, TclCommand_MAX,"Set3dCross \"%s\" %d %d %d %d\n", |
| theWindow->plot_title, |
theWindow->plot_title, |
| mstart,mend, |
mstart,mend, |
| nstart,nend); |
nstart,nend) == -1) { |
| |
fprintf(stderr, "Warning: TclCommand truncated at %s:%d\n", __FILE__, __LINE__); |
| |
} |
| Tcl_Eval(interp,TclCommand); |
Tcl_Eval(interp,TclCommand); |
| Open_Before(theWindow); |
Open_Before(theWindow); |
| } |
} |
| Line 1288 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1293 void Paint_ThreeD_Window(WindowType theW |
|
| else if (colornumber < 0) |
else if (colornumber < 0) |
| colornumber = 0; |
colornumber = 0; |
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| ThreeDColor[colornumber]); |
ThreeDColor[colornumber]); |
| } |
} |
| else |
else |
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| data_Ptr->color); |
data_Ptr->color); |
| } |
} |
| else |
else |
| XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
| |
|
| XFillPolygon(theDisplay, theWindow->pixmap_buffer, |
XFillPolygon(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, thePolygon, |
theWindow->xwingc, thePolygon, |
| 5, Complex, CoordModeOrigin); |
5, Complex, CoordModeOrigin); |
| |
|
| if (Is_Shading_On(theWindow)) |
if (Is_Shading_On(theWindow)) |
| XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
XSetForeground(theDisplay, theWindow->xwingc, theBlackPixel); |
| Line 1323 void Paint_ThreeD_Window(WindowType theW |
|
| Line 1328 void Paint_ThreeD_Window(WindowType theW |
|
| else if (colornumber < 0) |
else if (colornumber < 0) |
| colornumber = 0; |
colornumber = 0; |
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| ThreeDColor[colornumber]); |
ThreeDColor[colornumber]); |
| } |
} |
| else |
else |
| XSetForeground(theDisplay, theWindow->xwingc, |
XSetForeground(theDisplay, theWindow->xwingc, |
| data_Ptr->color); |
data_Ptr->color); |
| } |
} |
| if (Is_Grid_On(theWindow)) |
if (Is_Grid_On(theWindow)) |
| XDrawLines(theDisplay, theWindow->pixmap_buffer, |
XDrawLines(theDisplay, theWindow->pixmap_buffer, |
| theWindow->xwingc, thePolygon, |
theWindow->xwingc, thePolygon, |
| 5, CoordModeOrigin); |
5, CoordModeOrigin); |
| } |
} |
| } |
} |
| |
|