version 1.9, 2013/12/19 06:04:09 |
version 1.11, 2014/06/27 07:58:29 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/plot/calc.c,v 1.8 2011/08/10 04:51:58 saito Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/plot/calc.c,v 1.10 2014/05/12 16:54:40 saito Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
|
|
#endif |
#endif |
|
|
void calc(double **tab,struct canvas *can,int nox){ |
void calc(double **tab,struct canvas *can,int nox){ |
//memory_plot,MODE_IFPLOTD,MODE_INEQND,MODE_INEQNANDD,MODE_INEQNORD |
//memory_plot,IFPLOTD,INEQND,INEQNANDD,INEQNORD |
//MODE_INEQNXORD,conplotmainD |
//INEQNXORD,conplotmainD |
double x,y,xstep,ystep; |
double x,y,xstep,ystep; |
int ix,iy; |
int ix,iy; |
Real r,rx,ry; |
Real r,rx,ry; |
Line 93 void calc(double **tab,struct canvas *can,int nox){ |
|
Line 93 void calc(double **tab,struct canvas *can,int nox){ |
|
} |
} |
|
|
void calcq(double **tab,struct canvas *can,int nox){ |
void calcq(double **tab,struct canvas *can,int nox){ |
//MODE_IFPLOTQ,MODE_INEQNQ,MODE_INEQNANDQ,MODE_INEQNORQ,MODE_INEQNXORQ |
//IFPLOTQ,INEQNQ,INEQNANDQ,INEQNORQ,INEQNXORQ |
//plotoverD |
//plotoverD |
Q dx,dy,xstep,ystep,q1,w,h,c; |
Q dx,dy,xstep,ystep,q1,w,h,c; |
P g,g1,f1,f2,x,y; |
P g,g1,f1,f2,x,y; |
Line 131 void calcq(double **tab,struct canvas *can,int nox){ |
|
Line 131 void calcq(double **tab,struct canvas *can,int nox){ |
|
} |
} |
|
|
void calcb(double **tab,struct canvas *can,int nox){ |
void calcb(double **tab,struct canvas *can,int nox){ |
//MODE_IFPLOTB,MODE_INEQNB,MODE_INEQNANDB,MODE_INEQNORB,MODE_INEQNXORB |
//IFPLOTB,INEQNB,INEQNANDB,INEQNORB,INEQNXORB |
Q dx,dy,xstep,ystep,q1,w,h,c; |
Q dx,dy,xstep,ystep,q1,w,h,c; |
P g,g1,f1,f2,x,y,t,s; |
P g,g1,f1,f2,x,y,t,s; |
int ix,iy,*a,*pa; |
int ix,iy,*a,*pa; |
Line 418 void plotcalc(struct canvas *can){ |
|
Line 418 void plotcalc(struct canvas *can){ |
|
} |
} |
} |
} |
|
|
void polarplotcalc(struct canvas *can){ |
void polarcalc(struct canvas *can){ |
//polarplotNG |
double xmax,xmin,ymax,ymin,dx,dy,pmin,pstep,tr,p,*tabx,*taby; |
double xmax,xmin,ymax,ymin,dx,dy,pmin,pstep,tr,p, *tabx,*taby; |
|
double usubstrp(); |
double usubstrp(); |
int i,nstep,w,h; |
int i,nstep,w,h; |
POINT *pa; |
POINT *pa; |
Line 433 void polarplotcalc(struct canvas *can){ |
|
Line 432 void polarplotcalc(struct canvas *can){ |
|
tabx=(double *)ALLOCA(nstep*sizeof(double)); |
tabx=(double *)ALLOCA(nstep*sizeof(double)); |
taby=(double *)ALLOCA(nstep*sizeof(double)); |
taby=(double *)ALLOCA(nstep*sizeof(double)); |
MKReal(1,r); // dummy real number |
MKReal(1,r); // dummy real number |
|
|
for(i=0,p=pmin;i<nstep;i++,p+= pstep){ |
for(i=0,p=pmin;i<nstep;i++,p+= pstep){ |
// full substitution |
// full substitution |
BDY(r)=p; |
BDY(r)=p; |
substr(CO,0,fr,can->vx,p?(Obj)r:0,&s); |
substr(CO,0,fr,can->vx,p?(Obj)r:0,&s); |
devalr(CO,(Obj)s,&t); |
devalr(CO,(Obj)s,&t); |
if(t&&(OID(t)!=O_N||NID((Num)t)!=N_R)) |
if(t&&(OID(t)!=O_N||NID((Num)t)!=N_R)) |
error("polarplotcalc : invalid evaluation"); |
error("polarcalc : invalid evaluation"); |
tr=ToReal((Num)t); |
tr=ToReal((Num)t); |
tabx[i]=tr*cos(p); |
tabx[i]=tr*cos(p); |
taby[i]=tr*sin(p); |
taby[i]=tr*sin(p); |
Line 465 void polarplotcalc(struct canvas *can){ |
|
Line 465 void polarplotcalc(struct canvas *can){ |
|
} |
} |
} |
} |
|
|
|
void polarcalcNG(struct canvas *can){ |
|
//polarplotNG |
|
double xmax,xmin,ymax,ymin,dx,dy,pmin,pstep,tr,p, *tabx,*taby; |
|
double usubstrp(); |
|
int i,ix,iy,nstep,w,h; |
|
POINT *pa; |
|
Real r; |
|
Obj fr,t,s; |
|
|
|
MKReal(1.0,r); mulr(CO,(Obj)can->formula,(Obj)r,&fr); |
|
w=can->width; h=can->height; nstep=can->nzstep; |
|
pmin=can->zmin; pstep=(can->zmax-can->zmin)/nstep; |
|
tabx=(double *)ALLOCA(nstep*sizeof(double)); |
|
taby=(double *)ALLOCA(nstep*sizeof(double)); |
|
MKReal(1,r); // dummy real number |
|
|
|
for(i=0,p=pmin;i<nstep;i++,p+= pstep){ |
|
// full substitution |
|
BDY(r)=p; |
|
substr(CO,0,fr,can->vx,p?(Obj)r:0,&s); |
|
devalr(CO,(Obj)s,&t); |
|
if(t&&(OID(t)!=O_N||NID((Num)t)!=N_R)) |
|
error("polarcalc : invalid evaluation"); |
|
tr=ToReal((Num)t); |
|
tabx[i]=tr*cos(p); |
|
taby[i]=tr*sin(p); |
|
if(i==0){ |
|
xmax=xmin=tabx[0]; |
|
ymax=ymin=taby[0]; |
|
} else { |
|
if(tabx[i]>xmax)xmax=tabx[i]; |
|
if(tabx[i]<xmin)xmin=tabx[i]; |
|
if(taby[i]>ymax)ymax=taby[i]; |
|
if(taby[i]<ymin)ymin=taby[i]; |
|
} |
|
} |
|
can->xmax=xmax;can->xmin=xmin; |
|
can->ymax=ymax;can->ymin=ymin; |
|
dx=xmax-xmin; |
|
dy=ymax-ymin; |
|
can->pa=(struct pa *)MALLOC(sizeof(struct pa)); |
|
can->pa[0].length=nstep; |
|
can->pa[0].pos=pa=(POINT *)MALLOC(w*sizeof(POINT)); |
|
for(i=0;i<nstep;i++){ |
|
XC(pa[i])=(w-1)*(tabx[i]-xmin)/dx; |
|
YC(pa[i])=(h-1)*(ymax-taby[i])/dy; |
|
} |
|
} |
|
|
/* |
/* |
void ineqncalc(double **tab,struct canvas *can,int nox){ |
void ineqncalc(double **tab,struct canvas *can,int nox){ |
double x,y,xmin,ymin,xstep,ystep; |
double x,y,xmin,ymin,xstep,ystep; |
Line 497 void ineqncalc(double **tab,struct canvas *can,int nox |
|
Line 546 void ineqncalc(double **tab,struct canvas *can,int nox |
|
|
|
#if defined(INTERVAL) |
#if defined(INTERVAL) |
void itvcalc(double **mask, struct canvas *can, int nox){ |
void itvcalc(double **mask, struct canvas *can, int nox){ |
//MODE_ITVIFPLOT |
//ITVIFPLOT |
double x,y,xstep,ystep,dx,dy,wx,wy; |
double x,y,xstep,ystep,dx,dy,wx,wy; |
int idv,ix,iy,idx,idy; |
int idv,ix,iy,idx,idy; |
Itv ity,itx,ddx,ddy; |
Itv ity,itx,ddx,ddy; |