kick
|
00001 // 00002 // ray.h 00003 // KickCPP 00004 // 00005 // Created by Morten Nobel-Jørgensen on 18/12/13. 00006 // Copyright (c) 2013 Morten Nobel-Joergensen. All rights reserved. 00007 // 00008 00009 #pragma once 00010 00011 #include "glm/glm.hpp" 00012 00013 namespace kick { 00014 class Ray { 00015 public: 00016 Ray(); 00017 Ray(glm::vec3 origin, glm::vec3 direction); 00018 00019 bool closestPoints(Ray otherRay, glm::vec3& outPoint1, glm::vec3& outPoint2) const; 00020 glm::vec3 closestPoint(glm::vec3 point) const; 00021 bool intersectTriangle(glm::vec3 v0, glm::vec3 v1, glm::vec3 v2, glm::vec3 &intersectionPoint, bool clampBackIntersections = true) const; 00022 glm::vec3 const &origin() const; 00023 void setOrigin(glm::vec3 const &origin); 00024 glm::vec3 const &direction() const; 00025 void setDirection(glm::vec3 const &direction); 00026 00027 glm::vec3 point(float offset) const; 00028 private: 00029 glm::vec3 mOrigin; 00030 glm::vec3 mDirection; 00031 }; 00032 }