PolyVector3.cpp 587 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * PolyVector3.cpp
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 3/14/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. #include "PolyVector3.h"
  10. using namespace Polycode;
  11. Vector3::Vector3() : x(0),y(0),z(0){
  12. }
  13. void Vector3::set(Number x, Number y, Number z) {
  14. this->x = x;
  15. this->y = y;
  16. this->z = z;
  17. }
  18. Vector3::Vector3(Number x,Number y,Number z) {
  19. set(x,y,z);
  20. }
  21. void Vector3::Normalize() {
  22. Number tL = sqrtf( x * x + y * y + z * z );
  23. if(tL > 1e-08 ) {
  24. Number invTl = 1.0 / tL;
  25. x *= invTl;
  26. y *= invTl;
  27. z *= invTl;
  28. }
  29. }
  30. Vector3::~Vector3() {
  31. }