Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. $ffi = FFI::load(__DIR__ . '/astro.h');
  3.  
  4. $dayNr = (time() - 946598400) / 86400.0;
  5. echo $dayNr, "\n";
  6.  
  7. $L = FFI::new('double');
  8. $M = FFI::new('double');
  9. $ra= FFI::new('double');
  10. $decl= FFI::new('double');
  11. $rad = FFI::new('double');
  12. $ffi->sunpos($dayNr, FFI::addr($L), FFI::addr($M), FFI::addr($ra), FFI::addr($decl), FFI::addr($rad));
  13.  
  14. $sidtime = FFI::new('double');
  15. $ha = FFI::new('double');
  16. $ffi->sidtime_and_ha($L->cdata, ($dayNr - floor($dayNr)) * 24, 0, $ra->cdata, FFI::addr($sidtime), FFI::addr($ha));
  17.  
  18. $azimuth = FFI::new('double');
  19. $altitude = FFI::new('double');
  20. $ffi->sunaltazimuth($L->cdata, 52, $ha->cdata, $decl->cdata, FFI::addr($azimuth), FFI::addr($altitude));
  21.  
  22. var_dump($altitude);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement