My Project
ShapeRay.h
1 #pragma once
2 
3 namespace ParaEngine
4 {
5  class Plane;
6  class CShapeBox;
7  class CShapeAABB;
11  class CShapeRay
12  {
13  public:
14  CShapeRay();
15  ~CShapeRay();
16  CShapeRay(const Vector3& orig, const Vector3& dir) : mOrig(orig), mDir(dir) {}
18  CShapeRay(const CShapeRay& ray) : mOrig(ray.mOrig), mDir(ray.mDir) {}
19 
20  float SquareDistance(const Vector3& point, float* t=NULL) const;
21  float Distance(const Vector3& point, float* t=NULL) const;
22 
30  std::pair<bool, float> intersects(const CShapeAABB& box, const Matrix4* world=NULL) const;
31 
39  int IntersectPlane(const Plane * plane, Vector3 * point, float *distance) const;
40 
45  int IntersectBox(const CShapeBox * box, Vector3* point, float *distance) const;
46 
51  };
52 
53 }
different physics engine has different winding order.
Definition: EventBinding.h:32
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
CShapeRay(const CShapeRay &ray)
Copy constructor.
Definition: ShapeRay.h:18
AABB-related code.
Definition: ShapeAABB.h:11
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
Vector3 mDir
Normalized direction.
Definition: ShapeRay.h:50
Defines a plane in 3D space.
Definition: ParaPlane.h:23
int IntersectPlane(const Plane *plane, Vector3 *point, float *distance) const
Definition: ShapeRay.cpp:189
int IntersectBox(const CShapeBox *box, Vector3 *point, float *distance) const
Definition: ShapeRay.cpp:216
Vector3 mOrig
Ray origin.
Definition: ShapeRay.h:48
std::pair< bool, float > intersects(const CShapeAABB &box, const Matrix4 *world=NULL) const
Tests whether this ray intersects the given box.
Definition: ShapeRay.cpp:50
A ray is a half-line P(t) = mOrig + mDir * t, with 0 <= t <= +infinity.
Definition: ShapeRay.h:11
a min max box.
Definition: ShapeAABB.h:190