Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. f=fopen(filename, "r");
  2.  
  3. min_x=min_y=min_z=FLT_MAX;
  4.  
  5. max_x=max_y=max_z=-FLT_MAX;
  6.  
  7. while(!feof(f)){
  8. fread(&x, sizeof(x), 1, f);
  9. fread(&y, sizeof(y), 1, f);
  10. fread(&z, sizeof(z), 1, f);
  11. fread(&l_type, sizeof(l_type), 1, f);
  12.  
  13. if(x<min_x){
  14. min_x=x;
  15. }else if(x>max_x){
  16. max_x=x;
  17. }
  18.  
  19. if(y<min_y){
  20. min_y=y;
  21. }else if(y>max_y){
  22. max_y=y;
  23. }
  24.  
  25. if(z<min_z){
  26. min_z=z;
  27. }else if(z>max_z){
  28. max_z=z;
  29. }
  30. }
  31.  
  32. fclose(f);
  33.  
  34. *a_min_x=min_x;
  35. *a_max_x=max_x;
  36. *a_min_y=min_y;
  37. *a_max_y=max_y;
  38. *a_min_z=min_z;
  39. *a_max_z=max_z;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement