Nebula
Loading...
Searching...
No Matches
im3d_math.h
Go to the documentation of this file.
1#pragma once
2
3// im3d_math.h is optional - include only if you want to use the Im3d math types directly
4
5#include "im3d.h"
6
7#include <cmath>
8
9namespace Im3d {
10
11// Vec2
12inline Vec2 operator+(const Vec2& _lhs, const Vec2& _rhs) { return Vec2(_lhs.x + _rhs.x, _lhs.y + _rhs.y); }
13inline Vec2 operator-(const Vec2& _lhs, const Vec2& _rhs) { return Vec2(_lhs.x - _rhs.x, _lhs.y - _rhs.y); }
14inline Vec2 operator*(const Vec2& _lhs, const Vec2& _rhs) { return Vec2(_lhs.x * _rhs.x, _lhs.y * _rhs.y); }
15inline Vec2 operator/(const Vec2& _lhs, const Vec2& _rhs) { return Vec2(_lhs.x / _rhs.x, _lhs.y / _rhs.y); }
16inline Vec2 operator*(const Vec2& _lhs, float _rhs) { return Vec2(_lhs.x * _rhs, _lhs.y * _rhs); }
17inline Vec2 operator/(const Vec2& _lhs, float _rhs) { return Vec2(_lhs.x / _rhs, _lhs.y / _rhs); }
18inline Vec2 operator-(const Vec2& _v) { return Vec2(-_v.x, -_v.y); }
19inline float Dot(const Vec2& _lhs, const Vec2& _rhs) { return _lhs.x * _rhs.x + _lhs.y * _rhs.y; }
20inline float Length(const Vec2& _v) { return sqrtf(Dot(_v, _v)); }
21inline float Length2(const Vec2& _v) { return Dot(_v, _v); }
22inline Vec2 Abs(const Vec2& _v) { return Vec2(fabs(_v.x), fabs(_v.y)); }
23inline Vec2 Normalize(const Vec2& _v) { return _v / Length(_v); }
24
25// Vec3
26inline Vec3 operator+(const Vec3& _lhs, const Vec3& _rhs) { return Vec3(_lhs.x + _rhs.x, _lhs.y + _rhs.y, _lhs.z + _rhs.z); }
27inline Vec3 operator-(const Vec3& _lhs, const Vec3& _rhs) { return Vec3(_lhs.x - _rhs.x, _lhs.y - _rhs.y, _lhs.z - _rhs.z); }
28inline Vec3 operator*(const Vec3& _lhs, const Vec3& _rhs) { return Vec3(_lhs.x * _rhs.x, _lhs.y * _rhs.y, _lhs.z * _rhs.z); }
29inline Vec3 operator/(const Vec3& _lhs, const Vec3& _rhs) { return Vec3(_lhs.x / _rhs.x, _lhs.y / _rhs.y, _lhs.z / _rhs.z); }
30inline Vec3 operator*(const Vec3& _lhs, float _rhs) { return Vec3(_lhs.x * _rhs, _lhs.y * _rhs, _lhs.z * _rhs); }
31inline Vec3 operator/(const Vec3& _lhs, float _rhs) { return Vec3(_lhs.x / _rhs, _lhs.y / _rhs, _lhs.z / _rhs); }
32inline Vec3 operator-(const Vec3& _v) { return Vec3(-_v.x, -_v.y, -_v.z); }
33inline float Dot(const Vec3& _lhs, const Vec3& _rhs) { return _lhs.x * _rhs.x + _lhs.y * _rhs.y + _lhs.z * _rhs.z; }
34inline float Length(const Vec3& _v) { return sqrtf(Dot(_v, _v)); }
35inline float Length2(const Vec3& _v) { return Dot(_v, _v); }
36inline Vec3 Abs(const Vec3& _v) { return Vec3(fabs(_v.x), fabs(_v.y), fabs(_v.z)); }
37inline Vec3 Normalize(const Vec3& _v) { return _v / Length(_v); }
38inline Vec3 Cross(const Vec3& _a, const Vec3& _b)
39{
40 return Vec3(
41 _a.y * _b.z - _b.y * _a.z,
42 _a.z * _b.x - _b.z * _a.x,
43 _a.x * _b.y - _b.x * _a.y
44 );
45}
46
47// Vec4
48inline Vec4 operator+(const Vec4& _lhs, const Vec4& _rhs) { return Vec4(_lhs.x + _rhs.x, _lhs.y + _rhs.y, _lhs.z + _rhs.z, _lhs.w + _rhs.w); }
49inline Vec4 operator-(const Vec4& _lhs, const Vec4& _rhs) { return Vec4(_lhs.x - _rhs.x, _lhs.y - _rhs.y, _lhs.z - _rhs.z, _lhs.w - _rhs.w); }
50inline Vec4 operator*(const Vec4& _lhs, const Vec4& _rhs) { return Vec4(_lhs.x * _rhs.x, _lhs.y * _rhs.y, _lhs.z * _rhs.z, _lhs.w * _rhs.w); }
51inline Vec4 operator/(const Vec4& _lhs, const Vec4& _rhs) { return Vec4(_lhs.x / _rhs.x, _lhs.y / _rhs.y, _lhs.z / _rhs.z, _lhs.w / _rhs.w); }
52inline Vec4 operator*(const Vec4& _lhs, float _rhs) { return Vec4(_lhs.x * _rhs, _lhs.y * _rhs, _lhs.z * _rhs, _lhs.w * _rhs); }
53inline Vec4 operator/(const Vec4& _lhs, float _rhs) { return Vec4(_lhs.x / _rhs, _lhs.y / _rhs, _lhs.z / _rhs, _lhs.w / _rhs); }
54inline Vec4 operator-(const Vec4& _v) { return Vec4(-_v.x, -_v.y, -_v.z, -_v.w); }
55inline float Dot(const Vec4& _lhs, const Vec4& _rhs) { return _lhs.x * _rhs.x + _lhs.y * _rhs.y + _lhs.z * _rhs.z + _lhs.w * _rhs.w; }
56inline float Length(const Vec4& _v) { return sqrtf(Dot(_v, _v)); }
57inline float Length2(const Vec4& _v) { return Dot(_v, _v); }
58inline Vec4 Abs(const Vec4& _v) { return Vec4(fabs(_v.x), fabs(_v.y), fabs(_v.z), fabs(_v.w)); }
59inline Vec4 Normalize(const Vec4& _v) { return _v / Length(_v); }
60
61// Mat3
62inline Mat3 operator*(const Mat3& _lhs, const Mat3& _rhs)
63{
64 Mat3 ret;
65 ret(0, 0) = _lhs(0, 0) * _rhs(0, 0) + _lhs(0, 1) * _rhs(1, 0) + _lhs(0, 2) * _rhs(2, 0);
66 ret(0, 1) = _lhs(0, 0) * _rhs(0, 1) + _lhs(0, 1) * _rhs(1, 1) + _lhs(0, 2) * _rhs(2, 1);
67 ret(0, 2) = _lhs(0, 0) * _rhs(0, 2) + _lhs(0, 1) * _rhs(1, 2) + _lhs(0, 2) * _rhs(2, 2);
68 ret(1, 0) = _lhs(1, 0) * _rhs(0, 0) + _lhs(1, 1) * _rhs(1, 0) + _lhs(1, 2) * _rhs(2, 0);
69 ret(1, 1) = _lhs(1, 0) * _rhs(0, 1) + _lhs(1, 1) * _rhs(1, 1) + _lhs(1, 2) * _rhs(2, 1);
70 ret(1, 2) = _lhs(1, 0) * _rhs(0, 2) + _lhs(1, 1) * _rhs(1, 2) + _lhs(1, 2) * _rhs(2, 2);
71 ret(2, 0) = _lhs(2, 0) * _rhs(0, 0) + _lhs(2, 1) * _rhs(1, 0) + _lhs(2, 2) * _rhs(2, 0);
72 ret(2, 1) = _lhs(2, 0) * _rhs(0, 1) + _lhs(2, 1) * _rhs(1, 1) + _lhs(2, 2) * _rhs(2, 1);
73 ret(2, 2) = _lhs(2, 0) * _rhs(0, 2) + _lhs(2, 1) * _rhs(1, 2) + _lhs(2, 2) * _rhs(2, 2);
74
75 return ret;
76}
77inline Vec3 operator*(const Mat3& _m, const Vec3& _v)
78{
79 return Vec3(
80 _m(0, 0) * _v.x + _m(0, 1) * _v.y + _m(0, 2) * _v.z,
81 _m(1, 0) * _v.x + _m(1, 1) * _v.y + _m(1, 2) * _v.z,
82 _m(2, 0) * _v.x + _m(2, 1) * _v.y + _m(2, 2) * _v.z
83 );
84}
85inline Vec4 operator*(const Mat3& _m, const Vec4& _v)
86{
87 return Vec4(
88 _m(0, 0) * _v.x + _m(0, 1) * _v.y + _m(0, 2) * _v.z,
89 _m(1, 0) * _v.x + _m(1, 1) * _v.y + _m(1, 2) * _v.z,
90 _m(2, 0) * _v.x + _m(2, 1) * _v.y + _m(2, 2) * _v.z,
91 _v.w
92 );
93}
94Mat3 Transpose(const Mat3& _m);
95Vec3 ToEulerXYZ(const Mat3& _m);
96Mat3 FromEulerXYZ(Vec3& _xyz);
97Mat3 Rotation(const Vec3& _axis, float _rads); // _axis must be unit length
98Mat3 Scale(const Vec3& _s);
99
100// Mat4
101inline Mat4 operator*(const Mat4& _lhs, const Mat4& _rhs)
102{
103 Mat4 ret;
104 ret(0, 0) = _lhs(0, 0) * _rhs(0, 0) + _lhs(0, 1) * _rhs(1, 0) + _lhs(0, 2) * _rhs(2, 0) + _lhs(0, 3) * _rhs(3, 0);
105 ret(0, 1) = _lhs(0, 0) * _rhs(0, 1) + _lhs(0, 1) * _rhs(1, 1) + _lhs(0, 2) * _rhs(2, 1) + _lhs(0, 3) * _rhs(3, 1);
106 ret(0, 2) = _lhs(0, 0) * _rhs(0, 2) + _lhs(0, 1) * _rhs(1, 2) + _lhs(0, 2) * _rhs(2, 2) + _lhs(0, 3) * _rhs(3, 2);
107 ret(0, 3) = _lhs(0, 0) * _rhs(0, 3) + _lhs(0, 1) * _rhs(1, 3) + _lhs(0, 2) * _rhs(2, 3) + _lhs(0, 3) * _rhs(3, 3);
108 ret(1, 0) = _lhs(1, 0) * _rhs(0, 0) + _lhs(1, 1) * _rhs(1, 0) + _lhs(1, 2) * _rhs(2, 0) + _lhs(1, 3) * _rhs(3, 0);
109 ret(1, 1) = _lhs(1, 0) * _rhs(0, 1) + _lhs(1, 1) * _rhs(1, 1) + _lhs(1, 2) * _rhs(2, 1) + _lhs(1, 3) * _rhs(3, 1);
110 ret(1, 2) = _lhs(1, 0) * _rhs(0, 2) + _lhs(1, 1) * _rhs(1, 2) + _lhs(1, 2) * _rhs(2, 2) + _lhs(1, 3) * _rhs(3, 2);
111 ret(1, 3) = _lhs(1, 0) * _rhs(0, 3) + _lhs(1, 1) * _rhs(1, 3) + _lhs(1, 2) * _rhs(2, 3) + _lhs(1, 3) * _rhs(3, 3);
112 ret(2, 0) = _lhs(2, 0) * _rhs(0, 0) + _lhs(2, 1) * _rhs(1, 0) + _lhs(2, 2) * _rhs(2, 0) + _lhs(2, 3) * _rhs(3, 0);
113 ret(2, 1) = _lhs(2, 0) * _rhs(0, 1) + _lhs(2, 1) * _rhs(1, 1) + _lhs(2, 2) * _rhs(2, 1) + _lhs(2, 3) * _rhs(3, 1);
114 ret(2, 2) = _lhs(2, 0) * _rhs(0, 2) + _lhs(2, 1) * _rhs(1, 2) + _lhs(2, 2) * _rhs(2, 2) + _lhs(2, 3) * _rhs(3, 2);
115 ret(2, 3) = _lhs(2, 0) * _rhs(0, 3) + _lhs(2, 1) * _rhs(1, 3) + _lhs(2, 2) * _rhs(2, 3) + _lhs(2, 3) * _rhs(3, 3);
116 ret(3, 0) = _lhs(3, 0) * _rhs(0, 0) + _lhs(3, 1) * _rhs(1, 0) + _lhs(3, 2) * _rhs(2, 0) + _lhs(3, 3) * _rhs(3, 0);
117 ret(3, 1) = _lhs(3, 0) * _rhs(0, 1) + _lhs(3, 1) * _rhs(1, 1) + _lhs(3, 2) * _rhs(2, 1) + _lhs(3, 3) * _rhs(3, 1);
118 ret(3, 2) = _lhs(3, 0) * _rhs(0, 2) + _lhs(3, 1) * _rhs(1, 2) + _lhs(3, 2) * _rhs(2, 2) + _lhs(3, 3) * _rhs(3, 2);
119 ret(3, 3) = _lhs(3, 0) * _rhs(0, 3) + _lhs(3, 1) * _rhs(1, 3) + _lhs(3, 2) * _rhs(2, 3) + _lhs(3, 3) * _rhs(3, 3);
120
121 return ret;
122}
123inline Vec3 operator*(const Mat4& _m, const Vec3& _pos)
124{
125 return Vec3(
126 _m(0, 0) * _pos.x + _m(0, 1) * _pos.y + _m(0, 2) * _pos.z + _m(0, 3),
127 _m(1, 0) * _pos.x + _m(1, 1) * _pos.y + _m(1, 2) * _pos.z + _m(1, 3),
128 _m(2, 0) * _pos.x + _m(2, 1) * _pos.y + _m(2, 2) * _pos.z + _m(2, 3)
129 );
130}
131inline Vec4 operator*(const Mat4& _m, const Vec4& _v)
132{
133 return Vec4(
134 _m(0, 0) * _v.x + _m(0, 1) * _v.y + _m(0, 2) * _v.z + _m(0, 3) * _v.w,
135 _m(1, 0) * _v.x + _m(1, 1) * _v.y + _m(1, 2) * _v.z + _m(1, 3) * _v.w,
136 _m(2, 0) * _v.x + _m(2, 1) * _v.y + _m(2, 2) * _v.z + _m(2, 3) * _v.w,
137 _m(3, 0) * _v.x + _m(3, 1) * _v.y + _m(3, 2) * _v.z + _m(3, 3) * _v.w
138 );
139}
140Mat4 Inverse(const Mat4& _m);
141Mat4 Transpose(const Mat4& _m);
142Mat4 Translation(const Vec3& _t);
143Mat4 AlignZ(const Vec3& _axis, const Vec3& _up = Vec3(0.0f, 1.0f, 0.0f)); // generate an orthonormal bases with +z as _axis, which must be unit length
144Mat4 LookAt(const Vec3& _from, const Vec3& _to, const Vec3& _up = Vec3(0.0f, 1.0f, 0.0f)); // align _z with (_to - _from), set _from as translation
145
146struct Line
147{
149 Vec3 m_direction; // unit length
150
151 Line() {}
152 Line(const Vec3& _origin, const Vec3& _direction);
153};
154struct Ray
155{
157 Vec3 m_direction; // unit length
158
159 Ray() {}
160 Ray(const Vec3& _origin, const Vec3& _direction);
161};
163{
166
168 LineSegment(const Vec3& _start, const Vec3& _end);
169};
170struct Sphere
171{
173 float m_radius;
174
176 Sphere(const Vec3& _origin, float _radius);
177};
178struct Plane
179{
181 float m_offset;
182
183 Plane() {}
184 Plane(const Vec3& _normal, float _offset);
185 Plane(const Vec3& _normal, const Vec3& _origin);
186};
188{
191 float m_radius;
192
194 Capsule(const Vec3& _start, const Vec3& _end, float _radius);
195};
196
197
198// Ray-primitive intersections. Use Intersects() when you don't need t.
199bool Intersects(const Ray& _ray, const Plane& _plane );
200bool Intersect (const Ray& _ray, const Plane& _plane, float& t0_ );
201bool Intersects(const Ray& _ray, const Sphere& _sphere );
202bool Intersect (const Ray& _ray, const Sphere& _sphere, float& t0_, float& t1_);
203bool Intersects(const Ray& _ray, const Capsule& _capsule );
204bool Intersect (const Ray& _ray, const Capsule& _capsule, float& t0_, float& t1_);
205
206// Find point t0_ along _line0 nearest to _line1 and t1_ along _line1 nearest to _line0.
207void Nearest(const Line& _line0, const Line& _line1, float& t0_, float& t1_);
208// Find point tr_ along _ray nearest to _line and tl_ along _line nearest to _ray.
209void Nearest(const Ray& _ray, const Line& _line, float& tr_, float& tl_);
210// Find point tr_ along _ray nearest to _segment, return point on segment nearest to _ray.
211Vec3 Nearest(const Ray& _ray, const LineSegment& _segment, float& tr_);
212
213float Distance2(const Ray& _ray, const LineSegment& _segment);
214
215inline float Distance(const Vec4& _plane, const Vec3& _point){ return _plane.x * _point.x + _plane.y * _point.y + _plane.z * _point.z - _plane.w; }
216
217constexpr float Pi = 3.14159265359f;
218constexpr float TwoPi = 2.0f * Pi;
219constexpr float HalfPi = 0.5f * Pi;
220
221inline float Radians(float _degrees) { return _degrees * (Pi / 180.0f); }
222inline float Degrees(float _radians) { return _radians * (180.0f / Pi); }
223
224namespace internal {
225
226struct ScalarT {};
227 struct FloatT: public ScalarT {};
228 struct IntT: public ScalarT {};
229struct CompositeT {};
230 struct VecT: public CompositeT {};
231 struct MatT: public CompositeT {};
232template <typename T>
233struct TypeTraits { typedef typename T::Type Type; enum { kSize = T::kSize }; };
234 template<> struct TypeTraits<int> { typedef IntT Type; enum { kSize = 1 }; };
235 template<> struct TypeTraits<float> { typedef FloatT Type; enum { kSize = 1 }; };
236 template<> struct TypeTraits<Vec2> { typedef VecT Type; enum { kSize = 2 }; };
237 template<> struct TypeTraits<Vec3> { typedef VecT Type; enum { kSize = 3 }; };
238 template<> struct TypeTraits<Vec4> { typedef VecT Type; enum { kSize = 4 }; };
239 template<> struct TypeTraits<Mat4> { typedef MatT Type; enum { kSize = 16 }; };
240
241template <typename T>
242inline bool _AllLess(const T& _a, const T& _b, ScalarT)
243{
244 return _a < _b;
245}
246template <typename T>
247inline bool _AllLess(const T& _a, const T& _b, CompositeT)
248{
249 for (int i = 0, n = TypeTraits<T>::kSize; i < n; ++i)
250 {
251 if (_a[i] > _b[i])
252 {
253 return false;
254 }
255 }
256 return true;
257}
258
259template <typename T>
260inline T _Max(const T& _a, const T& _b, ScalarT)
261{
262 return _a < _b ? _b : _a;
263}
264template <typename T>
265inline T _Max(const T& _a, const T& _b, CompositeT)
266{
267 T ret;
268 for (int i = 0, n = TypeTraits<T>::kSize; i < n; ++i) {
269 ret[i] = _Max(_a[i], _b[i], ScalarT());
270 }
271 return ret;
272}
273
274template <typename T>
275inline T _Min(const T& _a, const T& _b, ScalarT)
276{
277 return _a < _b ? _a : _b;
278}
279template <typename T>
280inline T _Min(const T& _a, const T& _b, CompositeT)
281{
282 T ret;
283 for (int i = 0, n = TypeTraits<T>::kSize; i < n; ++i)
284 {
285 ret[i] = _Min(_a[i], _b[i], ScalarT());
286 }
287 return ret;
288}
289
290} // namespace internal
291
292
293template <typename T>
294inline bool AllLess(const T& _a, const T& _b) { return internal::_AllLess(_a, _b, typename internal::TypeTraits<T>::Type()); }
295
296template <typename T>
297inline T Max(T _a, T _b) { return internal::_Max(_a, _b, typename internal::TypeTraits<T>::Type()); }
298template <typename T>
299inline T Min(T _a, T _b) { return internal::_Min(_a, _b, typename internal::TypeTraits<T>::Type()); }
300template <typename T>
301inline T Clamp(T _a, T _min, T _max) { return Max(Min(_a, _max), _min); }
302
303// Remap _x in [_start,_end] to [0,1].
304inline float Remap(float _x, float _start, float _end) { return Clamp(_x * (1.0f / (_end - _start)) + (-_start / (_end - _start)), 0.0f, 1.0f); }
305
306} // namespace Im3d
T _Max(const T &_a, const T &_b, ScalarT)
Definition im3d_math.h:260
bool _AllLess(const T &_a, const T &_b, ScalarT)
Definition im3d_math.h:242
T _Min(const T &_a, const T &_b, ScalarT)
Definition im3d_math.h:275
Definition im3d.h:22
float Dot(const Vec2 &_lhs, const Vec2 &_rhs)
Definition im3d_math.h:19
Vec2 operator+(const Vec2 &_lhs, const Vec2 &_rhs)
Definition im3d_math.h:12
Mat4 Inverse(const Mat4 &_m)
Definition im3d.cpp:3006
Vec2 Normalize(const Vec2 &_v)
Definition im3d_math.h:23
bool AllLess(const T &_a, const T &_b)
Definition im3d_math.h:294
T Max(T _a, T _b)
Definition im3d_math.h:297
bool Intersect(const Ray &_ray, const Plane &_plane, float &t0_)
Definition im3d.cpp:3128
Mat4 AlignZ(const Vec3 &_axis, const Vec3 &_up=Vec3(0.0f, 1.0f, 0.0f))
Definition im3d.cpp:3052
float Degrees(float _radians)
Definition im3d_math.h:222
constexpr float HalfPi
Definition im3d_math.h:219
Vec3 ToEulerXYZ(const Mat3 &_m)
Definition im3d.cpp:2833
Vec2 Abs(const Vec2 &_v)
Definition im3d_math.h:22
float Distance2(const Ray &_ray, const LineSegment &_segment)
Definition im3d.cpp:3264
float Remap(float _x, float _start, float _end)
Definition im3d_math.h:304
bool Intersects(const Ray &_ray, const Plane &_plane)
Definition im3d.cpp:3123
Mat3 FromEulerXYZ(Vec3 &_xyz)
Definition im3d.cpp:2860
T Clamp(T _a, T _min, T _max)
Definition im3d_math.h:301
float Radians(float _degrees)
Definition im3d_math.h:221
T Min(T _a, T _b)
Definition im3d_math.h:299
Vec2 operator-(const Vec2 &_lhs, const Vec2 &_rhs)
Definition im3d_math.h:13
constexpr float Pi
Definition im3d_math.h:217
float Distance(const Vec4 &_plane, const Vec3 &_point)
Definition im3d_math.h:215
float Length(const Vec2 &_v)
Definition im3d_math.h:20
Mat3 Transpose(const Mat3 &_m)
Definition im3d.cpp:2874
Vec2 operator/(const Vec2 &_lhs, const Vec2 &_rhs)
Definition im3d_math.h:15
constexpr float TwoPi
Definition im3d_math.h:218
Mat3 Rotation(const Vec3 &_axis, float _rads)
Definition im3d.cpp:2882
Mat4 Translation(const Vec3 &_t)
Definition im3d.cpp:3043
Vec3 Cross(const Vec3 &_a, const Vec3 &_b)
Definition im3d_math.h:38
float Length2(const Vec2 &_v)
Definition im3d_math.h:21
void Nearest(const Line &_line0, const Line &_line1, float &t0_, float &t1_)
Definition im3d.cpp:3179
Mat4 LookAt(const Vec3 &_from, const Vec3 &_to, const Vec3 &_up=Vec3(0.0f, 1.0f, 0.0f))
Definition im3d.cpp:3078
Vec2 operator*(const Vec2 &_lhs, const Vec2 &_rhs)
Definition im3d_math.h:14
IM3D_API void Scale(float _x, float _y, float _z)
Definition im3d.cpp:137
Definition im3d_math.h:188
Vec3 m_start
Definition im3d_math.h:189
float m_radius
Definition im3d_math.h:191
Vec3 m_end
Definition im3d_math.h:190
Capsule()
Definition im3d_math.h:193
Definition im3d_math.h:147
Vec3 m_origin
Definition im3d_math.h:148
Line()
Definition im3d_math.h:151
Vec3 m_direction
Definition im3d_math.h:149
Definition im3d_math.h:163
Vec3 m_end
Definition im3d_math.h:165
Vec3 m_start
Definition im3d_math.h:164
LineSegment()
Definition im3d_math.h:167
Definition im3d.h:256
Definition im3d.h:305
Definition im3d_math.h:179
float m_offset
Definition im3d_math.h:181
Vec3 m_normal
Definition im3d_math.h:180
Plane()
Definition im3d_math.h:183
Definition im3d_math.h:155
Vec3 m_origin
Definition im3d_math.h:156
Vec3 m_direction
Definition im3d_math.h:157
Ray()
Definition im3d_math.h:159
Definition im3d_math.h:171
Sphere()
Definition im3d_math.h:175
Vec3 m_origin
Definition im3d_math.h:172
float m_radius
Definition im3d_math.h:173
Definition im3d.h:204
float y
Definition im3d.h:205
float x
Definition im3d.h:205
Definition im3d.h:220
float y
Definition im3d.h:221
float x
Definition im3d.h:221
float z
Definition im3d.h:221
Definition im3d.h:238
float z
Definition im3d.h:239
float y
Definition im3d.h:239
float x
Definition im3d.h:239
float w
Definition im3d.h:239
Definition im3d_math.h:229
Definition im3d_math.h:227
Definition im3d_math.h:228
Definition im3d_math.h:231
Definition im3d_math.h:226
Definition im3d_math.h:233
T::Type Type
Definition im3d_math.h:233
@ kSize
Definition im3d_math.h:233
Definition im3d_math.h:230