diff options
author | dan miller | 2007-10-19 05:20:07 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 05:20:07 +0000 |
commit | fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd (patch) | |
tree | 51bcae7a1b8381a6bf6fd8025a7de1e30fe0045d /libraries/ode-0.9/OPCODE/Ice/IceRay.h | |
parent | resubmitting ode (diff) | |
download | opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.zip opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.gz opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.bz2 opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.xz |
dont ask
Diffstat (limited to '')
-rw-r--r-- | libraries/ode-0.9/OPCODE/Ice/IceRay.h | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/libraries/ode-0.9/OPCODE/Ice/IceRay.h b/libraries/ode-0.9/OPCODE/Ice/IceRay.h deleted file mode 100644 index 0268287..0000000 --- a/libraries/ode-0.9/OPCODE/Ice/IceRay.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
2 | /** | ||
3 | * Contains code for rays. | ||
4 | * \file IceRay.h | ||
5 | * \author Pierre Terdiman | ||
6 | * \date April, 4, 2000 | ||
7 | */ | ||
8 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
9 | |||
10 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
11 | // Include Guard | ||
12 | #ifndef __ICERAY_H__ | ||
13 | #define __ICERAY_H__ | ||
14 | |||
15 | class ICEMATHS_API Ray | ||
16 | { | ||
17 | public: | ||
18 | //! Constructor | ||
19 | inline_ Ray() {} | ||
20 | //! Constructor | ||
21 | inline_ Ray(const Point& orig, const Point& dir) : mOrig(orig), mDir(dir) {} | ||
22 | //! Copy constructor | ||
23 | inline_ Ray(const Ray& ray) : mOrig(ray.mOrig), mDir(ray.mDir) {} | ||
24 | //! Destructor | ||
25 | inline_ ~Ray() {} | ||
26 | |||
27 | float SquareDistance(const Point& point, float* t=null) const; | ||
28 | inline_ float Distance(const Point& point, float* t=null) const { return sqrtf(SquareDistance(point, t)); } | ||
29 | |||
30 | Point mOrig; //!< Ray origin | ||
31 | Point mDir; //!< Normalized direction | ||
32 | }; | ||
33 | |||
34 | inline_ void ComputeReflexionVector(Point& reflected, const Point& incoming_dir, const Point& outward_normal) | ||
35 | { | ||
36 | reflected = incoming_dir - outward_normal * 2.0f * (incoming_dir|outward_normal); | ||
37 | } | ||
38 | |||
39 | inline_ void ComputeReflexionVector(Point& reflected, const Point& source, const Point& impact, const Point& normal) | ||
40 | { | ||
41 | Point V = impact - source; | ||
42 | reflected = V - normal * 2.0f * (V|normal); | ||
43 | } | ||
44 | |||
45 | inline_ void DecomposeVector(Point& normal_compo, Point& tangent_compo, const Point& outward_dir, const Point& outward_normal) | ||
46 | { | ||
47 | normal_compo = outward_normal * (outward_dir|outward_normal); | ||
48 | tangent_compo = outward_dir - normal_compo; | ||
49 | } | ||
50 | |||
51 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
52 | /** | ||
53 | * Transforms a direction vector from world space to local space | ||
54 | * \param local_dir [out] direction vector in local space | ||
55 | * \param world_dir [in] direction vector in world space | ||
56 | * \param world [in] world transform | ||
57 | */ | ||
58 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
59 | inline_ void ComputeLocalDirection(Point& local_dir, const Point& world_dir, const Matrix4x4& world) | ||
60 | { | ||
61 | // Get world direction back in local space | ||
62 | // Matrix3x3 InvWorld = world; | ||
63 | // local_dir = InvWorld * world_dir; | ||
64 | local_dir = Matrix3x3(world) * world_dir; | ||
65 | } | ||
66 | |||
67 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
68 | /** | ||
69 | * Transforms a position vector from world space to local space | ||
70 | * \param local_pt [out] position vector in local space | ||
71 | * \param world_pt [in] position vector in world space | ||
72 | * \param world [in] world transform | ||
73 | */ | ||
74 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
75 | inline_ void ComputeLocalPoint(Point& local_pt, const Point& world_pt, const Matrix4x4& world) | ||
76 | { | ||
77 | // Get world vertex back in local space | ||
78 | Matrix4x4 InvWorld = world; | ||
79 | InvWorld.Invert(); | ||
80 | local_pt = world_pt * InvWorld; | ||
81 | } | ||
82 | |||
83 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
84 | /** | ||
85 | * Transforms a ray from world space to local space | ||
86 | * \param local_ray [out] ray in local space | ||
87 | * \param world_ray [in] ray in world space | ||
88 | * \param world [in] world transform | ||
89 | */ | ||
90 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
91 | inline_ void ComputeLocalRay(Ray& local_ray, const Ray& world_ray, const Matrix4x4& world) | ||
92 | { | ||
93 | // Get world ray back in local space | ||
94 | ComputeLocalDirection(local_ray.mDir, world_ray.mDir, world); | ||
95 | ComputeLocalPoint(local_ray.mOrig, world_ray.mOrig, world); | ||
96 | } | ||
97 | |||
98 | #endif // __ICERAY_H__ | ||