fork(3) download
  1. #include <stdio.h>
  2.  
  3. typedef struct
  4. {
  5. signed long x0; signed long y0; signed long z0;
  6. signed long x1; signed long y1; signed long z1;
  7. signed long x2; signed long y2; signed long z2;
  8. signed long x3; signed long y3; signed long z3;
  9. } Treug_t;
  10.  
  11. //решение уравнения плоскости
  12. signed long ReshUrPlsk(Treug_t* s)
  13. {
  14. return (signed long)((
  15. ((float)((s->x0)-(s->x1)))
  16. *
  17. (((s->y1)-(s->y2))
  18. *
  19. ((s->z3)-(s->z1))
  20. +
  21. ((float)((s->z2)-(s->z1)))
  22. *
  23. ((s->y3)-(s->y1)))
  24. +
  25. ((float)((s->y0)-(s->y1)))
  26. *
  27. ((s->x2)-(s->x1))
  28. *
  29. ((s->z3)-(s->z1))
  30. -
  31. ((float)((s->x3)-(s->x1)))
  32. *
  33. ((float)((s->z2)-(s->z1)))
  34. )
  35. /
  36. (
  37. ((float)((s->x2)-(s->x1)))
  38. *
  39. ((s->y3)-(s->y1))
  40. -
  41. ((float)((s->x3)-(s->x1)))
  42. *
  43. ((s->y2)-(s->y1))
  44. ))
  45. +
  46. (s->z1)
  47. ;
  48. //return (s->z0);
  49.  
  50. }
  51.  
  52. int main(void) {
  53. // your code goes here
  54.  
  55. Treug_t asdf;
  56.  
  57. asdf.x1=1000;
  58. asdf.y1=4000;
  59. asdf.z1=0;
  60.  
  61. asdf.x2=4000;
  62. asdf.y2=1000;
  63. asdf.z2=1000;
  64.  
  65. asdf.x3=4000;
  66. asdf.y3=4000;
  67. asdf.z3=0;
  68.  
  69. for(int y=0;y<5000;y=y+250)
  70. {
  71. for(int x=0;x<5000;x=x+250)
  72. {
  73. asdf.x0=x;
  74. asdf.y0=y;
  75.  
  76. printf(" %04d", ReshUrPlsk(&asdf));
  77.  
  78. }
  79. printf("\n\r");
  80. }
  81.  
  82.  
  83.  
  84. return 0;
  85. }
  86.  
  87.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000