Matrix3DStack.cpp 483 B

1234567891011121314151617181920212223242526272829303132
  1. #include "client/math/Matrix3DStack.h"
  2. #include "client/math/StackOverflow.h"
  3. #include "client/math/StackUnderflow.h"
  4. Matrix3DStack::Matrix3DStack()
  5. {
  6. }
  7. void Matrix3DStack::pop()
  8. {
  9. if(index <= 0)
  10. {
  11. throw StackUnderflow();
  12. }
  13. index--;
  14. }
  15. void Matrix3DStack::push()
  16. {
  17. if(index >= STACK_SIZE - 1)
  18. {
  19. throw StackOverflow();
  20. }
  21. index++;
  22. stack[index].set(stack[index - 1]);
  23. }
  24. Matrix3D& Matrix3DStack::get()
  25. {
  26. return stack[index];
  27. }