您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536
  1. #include <stdlib.h>
  2. #include <math.h>
  3. float vcoef(float av, float at, float bv, float bt)
  4. {
  5. float dv,dt;
  6. float f;
  7. #define K 500
  8. dv=av-bv;
  9. dt=at-bt;
  10. f=dv*dv+dt*dt;
  11. return (1.0/(1.0+K*f));
  12. }
  13. void dres(
  14. float av, float at, float bv, float bt,
  15. float cv, float ct, float dv, float dt,
  16. float *v , float *t)
  17. {
  18. float wab,wac,wda,wbc,wbd,wcd;
  19. wab=vcoef(av,at,bv,bt);
  20. wac=vcoef(av,at,cv,ct);
  21. wda=vcoef(dv,dt,av,at);
  22. wbc=vcoef(bv,bt,cv,ct);
  23. wbd=vcoef(bv,bt,dv,dt);
  24. wcd=vcoef(cv,ct,dv,dt);
  25. *v=(wab*(av+bv)+wac*(av+cv)+wda*(dv+av)+wbc*(bv+cv)+wbd*(bv+dv)+wcd*(cv+dv))/(2.0*(wab+wac+wda+wbc+wbd+wcd));
  26. *t=(wab*(at+bt)+wac*(at+ct)+wda*(dt+at)+wbc*(bt+ct)+wbd*(bt+dt)+wcd*(ct+dt))/(2.0*(wab+wac+wda+wbc+wbd+wcd));
  27. }