Advertisement
purxiz

collision.h

May 9th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #pragma once
  2. # include <sig/gs_vec.h>
  3.  
  4. class collision {
  5. private:
  6. GsVec position, pos_top;
  7. float radius;
  8. bool type;
  9. public:
  10. collision(GsVec pos, float r) : position(pos), radius(r) { type = true; }
  11. collision(GsVec bot, GsVec top) : position(bot), pos_top(top) { type = false; }
  12.  
  13. bool contains(GsVec pnt, float r) {
  14. if(type) return (distmax(pnt, position) < radius + r);
  15. else {
  16. return (pnt.x > position.x && pnt.y > position.y && pnt.z > position.z && pnt.x < pos_top.x && pnt.y < pos_top.y && pnt.z < pos_top.z);
  17. }
  18. }
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement