NW4F Sys
Loading...
Searching...
No Matches
math_Vector4.h
Go to the documentation of this file.
1#ifndef NW_MATH_VECTOR4_H_
2#define NW_MATH_VECTOR4_H_
3
4#include <cstring>
5#include <nw/math/math_Config.h>
6
7namespace nw { namespace math {
8
9struct VEC4;
10
11namespace internal { namespace standard {
12
13 VEC4* VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2);
14 VEC4* VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2);
15 VEC4* VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale);
16 VEC4* VEC4Lerp(VEC4* pOut, const VEC4* p1, const VEC4* p2, f32 t);
17 f32 VEC4Dot(const VEC4* p1, const VEC4* p2);
18 f32 VEC4LenSq(const VEC4* p);
19 f32 VEC4DistSq(const VEC4* p1, const VEC4* p2);
20 VEC4* VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
21 VEC4* VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
22
23} } // namespace internal::standard
24
25#if defined(NW_MATH_ENABLE_INTRINSICS)
26
27namespace internal { namespace intrinsics {
28
29 VEC4* VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2);
30 VEC4* VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2);
31 VEC4* VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale);
32 VEC4* VEC4Lerp(VEC4* pOut, const VEC4* p1, const VEC4* p2, f32 t);
33 f32 VEC4Dot(const VEC4* p1, const VEC4* p2);
34 f32 VEC4LenSq(const VEC4* p);
35 f32 VEC4DistSq(const VEC4* p1, const VEC4* p2);
36 VEC4* VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
37 VEC4* VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
38
39} } // namespace internal::intrinsics
40
41#endif // NW_MATH_ENABLE_INTRINSICS
42
45NW_MATH_INLINE VEC4* VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2);
46NW_MATH_INLINE VEC4* VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2);
47NW_MATH_INLINE VEC4* VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale);
48NW_MATH_INLINE VEC4* VEC4Lerp(VEC4* pOut, const VEC4* p1, const VEC4* p2, f32 t);
49NW_MATH_INLINE f32 VEC4Dot(const VEC4* p1, const VEC4* p2);
52/* NW_MATH_INLINE */ extern VEC4* VEC4Normalize(VEC4* pOut, const VEC4* p);
53/* NW_MATH_INLINE */ extern VEC4* VEC4FastNormalize(VEC4* pOut, const VEC4* p);
54/* NW_MATH_INLINE */ extern VEC4* VEC4SafeNormalize(VEC4* pOut, const VEC4* p, const VEC4& alt);
55/* NW_MATH_INLINE */ extern VEC4* VEC4FastSafeNormalize(VEC4* pOut, const VEC4* p, const VEC4& alt);
56NW_MATH_INLINE f32 VEC4DistSq(const VEC4* p1, const VEC4* p2);
57NW_MATH_INLINE VEC4* VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
58NW_MATH_INLINE VEC4* VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2);
59
60struct VEC4_
61{
66};
67
68struct VEC4 : public VEC4_
69{
70public:
71 static const int DIMENSION = 4;
72
73 static const VEC4& Zero()
74 {
75 static const VEC4 zero(0.0f, 0.0f, 0.0f, 0.0f);
76
77 return zero;
78 }
79
80 static const VEC4& ZeroWOne()
81 {
82 static const VEC4 zero(0.0f, 0.0f, 0.0f, 1.0f);
83
84 return zero;
85 }
86
87 typedef VEC4 self_type;
88 typedef f32 value_type;
89public:
90 VEC4() {}
91 explicit VEC4(const f32* p) { x = p[0]; y = p[1]; z = p[2]; w = p[3]; }
92 explicit VEC4(const VEC4_& v) { x = v.x; y = v.y; z = v.z; w = v.w; }
93 VEC4(f32 fx, f32 fy, f32 fz, f32 fw) { x = fx; y = fy; z = fz; w = fw; }
94 explicit VEC4(const VEC3& v) { x = v.x; y = v.y; z = v.z; w = 0.0f; }
95
96 operator f32*() { return &x; }
97 operator const f32*() const { return &x; }
98
99 f32* ToF32() { return &x; }
100 const f32* ToF32() const { return &x; }
101
102 template <typename ToPtr>
104 {
105 return reinterpret_cast<ToPtr>( this );
106 }
107
108 template <typename ToPtr>
109 ToPtr Cast() const
110 {
111 return reinterpret_cast<ToPtr>( this );
112 }
113
114 self_type& operator += (const self_type& rhs) { (void)VEC4Add(this, this, &rhs); return *this; }
115 self_type& operator -= (const self_type& rhs) { (void)VEC4Sub(this, this, &rhs); return *this; }
116 self_type& operator *= (f32 f) { (void)VEC4Scale(this, this, f); return *this; }
117 self_type& operator /= (f32 f) { (void)VEC4Scale(this, this, 1/f); return *this; }
118
119 self_type operator + () const { return *this; }
120 self_type operator - () const { return self_type(-x, -y, -z, -w); }
121
122 self_type operator + (const self_type& rhs) const { VEC4 tmp; (void)VEC4Add(&tmp, this, &rhs); return tmp; }
123 self_type operator - (const self_type& rhs) const { VEC4 tmp; (void)VEC4Sub(&tmp, this, &rhs); return tmp; }
124 self_type operator * (f32 f) const { VEC4 tmp; (void)VEC4Scale(&tmp, this, f); return tmp; }
125 self_type operator / (f32 f) const { f32 r = 1.f / f; return operator*(r); }
126
127 self_type& Lerp(const VEC4& lhs, const VEC4& rhs, f32 t)
128 {
129 return *VEC4Lerp(this, &lhs, &rhs, t);
130 }
131
132 f32 Dot(const VEC4& vec) const
133 {
134 return VEC4Dot(this, &vec);
135 }
136
137 f32 LengthSquare() const { return VEC4LenSq(this); }
138 f32 Length() const { return VEC4Len(this); }
139
141 {
142 return *VEC4Normalize(this, this);
143 }
144
146 {
147 return *VEC4Normalize(this, &src);
148 }
149
151 {
152 return *VEC4SafeNormalize(this, this, alt);
153 }
154
156 {
157 return *VEC4SafeNormalize(this, &src, alt);
158 }
159
161 {
162 return VEC4DistSq(this, &vec);
163 }
164
166 {
167 return *VEC4Maximize(this, &lhs, &rhs);
168 }
169
171 {
172 return *VEC4Minimize(this, &lhs, &rhs);
173 }
174
176 self_type& Transform(const MTX34& pM) { return this->SetTransform(pM, *this); }
177
178 NW_MATH_INLINE self_type& SetTransform(const MTX44& pM, const VEC4& src);
179 self_type& Transform(const MTX44& pM) { return this->SetTransform(pM, *this); }
180
181 void Set(f32 fx, f32 fy, f32 fz, f32 fw) { x = fx; y = fy; z = fz; w = fw; }
182
183#pragma clang diagnostic push
184#pragma clang diagnostic ignored "-Wfloat-equal"
185
186 bool operator == (const self_type& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; }
187 bool operator != (const self_type& rhs) const { return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w; }
188
189#pragma clang diagnostic pop
190
191 bool IsZero() const { return VEC4IsZero(this); }
192 bool IsZeroWOne() const { return VEC4IsZeroWOne(this); }
193};
194
195typedef struct VEC4 Vector4;
196
197inline VEC4
198operator * (f32 f, const VEC4& rhs) { VEC4 tmp; (void)VEC4Scale(&tmp, &rhs, f); return tmp; }
199
200} } // namespace nw::math
201
202#if defined(NW_MATH_AS_INLINE)
203
204namespace nw { namespace math {
205
206namespace internal { namespace standard {
207
209VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2)
210{
211 pOut->x = p1->x + p2->x;
212 pOut->y = p1->y + p2->y;
213 pOut->z = p1->z + p2->z;
214 pOut->w = p1->w + p2->w;
215
216 return pOut;
217}
218
220VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2)
221{
222 pOut->x = p1->x - p2->x;
223 pOut->y = p1->y - p2->y;
224 pOut->z = p1->z - p2->z;
225 pOut->w = p1->w - p2->w;
226
227 return pOut;
228}
229
231VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale)
232{
233 pOut->x = scale * p->x;
234 pOut->y = scale * p->y;
235 pOut->z = scale * p->z;
236 pOut->w = scale * p->w;
237
238 return pOut;
239}
240
242VEC4Lerp(VEC4* pOut, const VEC4* __restrict p1, const VEC4* __restrict p2, f32 t)
243{
244 // (1-t)*p1 + t*p2
245 pOut->x = p1->x + t * (p2->x - p1->x);
246 pOut->y = p1->y + t * (p2->y - p1->y);
247 pOut->z = p1->z + t * (p2->z - p1->z);
248 pOut->w = p1->w + t * (p2->w - p1->w);
249
250 return pOut;
251}
252
254VEC4Dot(const VEC4* p1, const VEC4* p2)
255{
256 return p1->x * p2->x + p1->y * p2->y + p1->z * p2->z + p1->w * p2->w;
257}
258
260VEC4LenSq(const VEC4* __restrict p)
261{
262 return p->x * p->x + p->y * p->y + p->z * p->z + p->w * p->w;
263}
264
266VEC4DistSq(const VEC4* p1, const VEC4* p2)
267{
268 VEC4 tmp;
269 return standard::VEC4LenSq(standard::VEC4Sub(&tmp, p1, p2));
270}
271
273VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
274{
275 pOut->x = (p1->x > p2->x) ? p1->x : p2->x;
276 pOut->y = (p1->y > p2->y) ? p1->y : p2->y;
277 pOut->z = (p1->z > p2->z) ? p1->z : p2->z;
278 pOut->w = (p1->w > p2->w) ? p1->w : p2->w;
279
280 return pOut;
281}
282
284VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
285{
286 pOut->x = (p1->x < p2->x) ? p1->x : p2->x;
287 pOut->y = (p1->y < p2->y) ? p1->y : p2->y;
288 pOut->z = (p1->z < p2->z) ? p1->z : p2->z;
289 pOut->w = (p1->w < p2->w) ? p1->w : p2->w;
290
291 return pOut;
292}
293
294} } // namespace internal::standard
295
296#if defined(NW_MATH_ENABLE_INTRINSICS)
297
298namespace internal { namespace intrinsics {
299
301VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2)
302{
305
306 return pOut;
307}
308
310VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2)
311{
314
315 return pOut;
316}
317
319VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale)
320{
323
324 tof32x2(pOut->x) = xy;
325 tof32x2(pOut->z) = zw;
326
327 return pOut;
328}
329
331VEC4Lerp(VEC4* pOut, const VEC4* __restrict p1, const VEC4* __restrict p2, f32 t)
332{
333 // (1-t)*p1 + t*p2
334
335 f32x2 tt = __PS_FDUP(t);
336
337 f32x2 f0 = tof32x2(p1->x);
338 f0 = __PS_NMSUB(f0, tt, f0);
339 f0 = __PS_MADD(tof32x2(p2->x), tt, f0);
340
341 f32x2 f1 = tof32x2(p1->z);
342 f1 = __PS_NMSUB(f1, tt, f1);
343 f1 = __PS_MADD(tof32x2(p2->z), tt, f1);
344
345 tof32x2(pOut->x) = f0;
346 tof32x2(pOut->z) = f1;
347
348 return pOut;
349}
350
352VEC4Dot(const VEC4* p1, const VEC4* p2)
353{
354 f32x2 f0;
355 f0 = __PS_MUL(tof32x2(p1->x), tof32x2(p2->x));
356 f0 = __PS_MADD(tof32x2(p1->z), tof32x2(p2->z), f0);
357 f0 = __PS_SUM0(f0, f0, f0);
358
359 return f0[0];
360}
361
363VEC4LenSq(const VEC4* __restrict p)
364{
365 f32x2 f0, f1;
366 f1 = tof32x2(p->x);
367 f0 = __PS_MUL(f1, f1);
368 f1 = tof32x2(p->z);
369 f0 = __PS_MADD(f1, f1, f0);
370 f0 = __PS_SUM0(f0, f0, f0);
371
372 return f0[0];
373}
374
376VEC4DistSq(const VEC4* p1, const VEC4* p2)
377{
378 f32x2 f0, f1;
379 f1 = __PS_SUB(tof32x2(p1->x), tof32x2(p2->x));
380 f0 = __PS_MUL(f1, f1);
381 f1 = __PS_SUB(tof32x2(p1->z), tof32x2(p2->z));
382 f0 = __PS_MADD(f1, f1, f0);
383 f0 = __PS_SUM0(f0, f0, f0);
384
385 return f0[0];
386}
387
389VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
390{
391 f32x2 f0, f1;
392
393 f0 = tof32x2(p1->x);
394 f1 = tof32x2(p2->x);
396
397 f0 = tof32x2(p1->z);
398 f1 = tof32x2(p2->z);
400
401 return pOut;
402}
403
405VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
406{
407 f32x2 f0, f1;
408
409 f0 = tof32x2(p1->x);
410 f1 = tof32x2(p2->x);
412
413 f0 = tof32x2(p1->z);
414 f1 = tof32x2(p2->z);
416
417 return pOut;
418}
419
420} } // namespace internal::intrinsics
421
422#endif // NW_MATH_ENABLE_INTRINSICS
423
425VEC4IsZero(const VEC4* p)
426{
427 return p->x == 0.f && p->y == 0.f && p->z == 0.f && p->w == 0.f;
428}
429
431VEC4IsZeroWOne(const VEC4* p)
432{
433 return p->x == 0.f && p->y == 0.f && p->z == 0.f && p->w == 1.f;
434}
435
437VEC4Add(VEC4* pOut, const VEC4* p1, const VEC4* p2)
438{
439 return NW_MATH_IMPL_NS::VEC4Add(pOut, p1, p2);
440}
441
443VEC4Sub(VEC4* pOut, const VEC4* p1, const VEC4* p2)
444{
445 return NW_MATH_IMPL_NS::VEC4Sub(pOut, p1, p2);
446}
447
449VEC4Scale(VEC4* pOut, const VEC4* p, f32 scale)
450{
451 return NW_MATH_IMPL_NS::VEC4Scale(pOut, p, scale);
452}
453
455VEC4Lerp(VEC4* pOut, const VEC4* __restrict p1, const VEC4* __restrict p2, f32 t)
456{
457 return NW_MATH_IMPL_NS::VEC4Lerp(pOut, p1, p2, t);
458}
459
461VEC4Dot(const VEC4* p1, const VEC4* p2)
462{
463 return NW_MATH_IMPL_NS::VEC4Dot(p1, p2);
464}
465
467VEC4LenSq(const VEC4* __restrict p)
468{
469 return NW_MATH_IMPL_NS::VEC4LenSq(p);
470}
471
472f32 VEC4Len(const VEC4* p)
473{
474 return FSqrt(VEC4LenSq(p));
475
476}
477
478// NW_MATH_INLINE VEC4*
479// VEC4Normalize(VEC4* pOut, const VEC4* p)
480// {
481// (void)VEC4Scale(pOut, p, FrSqrt(VEC4LenSq(p)));
482//
483// return pOut;
484// }
485
486// NW_MATH_INLINE VEC4*
487// VEC4FastNormalize(VEC4* pOut, const VEC4* p)
488// {
489// (void)VEC4Scale(pOut, p, FrFastSqrt(VEC4LenSq(p)));
490//
491// return pOut;
492// }
493
494// NW_MATH_INLINE VEC4*
495// VEC4SafeNormalize(VEC4* pOut, const VEC4* p, const VEC4& alt)
496// {
497// f32 mag = VEC4LenSq(p);
498//
499// if (mag == 0 /* || mag == F_INF || isnan(mag) */)
500// {
501// *pOut = alt;
502//
503// return pOut;
504// }
505//
506// (void)VEC4Scale(pOut, p, FrSqrt(mag));
507//
508// return pOut;
509// }
510
511// NW_MATH_INLINE VEC4*
512// VEC4FastSafeNormalize(VEC4* pOut, const VEC4* p, const VEC4& alt)
513// {
514// f32 mag = VEC4LenSq(p);
515//
516// if (mag == 0 /* || mag == F_INF || isnan(mag) */)
517// {
518// *pOut = alt;
519//
520// return pOut;
521// }
522//
523// (void)VEC4Scale(pOut, p, FrFastSqrt(mag));
524//
525// return pOut;
526// }
527
529VEC4DistSq(const VEC4* p1, const VEC4* p2)
530{
531 return NW_MATH_IMPL_NS::VEC4DistSq(p1, p2);
532}
533
535VEC4Maximize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
536{
537 return NW_MATH_IMPL_NS::VEC4Maximize(pOut, p1, p2);
538}
539
541VEC4Minimize(VEC4* pOut, const VEC4* p1, const VEC4* p2)
542{
543 return NW_MATH_IMPL_NS::VEC4Minimize(pOut, p1, p2);
544}
545
546} } // namespace nw::math
547
548#endif
549
550namespace nw { namespace math {
551
552inline bool VEC4IsZero(const VEC4& v){ return VEC4IsZero( &v ); }
553inline bool VEC4IsZeroWOne(const VEC4& v){ return VEC4IsZeroWOne( &v ); }
554inline VEC4* VEC4Add(VEC4* pOut, const VEC4& v1, const VEC4& v2) { return VEC4Add( pOut, &v1, &v2 ); }
555inline VEC4* VEC4Sub(VEC4* pOut, const VEC4& v1, const VEC4& v2) { return VEC4Sub( pOut, &v1, &v2 ); }
556inline VEC4* VEC4Scale(VEC4* pOut, const VEC4& v, f32 scale) { return VEC4Scale( pOut, &v, scale); }
557inline VEC4* VEC4Lerp(VEC4* pOut, const VEC4& v1, const VEC4& v2, f32 t) { return VEC4Lerp( pOut, &v1, &v2, t ); }
558inline f32 VEC4Dot(const VEC4& v1, const VEC4& v2) { return VEC4Dot( &v1, &v2 ); }
559inline f32 VEC4LenSq(const VEC4& v) { return VEC4LenSq( &v ); }
560inline f32 VEC4Len(const VEC4& v) { return VEC4Len( &v ); }
561inline VEC4* VEC4Normalize(VEC4* pOut, const VEC4& v) { return VEC4Normalize( pOut, &v ); }
562inline VEC4* VEC4FastNormalize(VEC4* pOut, const VEC4& v) { return VEC4FastNormalize( pOut, &v ); }
563inline VEC4* VEC4SafeNormalize(VEC4* pOut, const VEC4& v, const VEC4& alt) { return VEC4SafeNormalize( pOut, &v, alt ); }
564inline VEC4* VEC4FastSafeNormalize(VEC4* pOut, const VEC4& v, const VEC4& alt) { return VEC4FastSafeNormalize( pOut, &v, alt ); }
565inline f32 VEC4DistSq(const VEC4& v1, const VEC4& v2) { return VEC4DistSq( &v1, &v2 ); }
566inline VEC4* VEC4Maximize(VEC4* pOut, const VEC4& v1, const VEC4& v2) { return VEC4Maximize( pOut, &v1, &v2 ); }
567inline VEC4* VEC4Minimize(VEC4* pOut, const VEC4& v1, const VEC4& v2) { return VEC4Minimize( pOut, &v1, &v2 ); }
568
569} } // namespace nw::math
570
571#endif
#define NW_MATH_AS_INLINE
Definition math_Config.h:6
#define NW_MATH_INLINE
Definition math_Config.h:7
#define NW_MATH_IMPL_NS
Definition math_Config.h:14
Definition math_Matrix34.h:11
f32 VEC4LenSq(const VEC4 *p)
VEC4 * VEC4Scale(VEC4 *pOut, const VEC4 *p, f32 scale)
f32 VEC4Dot(const VEC4 *p1, const VEC4 *p2)
f32 VEC4DistSq(const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4Minimize(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4Add(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4Sub(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4Lerp(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2, f32 t)
VEC4 * VEC4Maximize(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
Definition math_Triangular.cpp:3
Definition math_Constant.cpp:5
f32 VEC4Len(const VEC4 &v)
Definition math_Vector4.h:560
VEC4 * VEC4Minimize(VEC4 *pOut, const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:567
f32 VEC4LenSq(const VEC4 &v)
Definition math_Vector4.h:559
NW_MATH_INLINE f32 VEC4DistSq(const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4FastSafeNormalize(VEC4 *pOut, const VEC4 &v, const VEC4 &alt)
Definition math_Vector4.h:564
VEC4 * VEC4Add(VEC4 *pOut, const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:554
VEC4 * VEC4Sub(VEC4 *pOut, const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:555
VEC4 * VEC4Scale(VEC4 *pOut, const VEC4 &v, f32 scale)
Definition math_Vector4.h:556
VEC4 operator*(f32 f, const VEC4 &rhs)
Definition math_Vector4.h:198
NW_MATH_INLINE f32 VEC4Dot(const VEC4 *p1, const VEC4 *p2)
NW_MATH_INLINE VEC4 * VEC4Sub(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
bool VEC4IsZero(const VEC4 &v)
Definition math_Vector4.h:552
f32 VEC4DistSq(const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:565
VEC4 * VEC4Lerp(VEC4 *pOut, const VEC4 &v1, const VEC4 &v2, f32 t)
Definition math_Vector4.h:557
VEC4 * VEC4Normalize(VEC4 *pOut, const VEC4 &v)
Definition math_Vector4.h:561
VEC4 * VEC4Maximize(VEC4 *pOut, const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:566
VEC4 * VEC4SafeNormalize(VEC4 *pOut, const VEC4 &v, const VEC4 &alt)
Definition math_Vector4.h:563
VEC4 * VEC4SafeNormalize(VEC4 *pOut, const VEC4 *p, const VEC4 &alt)
NW_MATH_INLINE VEC4 * VEC4Add(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
VEC4 * VEC4Normalize(VEC4 *pOut, const VEC4 *p)
VEC4 * VEC4FastNormalize(VEC4 *pOut, const VEC4 &v)
Definition math_Vector4.h:562
bool VEC4IsZeroWOne(const VEC4 &v)
Definition math_Vector4.h:553
NW_MATH_INLINE VEC4 * VEC4Lerp(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2, f32 t)
struct VEC4 Vector4
Definition math_Vector4.h:195
NW_MATH_INLINE bool VEC4IsZero(const VEC4 *p)
VEC4 * VEC4FastSafeNormalize(VEC4 *pOut, const VEC4 *p, const VEC4 &alt)
VEC4 * VEC4FastNormalize(VEC4 *pOut, const VEC4 *p)
f32 VEC4Dot(const VEC4 &v1, const VEC4 &v2)
Definition math_Vector4.h:558
NW_MATH_INLINE bool VEC4IsZeroWOne(const VEC4 *p)
NW_MATH_INLINE VEC4 * VEC4Scale(VEC4 *pOut, const VEC4 *p, f32 scale)
NW_MATH_INLINE f32 VEC4Len(const VEC4 *p)
NW_MATH_INLINE VEC4 * VEC4Minimize(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
NW_MATH_INLINE f32 VEC4LenSq(const VEC4 *p)
NW_MATH_INLINE VEC4 * VEC4Maximize(VEC4 *pOut, const VEC4 *p1, const VEC4 *p2)
Definition math_Constant.cpp:5
Definition math_Vector4.h:61
f32 w
Definition math_Vector4.h:65
f32 y
Definition math_Vector4.h:63
f32 z
Definition math_Vector4.h:64
f32 x
Definition math_Vector4.h:62
Definition math_Vector4.h:69
bool operator!=(const self_type &rhs) const
Definition math_Vector4.h:187
static const VEC4 & Zero()
Definition math_Vector4.h:73
VEC4(const f32 *p)
Definition math_Vector4.h:91
bool operator==(const self_type &rhs) const
Definition math_Vector4.h:186
NW_MATH_INLINE self_type & SetTransform(const MTX44 &pM, const VEC4 &src)
Definition math_Transform.h:150
bool IsZeroWOne() const
Definition math_Vector4.h:192
VEC4(const VEC3 &v)
Definition math_Vector4.h:94
VEC4 self_type
Definition math_Vector4.h:87
self_type & Transform(const MTX34 &pM)
Definition math_Vector4.h:176
VEC4()
Definition math_Vector4.h:90
static const VEC4 & ZeroWOne()
Definition math_Vector4.h:80
f32 value_type
Definition math_Vector4.h:88
void Set(f32 fx, f32 fy, f32 fz, f32 fw)
Definition math_Vector4.h:181
bool IsZero() const
Definition math_Vector4.h:191
VEC4(const VEC4_ &v)
Definition math_Vector4.h:92
VEC4(f32 fx, f32 fy, f32 fz, f32 fw)
Definition math_Vector4.h:93
static const int DIMENSION
Definition math_Vector4.h:71