1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/math/femlab/files/patch-ab
Thomas Gellekum 35ce506e64 Fix bad math.
PR:		5935
Submitted by:	Pedro Giffuni <giffunip@asme.org>
1998-03-10 10:17:16 +00:00

89 lines
2.1 KiB
Plaintext

*** 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()
{
float xoff, yoff;
! float scl;
int width, height;
int ww;
int nx, ny, id;
--- 611,617 ----
void getDrawingScale()
{
float xoff, yoff;
! float iscl; /* inverse scale */
int width, height;
int ww;
int nx, ny, id;
***************
*** 630,654 ****
width = width / nx;
height = height / ny;
! if(state > HAVE_NOTHING){
! 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);
! 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;
! 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 (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;
! 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;
! }
SetDrawArea(drawWindow);
if(device == PS)
psGetScale();
+ }
}
void getBoundaryScale(Widget w, void *data)