Sphere.js 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @author bhouston / http://exocortex.com
  3. */
  4. var x = 2;
  5. var y = 3;
  6. var z = 4;
  7. var w = 5;
  8. var zero = new THREE.Vector3();
  9. var one = new THREE.Vector3( 1, 1, 1 );
  10. module( "Sphere" );
  11. test( "constructor", function() {
  12. var a = new THREE.Sphere();
  13. ok( a.center.equals( zero ), "Passed!" );
  14. ok( a.radius == 0, "Passed!" );
  15. a = new THREE.Sphere( one, 1 );
  16. ok( a.center.equals( one ), "Passed!" );
  17. ok( a.radius == 0, "Passed!" );
  18. });
  19. test( "copy", function() {
  20. var a = new THREE.Sphere( one, 1 );
  21. var b = new THREE.Sphere().copy( a );
  22. ok( b.center.equals( one ), "Passed!" );
  23. ok( b.radius == 0, "Passed!" );
  24. // ensure that it is a true copy
  25. a.center = zero;
  26. a.radius = 0;
  27. ok( b.center.equals( one ), "Passed!" );
  28. ok( b.radius == 0, "Passed!" );
  29. });
  30. test( "set", function() {
  31. var a = new THREE.Vector3();
  32. ok( a.center.equals( zero ), "Passed!" );
  33. ok( a.radius == 0, "Passed!" );
  34. a.set( one, radius )
  35. ok( a.center.equals( one ), "Passed!" );
  36. ok( a.radius == 0, "Passed!" );
  37. });