PageRenderTime 52ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/php/value/runme.php

#
PHP | 43 lines | 33 code | 10 blank | 0 comment | 0 complexity | 51dad22be79272e667525d5ea492c0b5 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. <?php
  2. require "example.php";
  3. $v = new_vector();
  4. vector_x_set($v,1.0);
  5. vector_y_set($v,2.0);
  6. vector_z_set($v,3.0);
  7. $w = new_vector();
  8. vector_x_set($w,10.0);
  9. vector_y_set($w,11.0);
  10. vector_z_set($w,12.0);
  11. echo "I just created the following vector\n";
  12. vector_print($v);
  13. vector_print($w);
  14. echo "\nNow I'm going to compute the dot product\n";
  15. $d = dot_product($v, $w);
  16. echo "dot product = $d (should be 68)\n";
  17. echo "\nNow I'm going to add the vectors together\n";
  18. $r = new_vector();
  19. vector_add($v, $w, $r);
  20. vector_print($r);
  21. echo "The value should be (11,13,15)\n";
  22. echo "\nNow I'm going to clean up the return result\n";
  23. # free($r);
  24. echo "Good\n";
  25. ?>