Fix bad math.
PR: 5935 Submitted by: Pedro Giffuni <giffunip@asme.org>
This commit is contained in:
parent
4867fc7f94
commit
35ce506e64
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=10094
2 changed files with 57 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
|||
*** source/Imakefile.orig Tue Sep 2 10:38:18 1997
|
||||
--- source/Imakefile Tue Sep 2 10:39:42 1997
|
||||
*** source/Imakefile.orig Tue Sep 19 02:22:29 1995
|
||||
--- source/Imakefile Fri Mar 6 22:03:52 1998
|
||||
***************
|
||||
*** 17,29 ****
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
! CC = gcc -O2
|
||||
! CC = gcc -O $(CFLAGS)
|
||||
CDEBUGFLAGS =
|
||||
EXTRA_INCLUDES = -I../include
|
||||
#
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
*** source/graph.c.orig Sat Sep 13 16:23:18 1997
|
||||
--- source/graph.c Sat Sep 13 16:39:13 1997
|
||||
*** source/graph.c.orig Thu Sep 14 08:42:13 1995
|
||||
--- source/graph.c Sat Mar 7 00:14:42 1998
|
||||
***************
|
||||
*** 14,21 ****
|
||||
--- 14,24 ----
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+ #ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
+ #else
|
||||
#include <malloc.h>
|
||||
+ #endif
|
||||
#include <math.h>
|
||||
|
||||
|
||||
***************
|
||||
*** 608,614 ****
|
||||
void getDrawingScale()
|
||||
|
@ -9,7 +23,7 @@
|
|||
int width, height;
|
||||
int ww;
|
||||
int nx, ny, id;
|
||||
--- 608,614 ----
|
||||
--- 611,617 ----
|
||||
void getDrawingScale()
|
||||
{
|
||||
float xoff, yoff;
|
||||
|
@ -18,7 +32,7 @@
|
|||
int ww;
|
||||
int nx, ny, id;
|
||||
***************
|
||||
*** 630,645 ****
|
||||
*** 630,654 ****
|
||||
width = width / nx;
|
||||
height = height / ny;
|
||||
|
||||
|
@ -26,30 +40,49 @@
|
|||
! scl = 1./max(xmax-xmin,ymax-ymin);
|
||||
! xoff = -scl*(xmin+.5*(xmax-xmin)-.5/scl);
|
||||
! yoff = -scl*(ymin+.5*(ymax-ymin)-.5/scl);
|
||||
|
||||
!
|
||||
! xoff = - xmin*scl*.85;
|
||||
! yoff = - ymin*scl*.85;
|
||||
|
||||
ww = min(width, height);
|
||||
!
|
||||
! ww = min(width, height);
|
||||
! Xscl = (int) ((float)ww * 0.85 * scl);
|
||||
Xxoff = (int) ww * xoff ;
|
||||
Xyoff = (int) ww * yoff;
|
||||
Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width;
|
||||
--- 630,646 ----
|
||||
! Xxoff = (int) ww * xoff ;
|
||||
! Xyoff = (int) ww * yoff;
|
||||
! Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width;
|
||||
! Xyoff += (int) (height - ( Xscl*ymax +Xyoff))/2 + (int)(id/(nx+.5)) *height;
|
||||
! }
|
||||
|
||||
SetDrawArea(drawWindow);
|
||||
if(device == PS)
|
||||
psGetScale();
|
||||
}
|
||||
|
||||
void getBoundaryScale(Widget w, void *data)
|
||||
--- 633,659 ----
|
||||
width = width / nx;
|
||||
height = height / ny;
|
||||
|
||||
! iscl = max(xmax-xmin,ymax-ymin);
|
||||
|
||||
! if((state > HAVE_NOTHING) && (iscl != 0.0)){
|
||||
! if (iscl != 0.0) {
|
||||
! if(state > HAVE_NOTHING) {
|
||||
! /* These are recalculated ??
|
||||
! xoff = .5-(xmin+.5*(xmax-xmin))/iscl;
|
||||
! yoff = .5-(ymin+.5*(ymax-ymin))/iscl;
|
||||
!
|
||||
! xoff = - xmin*.85/iscl;
|
||||
! yoff = - ymin*.85/iscl;
|
||||
! */
|
||||
! xoff = - xmin*.85/iscl;
|
||||
! yoff = - ymin*.85/iscl;
|
||||
! ww = min(width, height);
|
||||
! Xscl = (int) ((float)ww * 0.85 / iscl);
|
||||
! Xxoff = (int) ww * xoff ;
|
||||
! Xyoff = (int) ww * yoff;
|
||||
! Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width;
|
||||
! Xyoff += (int) (height - ( Xscl*ymax +Xyoff))/2 + (int)(id/(nx+.5)) *height;
|
||||
! }
|
||||
|
||||
ww = min(width, height);
|
||||
! Xscl = (int) ((float)ww * 0.85 / iscl);
|
||||
Xxoff = (int) ww * xoff ;
|
||||
Xyoff = (int) ww * yoff;
|
||||
Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width;
|
||||
SetDrawArea(drawWindow);
|
||||
if(device == PS)
|
||||
psGetScale();
|
||||
+ }
|
||||
}
|
||||
|
||||
void getBoundaryScale(Widget w, void *data)
|
||||
|
|
Loading…
Reference in a new issue