Télécharger qualt.eso

Retour à la liste

Numérotation des lignes :

qualt
  1. C QUALT SOURCE JC220346 16/11/29 21:15:32 9221
  2. C Calcul qualite d'un tetraedre par example le rapport du rayon de
  3. C la sphere inscrite au rayon de la sphere circonscrite
  4. C
  5. FUNCTION QUALT(I1,I2,I3,I4)
  6. C
  7. IMPLICIT INTEGER(I-N)
  8. IMPLICIT REAL*8(A-H,O-Z)
  9. -INC TDEMAIT
  10.  
  11. -INC PPARAM
  12. -INC CCOPTIO
  13. -INC CCREEL
  14. VTOT=VOL(I1,I2,I3,I4)
  15. *
  16. x1=xyz(1,i1)
  17. y1=xyz(2,i1)
  18. z1=xyz(3,i1)
  19. x2=xyz(1,i2)
  20. y2=xyz(2,i2)
  21. z2=xyz(3,i2)
  22. x3=xyz(1,i3)
  23. y3=xyz(2,i3)
  24. z3=xyz(3,i3)
  25. x4=xyz(1,i4)
  26. y4=xyz(2,i4)
  27. z4=xyz(3,i4)
  28. * sphere circonscrite le centre est l'intersection des plan mediateurs
  29. * de 12 13 et 14
  30. x21=x2-x1
  31. y21=y2-y1
  32. z21=z2-z1
  33. s21=sqrt(x21**2+y21**2+z21**2)
  34. x21n=x21/s21
  35. y21n=y21/s21
  36. z21n=z21/s21
  37. x12m=(x1+x2)/2
  38. y12m=(y1+y2)/2
  39. z12m=(z1+z2)/2
  40. *
  41. x31=x3-x1
  42. y31=y3-y1
  43. z31=z3-z1
  44. s31=sqrt(x31**2+y31**2+z31**2)
  45. x31n=x31/s31
  46. y31n=y31/s31
  47. z31n=z31/s31
  48. x13m=(x1+x3)/2
  49. y13m=(y1+y3)/2
  50. z13m=(z1+z3)/2
  51. *
  52. x41=x4-x1
  53. y41=y4-y1
  54. z41=z4-z1
  55. s41=sqrt(x41**2+y41**2+z41**2)
  56. x41n=x41/s41
  57. y41n=y41/s41
  58. z41n=z41/s41
  59. x14m=(x1+x4)/2
  60. y14m=(y1+y4)/2
  61. z14m=(z1+z4)/2
  62. * mediateur de 12
  63. xs=x12m
  64. ys=y12m
  65. zs=z12m
  66. * direction perpendiculaire a 12 dans le plan 123
  67. scal=x31*x21n+y31*y21n+z31*z21n
  68. xd1=x31-scal*x21n
  69. yd1=y31-scal*y21n
  70. zd1=z31-scal*z21n
  71. * distance au plan mediateur de 13
  72. scal=(x13m-xs)*x31n+(y13m-ys)*y31n+(z13m-zs)*z31n
  73. scald=xd1*x31n+yd1*y31n+zd1*z31n+xspeti
  74. coef=scal/scald
  75. * mediateur de 123
  76. xs=xs+coef*xd1
  77. ys=ys+coef*yd1
  78. zs=zs+coef*zd1
  79. * direction normale a 123
  80. xd1=y21*z31-z21*y31
  81. yd1=z21*x31-x21*z31
  82. zd1=x21*y31-y21*x31
  83. * distance au plan mediateur de 14
  84. scal=(x14m-xs)*x41n+(y14m-ys)*y41n+(z14m-zs)*z41n
  85. scald=xd1*x41n+yd1*y41n+zd1*z41n+xspeti
  86. coef=scal/scald
  87. * mediateur de 1234
  88. xs=xs+coef*xd1
  89. ys=ys+coef*yd1
  90. zs=zs+coef*zd1
  91. * verification
  92. rc=sqrt((xs-x1)**2+(ys-y1)**2+(zs-z1)**2)
  93. * r2=sqrt((xs-x2)**2+(ys-y2)**2+(zs-z2)**2)
  94. * r3=sqrt((xs-x3)**2+(ys-y3)**2+(zs-z3)**2)
  95. * r4=sqrt((xs-x4)**2+(ys-y4)**2+(zs-z4)**2)
  96. * write (6,*) ' rayons ',r1,r2,r3,r4
  97. * write (6,*) ' rayon sphere circonscrite ',rc
  98. *
  99. * sphere inscrite
  100. *
  101. * normale a 123
  102. xn123=(y2-y1)*(z3-z1)-(z2-z1)*(y3-y1)
  103. yn123=(z2-z1)*(x3-x1)-(x2-x1)*(z3-z1)
  104. zn123=(x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)
  105. sn123=sqrt(xn123**2+yn123**2+zn123**2)
  106. xn123=xn123/sn123
  107. yn123=yn123/sn123
  108. zn123=zn123/sn123
  109. * normale a 134
  110. xn134=(y3-y1)*(z4-z1)-(z3-z1)*(y4-y1)
  111. yn134=(z3-z1)*(x4-x1)-(x3-x1)*(z4-z1)
  112. zn134=(x3-x1)*(y4-y1)-(y3-y1)*(x4-x1)
  113. sn134=sqrt(xn134**2+yn134**2+zn134**2)
  114. xn134=xn134/sn134
  115. yn134=yn134/sn134
  116. zn134=zn134/sn134
  117. * normale a 142
  118. xn142=(y4-y1)*(z2-z1)-(z4-z1)*(y2-y1)
  119. yn142=(z4-z1)*(x2-x1)-(x4-x1)*(z2-z1)
  120. zn142=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1)
  121. sn142=sqrt(xn142**2+yn142**2+zn142**2)
  122. xn142=xn142/sn142
  123. yn142=yn142/sn142
  124. zn142=zn142/sn142
  125. * direction du centre a partir de 1
  126. xd1=(yn123-yn134)*(zn134-zn142)-(zn123-zn134)*(yn134-yn142)
  127. yd1=(zn123-zn134)*(xn134-xn142)-(xn123-xn134)*(zn134-zn142)
  128. zd1=(xn123-xn134)*(yn134-yn142)-(yn123-yn134)*(xn134-xn142)
  129. * normale a 432
  130. xn432=(y3-y4)*(z2-z4)-(z3-z4)*(y2-y4)
  131. yn432=(z3-z4)*(x2-x4)-(x3-x4)*(z2-z4)
  132. zn432=(x3-x4)*(y2-y4)-(y3-y4)*(x2-x4)
  133. sn432=sqrt(xn432**2+yn432**2+zn432**2)
  134. xn432=xn432/sn432
  135. yn432=yn432/sn432
  136. zn432=zn432/sn432
  137. * petit calcul
  138. xnum=(x2-x1)*xn432+(y2-y1)*yn432+(z2-z1)*zn432
  139. xden=xd1*(xn123-xn432)+yd1*(yn123-yn432)+zd1*(zn123-zn432)+xspeti
  140. rap=-xnum/xden
  141. xi=x1+rap*xd1
  142. yi=y1+rap*yd1
  143. zi=z1+rap*zd1
  144. * verif
  145. * ri123=(xi-x1)*xn123+(yi-y1)*yn123+(zi-z1)*zn123
  146. * ri134=(xi-x1)*xn134+(yi-y1)*yn134+(zi-z1)*zn134
  147. * ri142=(xi-x1)*xn142+(yi-y1)*yn142+(zi-z1)*zn142
  148. * ri234=(xi-x2)*xn432+(yi-y2)*yn432+(zi-z2)*zn432
  149. ri=abs((xi-x1)*xn123+(yi-y1)*yn123+(zi-z1)*zn123)
  150. * write (6,*) ' rayon sphere inscrite ',ri
  151. * arete maxi
  152. x32=x3-x2
  153. y32=y3-y2
  154. z32=z3-z2
  155. s32=sqrt(x32**2+y32**2+z32**2)
  156. x42=x4-x2
  157. y42=y4-y2
  158. z42=z4-z2
  159. s42=sqrt(x42**2+y42**2+z42**2)
  160. x43=x4-x3
  161. y43=y4-y3
  162. z43=z4-z3
  163. s43=sqrt(x43**2+y43**2+z43**2)
  164. s=max(s21,s31,s41,s32,s42,s43)
  165. * qualt=ri/rc
  166. qualt=ri/s
  167. if (vtot.le.0.) qualt=-1e8
  168. * write (6,*) ' qualt ',qualt
  169. END
  170.  
  171.  
  172.  
  173.  
  174.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales