API Documentation
Loading...
Searching...
No Matches
VectorFunctions.hpp
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: VectorFunctions
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Vector.h>
34#include <cmath>
35/**--------------------------------------------------------------------------------------------------
36Namespace: Parke
37Namespace that wraps all Logic created by Tyler Parke
38 *-----------------------------------------------------------------------------------------------**/
39namespace NDEVR
40{
41 /**--------------------------------------------------------------------------------------------------
42 Class: VectorFunctions
43 Dummy class to ensure creation of an include file
44 *-----------------------------------------------------------------------------------------------**/
46 {};
47 /**--------------------------------------------------------------------------------------------------
48 Fn: constexpr Vector<t_dims, t_type> operator+(const Vector<t_dims, t_type>& vec_a,
49 const Vector<t_dims, t_type>& vec_b)
50
51 \brief Addition operator.
52
53 Author: Tyler Parke
54
55 Date: 2017-11-13
56
57 Parameters:
58 vec_a - The first value.
59 vec_b - A value to add to it.
60
61 Returns: The result of the operation.
62 *-----------------------------------------------------------------------------------------------**/
63 template<class t_vector_type, uint01 t_dims, class t_type>
64 constexpr typename std::enable_if<std::is_base_of<Vector<t_dims, t_type>, t_vector_type>::value, t_vector_type>::type
65 operator+(const t_vector_type& vec_a, const Vector<t_dims, t_type>& vec_b)
66 {
67 t_vector_type sum;
68 for (uint01 dim = 0; dim < t_dims; ++dim)
69 sum[dim] = vec_a[dim] + vec_b[dim];
70 return sum;
71 }
72
73 /**--------------------------------------------------------------------------------------------------
74 Fn: constexpr Vector<t_dims, t_type> operator+(const t_type& scaler_a,
75 const Vector<t_dims, t_type>& vec_b)
76
77 Addition operator.
78
79 Author: Tyler Parke
80
81 Date: 2017-11-13
82
83 Parameters:
84 scaler_a - The first value.
85 vec_b - A value to add to it.
86
87 Returns: The result of the operation.
88 *-----------------------------------------------------------------------------------------------**/
89 template<uint01 t_dims, class t_type>
90 constexpr Vector<t_dims, t_type> operator+(const t_type& scaler_a, const Vector<t_dims, t_type>& vec_b)
91 {
93 for (uint01 dim = 0; dim < t_dims; ++dim)
94 sum[dim] = scaler_a + vec_b[dim];
95 return sum;
96 }
97
98 /**--------------------------------------------------------------------------------------------------
99 Fn: constexpr Vector<t_dims, t_type> operator+(const Vector<t_dims, t_type>& vec_a,
100 const t_type& scaler_b)
101
102 Addition operator.
103
104 Author: Tyler Parke
105
106 Date: 2017-11-13
107
108 Parameters:
109 vec_a - The first value.
110 scaler_b - A value to add to it.
111
112 Returns: The result of the operation.
113 *-----------------------------------------------------------------------------------------------**/
114 template<class t_vector_type, class t_type>
115 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
116 operator+(const t_vector_type& vec_a, const t_type& scaler_b)
117 {
118 t_vector_type sum;
119 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
120 sum[dim] = vec_a[dim] + scaler_b;
121 return sum;
122 }
123 template<class t_vector_type, class t_type>
124 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
125 operator+(const t_type& scaler_a, const t_vector_type& vec_b)
126 {
127 t_vector_type sum;
128 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
129 sum[dim] = scaler_a + vec_b[dim];
130 return sum;
131 }
132
133 /**--------------------------------------------------------------------------------------------------
134 Fn: constexpr Vector<t_dims, t_type>& operator+=(Vector<t_dims, t_type>& vec_a,
135 const Vector<t_dims, t_type>& vec_b)
136
137 Addition assignment operator.
138
139 Author: Tyler Parke
140
141 Date: 2017-11-13
142
143 Parameters:
144 vec_a - [in,out] The vector a.
145 vec_b - The vector b.
146
147 Returns: The result of the operation.
148 *-----------------------------------------------------------------------------------------------**/
149 template<uint01 t_dims, class t_type>
151 {
152 for (uint01 dim = 0; dim < t_dims; ++dim)
153 vec_a[dim] += vec_b[dim];
154 return vec_a;
155 }
156
157 /**--------------------------------------------------------------------------------------------------
158 Fn: constexpr Vector<t_dims, t_type>& operator+=(Vector<t_dims, t_type>& vec_a,
159 const t_type& scaler_b)
160
161 Addition assignment operator.
162
163 Author: Tyler Parke
164
165 Date: 2017-11-13
166
167 Parameters:
168 vec_a - [in,out] The vector a.
169 scaler_b - The scaler b.
170
171 Returns: The result of the operation.
172 *-----------------------------------------------------------------------------------------------**/
173 template<uint01 t_dims, class t_type>
174 constexpr Vector<t_dims, t_type>& operator+=(Vector<t_dims, t_type>& vec_a, t_type scaler_b)
175 {
176 for (uint01 dim = 0; dim < t_dims; ++dim)
177 vec_a[dim] += scaler_b;
178 return vec_a;
179 }
180
181 /**--------------------------------------------------------------------------------------------------
182 Fn: constexpr Vector<t_dims, t_type> operator-(const Vector<t_dims, t_type>& vec_a,
183 const Vector<t_dims, t_type>& vec_b)
184
185 Subtraction operator.
186
187 Author: Tyler Parke
188
189 Date: 2017-11-13
190
191 Parameters:
192 vec_a - The first value.
193 vec_b - A value to subtract from it.
194
195 Returns: The result of the operation.
196 *-----------------------------------------------------------------------------------------------**/
197 template<class t_vector_type, uint01 t_dims, class t_type>
198 constexpr typename std::enable_if<std::is_base_of<Vector<t_dims, t_type>, t_vector_type>::value, t_vector_type>::type
199 operator-(const t_vector_type& vec_a, const Vector<t_dims, t_type>& vec_b)
200 {
201 t_vector_type difference;
202 for (uint01 dim = 0; dim < t_dims; ++dim)
203 difference[dim] = vec_a[dim] - vec_b[dim];
204 return difference;
205 }
206
207 /**--------------------------------------------------------------------------------------------------
208 Fn: constexpr Vector<t_dims, t_type> operator-(const t_type& value_a,
209 const Vector<t_dims, t_type>& vec_b)
210
211 Subtraction operator.
212
213 Author: Tyler Parke
214
215 Date: 2017-11-13
216
217 Parameters:
218 value_a - The first value.
219 vec_b - A value to subtract from it.
220
221 Returns: The result of the operation.
222 *-----------------------------------------------------------------------------------------------**/
223 template<uint01 t_dims, class t_type>
224 constexpr Vector<t_dims, t_type> operator-(const t_type& value_a, const Vector<t_dims, t_type>& vec_b)
225 {
226 Vector<t_dims, t_type> difference;
227 for (uint01 dim = 0; dim < t_dims; ++dim)
228 difference[dim] = value_a - vec_b[dim];
229 return difference;
230 }
231
232 /**--------------------------------------------------------------------------------------------------
233 Fn: constexpr Vector<t_dims, t_type> operator-(const Vector<t_dims, t_type>& vec_a,
234 const t_type& value_b)
235
236 Subtraction operator.
237
238 Author: Tyler Parke
239
240 Date: 2017-11-13
241
242 Parameters:
243 vec_a - The first value.
244 value_b - A value to subtract from it.
245
246 Returns: The result of the operation.
247 *-----------------------------------------------------------------------------------------------**/
248 template<class t_vector_type, class t_type>
249 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
250 operator-(const t_vector_type& vec_a, const t_type& value_b)
251 {
252 t_vector_type difference;
253 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
254 difference[dim] = vec_a[dim] - value_b;
255 return difference;
256 }
257
258 /**--------------------------------------------------------------------------------------------------
259 Fn: constexpr Vector<t_dims, t_type>& operator-=(Vector<t_dims, t_type>& vec_a,
260 const Vector<t_dims, t_type>& vec_b)
261
262 Subtraction assignment operator.
263
264 Author: Tyler Parke
265
266 Date: 2017-11-13
267
268 Parameters:
269 vec_a - [in,out] The vector a.
270 vec_b - The vector b.
271
272 Returns: The result of the operation.
273 *-----------------------------------------------------------------------------------------------**/
274 template<uint01 t_dims, class t_type>
276 {
277 for (uint01 dim = 0; dim < t_dims; ++dim)
278 vec_a[dim] -= vec_b[dim];
279 return vec_a;
280 }
281
282 /**--------------------------------------------------------------------------------------------------
283 Fn: constexpr Vector<t_dims, t_type> operator-=(Vector<t_dims, t_type>& vec_a,
284 const t_type& value_b)
285
286 Subtraction assignment operator.
287
288 Author: Tyler Parke
289
290 Date: 2017-11-13
291
292 Parameters:
293 vec_a - [in,out] The vector a.
294 value_b - The value b.
295
296 Returns: The result of the operation.
297 *-----------------------------------------------------------------------------------------------**/
298 template<uint01 t_dims, class t_type>
300 {
301 for (uint01 dim = 0; dim < t_dims; ++dim)
302 vec_a[dim] -= value_b;
303 return vec_a;
304 }
305
306 /**--------------------------------------------------------------------------------------------------
307 Fn: constexpr Vector<t_dims, t_type> operator*(const Vector<t_dims, t_type>& vec_a,
308 const Vector<t_dims, t_type>& vec_b)
309
310 Multiplication operator.
311
312 Author: Tyler Parke
313
314 Date: 2017-11-13
315
316 Parameters:
317 vec_a - The first value to multiply.
318 vec_b - The second value to multiply.
319
320 Returns: The result of the operation.
321 *-----------------------------------------------------------------------------------------------**/
322 template<uint01 t_dims, class t_type>
324 {
326 for (uint01 dim = 0; dim < t_dims; ++dim)
327 product[dim] = vec_a[dim] * vec_b[dim];
328 return product;
329 }
330
331 /**--------------------------------------------------------------------------------------------------
332 Fn: constexpr Vector<t_dims, t_type> operator*(const t_type& value_a,
333 const Vector<t_dims, t_type>& vec_b)
334
335 Multiplication operator.
336
337 Author: Tyler Parke
338
339 Date: 2017-11-13
340
341 Parameters:
342 value_a - The first value to multiply.
343 vec_b - The second value to multiply.
344
345 Returns: The result of the operation.
346 *-----------------------------------------------------------------------------------------------**/
347 template<class t_vector_type, class t_type>
348 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
349 operator*(const t_type& value_a, const t_vector_type& vec_b)
350 {
351 t_vector_type product;
352 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
353 product[dim] = value_a * vec_b[dim];
354 return product;
355 }
356
357 /**--------------------------------------------------------------------------------------------------
358 Fn: constexpr Vector<t_dims, t_type> operator*(const Vector<t_dims, t_type>& vec_a,
359 const t_type& value_b)
360
361 Multiplication operator.
362
363 Author: Tyler Parke
364
365 Date: 2017-11-13
366
367 Parameters:
368 vec_a - The first value to multiply.
369 value_b - The second value to multiply.
370
371 Returns: The result of the operation.
372 *-----------------------------------------------------------------------------------------------**/
373 template<class t_vector_type, class t_type>
374 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
375 operator*(const t_vector_type& vec_a, const t_type& value_b)
376 {
377 t_vector_type product;
378 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
379 product[dim] = vec_a[dim] * value_b;
380 return product;
381 }
382
383 /**--------------------------------------------------------------------------------------------------
384 Fn: constexpr Vector<t_dims, t_type>& operator*=(Vector<t_dims, t_type>& vec_a,
385 const Vector<t_dims, t_type>& vec_b)
386
387 Multiplication assignment operator.
388
389 Author: Tyler Parke
390
391 Date: 2017-11-13
392
393 Parameters:
394 vec_a - [in,out] The vector a.
395 vec_b - The vector b.
396
397 Returns: The result of the operation.
398 *-----------------------------------------------------------------------------------------------**/
399 template<uint01 t_dims, class t_type>
401 {
402 for (uint01 dim = 0; dim < t_dims; ++dim)
403 vec_a[dim] *= vec_b[dim];
404 return vec_a;
405 }
406
407 /**--------------------------------------------------------------------------------------------------
408 Fn: constexpr Vector<t_dims, t_type>& operator*=(Vector<t_dims, t_type>& vec_a,
409 const t_type& value_b)
410
411 Multiplication assignment operator.
412
413 Author: Tyler Parke
414
415 Date: 2017-11-13
416
417 Parameters:
418 vec_a - [in,out] The vector a.
419 value_b - The value b.
420
421 Returns: The result of the operation.
422 *-----------------------------------------------------------------------------------------------**/
423 template<uint01 t_dims, class t_type>
425 {
426 for (uint01 dim = 0; dim < t_dims; ++dim)
427 vec_a[dim] *= value_b;
428 return vec_a;
429 }
430
431 /**--------------------------------------------------------------------------------------------------
432 Fn: constexpr Vector<t_dims, t_type> operator/(const Vector<t_dims, t_type>& vec_a,
433 const Vector<t_dims, t_type>& vec_b)
434
435 Division operator.
436
437 Author: Tyler Parke
438
439 Date: 2017-11-13
440
441 Parameters:
442 vec_a - The numerator.
443 vec_b - The denominator.
444
445 Returns: The result of the operation.
446 *-----------------------------------------------------------------------------------------------**/
447 template<uint01 t_dims, class t_type>
449 {
450 Vector<t_dims, t_type> quotient;
451 for (uint01 dim = 0; dim < t_dims; ++dim)
452 quotient[dim] = vec_a[dim] / vec_b[dim];
453 return quotient;
454 }
455
456 /**--------------------------------------------------------------------------------------------------
457 Fn: constexpr Vector<t_dims, t_type> operator/(const t_type& value_a,
458 const Vector<t_dims, t_type>& vec_b)
459
460 Division operator.
461
462 Author: Tyler Parke
463
464 Date: 2017-11-13
465
466 Parameters:
467 value_a - The numerator.
468 vec_b - The denominator.
469
470 Returns: The result of the operation.
471 *-----------------------------------------------------------------------------------------------**/
472 template<class t_vector_type, class t_type>
473 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
474 operator/(const t_type& value_a, const t_vector_type& vec_b)
475 {
476 t_vector_type quotient;
477 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
478 quotient[dim] = value_a / vec_b[dim];
479 return quotient;
480 }
481
482 /**--------------------------------------------------------------------------------------------------
483 Fn: constexpr Vector<t_dims, t_type> operator/(const Vector<t_dims, t_type>& vec_a,
484 const t_type& value_b)
485
486 Division operator.
487
488 Author: Tyler Parke
489
490 Date: 2017-11-13
491
492 Parameters:
493 vec_a - The numerator.
494 value_b - The denominator.
495
496 Returns: The result of the operation.
497 *-----------------------------------------------------------------------------------------------**/
498 template<class t_vector_type, class t_type>
499 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, t_vector_type>::type
500 operator/(const t_vector_type& vec_a, const t_type& value_b)
501 {
502 t_vector_type quotient;
503 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); ++dim)
504 quotient[dim] = vec_a[dim] / value_b;
505 return quotient;
506 }
507
508
509 /**--------------------------------------------------------------------------------------------------
510 Fn: constexpr Vector<t_dims, t_type> operator^(const Vector<t_dims, t_type>& vec_a,
511 const Vector<t_dims, t_type>& vec_b)
512
513 Xor operator.
514
515 Author: Tyler Parke
516
517 Date: 2018-04-10
518
519 Parameters:
520 vec_a - The first value to xor.
521 vec_b - The second value to xor.
522
523 Returns: The result of the operation.
524 *-----------------------------------------------------------------------------------------------**/
525 /*template<uint01 t_dims, class t_type>
526 constexpr Vector<t_dims, t_type> operator^(const Vector<t_dims, t_type>& vec_a, const Vector<t_dims, t_type>& vec_b)
527 {
528 Vector<t_dims, t_type> xor;
529 for (uint01 dim = 0; dim < t_dims; ++dim)
530 xor[dim] = vec_a[dim] ^ vec_b[dim];
531 return xor;
532 }*/
533
534
535 template<uint01 t_dims, class t_type>
537 {
539 for (uint01 dim = 0; dim < t_dims; ++dim)
540 mod [dim] = std::fmod(vec_a[dim], vec_b[dim]);
541 return mod;
542 }
543 template<uint01 t_dims, class t_type>
544 constexpr Vector<t_dims, t_type> operator%(const Vector<t_dims, t_type>& vec_a, const t_type& value_b)
545 {
547 for (uint01 dim = 0; dim < t_dims; ++dim)
548 mod[dim] = cast<t_type>(::fmod(vec_a[dim], value_b));
549 return mod;
550 }
551
552
553 /**--------------------------------------------------------------------------------------------------
554 Fn: constexpr Vector<t_dims, t_type> operator/=(Vector<t_dims, t_type>& vec_a,
555 const Vector<t_dims, t_type>& vec_b)
556
557 Division assignment operator.
558
559 Author: Tyler Parke
560
561 Date: 2017-11-13
562
563 Parameters:
564 vec_a - [in,out] The vector a.
565 vec_b - The vector b.
566
567 Returns: The result of the operation.
568 *-----------------------------------------------------------------------------------------------**/
569 template<uint01 t_dims, class t_type>
571 {
572 for (uint01 dim = 0; dim < t_dims; ++dim)
573 vec_a[dim] = vec_a[dim] / vec_b[dim];
574 return vec_a;
575 }
576
577
578 /**--------------------------------------------------------------------------------------------------
579 Fn: constexpr Vector<t_dims, t_type>& operator/=(Vector<t_dims, t_type>& vec_a,
580 const t_type& value_b)
581
582 Division assignment operator.
583
584 Author: Tyler Parke
585
586 Date: 2017-11-13
587
588 Parameters:
589 vec_a - [in,out] The vector a.
590 value_b - The value b.
591
592 Returns: The result of the operation.
593 *-----------------------------------------------------------------------------------------------**/
594 template<uint01 t_dims, class t_type>
596 {
597 for (uint01 dim = 0; dim < t_dims; ++dim)
598 vec_a[dim] = vec_a[dim] / value_b;
599 return vec_a;
600 }
601
602 template<class t_vector_type, class t_type>
603 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
604 operator==(const t_vector_type& v, const t_type& s)
605 {
606 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
607 {
608 if (v[dim] != s)
609 return false;
610 }
611 return true;
612 }
613 template<class t_vector_type, class t_type>
614 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
615 operator==(const t_type& s, const t_vector_type& v)
616 {
617 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
618 {
619 if (v[dim] != s)
620 return false;
621 }
622 return true;
623 }
624 template<class t_vector_type>
625 constexpr typename std::enable_if<IsVec<t_vector_type>::value, bool>::type
626 operator==(const t_vector_type& v_a, const t_vector_type& v_b)
627 {
628 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
629 {
630 if (v_a[dim] != v_b[dim])
631 return false;
632 }
633 return true;
634 }
635 template<class t_type>
636 constexpr typename std::enable_if<!IsVec<t_type>::value, bool>::type
637 AreSame(const t_type& a, const t_type& b)
638 {
639 return (a == b) || (isNaN(a) && isNaN(b));
640 }
641 template<class t_type>
642 constexpr typename std::enable_if<!IsVec<t_type>::value, bool>::type
643 AreSame(const t_type& a, const t_type& b, const t_type& epsilon)
644 {
645 return (isNaN(a) && isNaN(b))
646 || abs(a - b) < epsilon;
647 }
648 //Equal but with nans
649 template<class t_vector_type>
650 constexpr typename std::enable_if<IsVec<t_vector_type>::value, bool>::type
651 AreSame(const t_vector_type& v_a, const t_vector_type& v_b)
652 {
653 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
654 {
655 if (!AreSame(v_a[dim], v_b[dim]))
656 return false;
657 }
658 return true;
659 }
660 template<class t_vector_type, class t_type>
661 constexpr typename std::enable_if<IsVec<t_vector_type>::value, bool>::type
662 AreSame(const t_vector_type& v_a, const t_vector_type& v_b, const t_type& epsilon)
663 {
664 return (isNaN(v_a) && isNaN(v_b))
665 || abs(v_a - v_b) < epsilon;
666 }
667 template<class t_vector_type>
668 constexpr typename std::enable_if<IsVec<t_vector_type>::value, bool>::type
669 operator!=(const t_vector_type& v_a, const t_vector_type& v_b)
670 {
671 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
672 {
673 if (v_a[dim] != v_b[dim])
674 return true;
675 }
676 return false;
677 }
678 template<class t_vector_type, class t_type>
679 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
680 operator!=(const t_vector_type& v, const t_type& s)
681 {
682 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
683 {
684 if (v[dim] != s)
685 return true;
686 }
687 return false;
688 }
689 template<class t_vector_type, class t_type>
690 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
691 operator!=(const t_type& s, const t_vector_type& v)
692 {
693 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
694 {
695 if (v[dim] != s)
696 return true;
697 }
698 return false;
699 }
700
701 /**--------------------------------------------------------------------------------------------------
702 Fn: constexpr bool operator>=(const Vector<vec_1_size, t_type>& v1,
703 const Vector<vec_2_size, t_type>& v2)
704
705 Greater-than-or-equal comparison operator.
706
707 Author: Tyler Parke
708
709 Date: 2017-11-13
710
711 Parameters:
712 v1 - The first instance to compare.
713 v2 - The second instance to compare.
714
715 Returns: True if the first parameter is greater than or equal to the second.
716 *-----------------------------------------------------------------------------------------------**/
717 template<uint01 vec_1_size, uint01 vec_2_size, class t_type>
719 {
720 const uint01 min_val = getMin(vec_1_size, vec_2_size);
721 for (uint01 dim = 0; dim < min_val; ++dim)
722 {
723 if (!(v1[dim] >= v2[dim]))
724 return false;
725 }
726 return true;
727 }
728
729 template<uint01 t_dims, class t_type>
730 constexpr bool operator>=(const Vector<t_dims, t_type>& v1, const t_type& s)
731 {
732 for (uint01 dim = 0; dim < t_dims; ++dim)
733 {
734 if (!(v1[dim] >= s))
735 return false;
736 }
737 return true;
738 }
739
740
741 /**--------------------------------------------------------------------------------------------------
742 Fn: constexpr bool operator>(const Vector<vec_1_size, t_type>& v1,
743 const Vector<vec_2_size, t_type>& v2)
744
745 Greater-than comparison operator.
746
747 Author: Tyler Parke
748
749 Date: 2017-11-13
750
751 Parameters:
752 v1 - The first instance to compare.
753 v2 - The second instance to compare.
754
755 Returns: True if the first parameter is greater than to the second.
756 *-----------------------------------------------------------------------------------------------**/
757 template<uint01 vec_1_size, uint01 vec_2_size, class t_type>
759 {
760 const uint01 min_val = getMin(vec_1_size, vec_2_size);
761 for (uint01 dim = 0; dim < min_val; ++dim)
762 {
763 if (!(v1[dim] > v2[dim]))
764 return false;
765 }
766 return true;
767 }
768
769 template<uint01 vec_1_size, uint01 vec_2_size, class t_type>
771 {
772 const t_type min_val = getMin(vec_1_size, vec_2_size);
773 for (uint01 dim = 0; dim < min_val; ++dim)
774 {
775 if (!(v1[dim] < v2[dim]))
776 return false;
777 }
778 return true;
779 }
780 template<uint01 vec_1_size, uint01 vec_2_size, class t_type>
782 {
783 const uint01 min_val = getMin(vec_1_size, vec_2_size);
784 for (uint01 dim = 0; dim < min_val; ++dim)
785 {
786 if (!(v1[dim] <= v2[dim]))
787 return false;
788 }
789 return true;
790 }
791
792 /**--------------------------------------------------------------------------------------------------
793 Fn: constexpr bool operator>=(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
794
795 Greater-than-or-equal comparison operator.
796
797 Author: Tyler Parke
798
799 Date: 2017-11-13
800
801 Parameters:
802 v1 - The first instance to compare.
803 v2 - The second instance to compare.
804
805 Returns: True if the first parameter is greater than or equal to the second.
806 *-----------------------------------------------------------------------------------------------**/
807 template<uint01 t_dims, class t_type>
808 constexpr bool operator>=(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
809 {
810 for (uint01 dim = 0; dim < t_dims; ++dim)
811 {
812 if (!(v1[dim] >= v2[dim]))
813 return false;
814 }
815 return true;
816 }
817
818
819
820 /**--------------------------------------------------------------------------------------------------
821 Fn: constexpr bool operator>(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
822
823 Greater-than comparison operator.
824
825 Author: Tyler Parke
826
827 Date: 2017-11-13
828
829 Parameters:
830 v1 - The first instance to compare.
831 v2 - The second instance to compare.
832
833 Returns: True if the first parameter is greater than to the second.
834 *-----------------------------------------------------------------------------------------------**/
835 template<uint01 t_dims, class t_type>
836 constexpr bool operator>(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
837 {
838 for (uint01 dim = 0; dim < t_dims; dim++)
839 {
840 if (!(v1[dim] > v2[dim]))
841 return false;
842 }
843 return true;
844 }
845
846 template<uint01 t_dims, class t_type>
847 constexpr bool operator<(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
848 {
849 for (uint01 dim = 0; dim < t_dims; dim++)
850 {
851 if (!(v1[dim] < v2[dim]))
852 return false;
853 }
854 return true;
855 }
856
857 template<class t_vector_type, class t_type>
858 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
859 operator<(const t_vector_type& v, const t_type& s)
860 {
861 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
862 {
863 if (!(v[dim] < s))
864 return false;
865 }
866 return true;
867 }
868 template<class t_vector_type, class t_type>
869 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
870 operator<(const t_type& s, const t_vector_type& v)
871 {
872 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
873 {
874 if (!(s < v[dim]))
875 return false;
876 }
877 return true;
878 }
879 template<class t_vector_type, class t_type>
880 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
881 operator<=(const t_type& s, const t_vector_type& v)
882 {
883 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
884 {
885 if (!(s <= v[dim]))
886 return false;
887 }
888 return true;
889 }
890
891 template<class t_vector_type, class t_type>
892 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
893 operator<=(const t_vector_type& v, const t_type& s)
894 {
895 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
896 {
897 if (!(v[dim] <= s))
898 return false;
899 }
900 return true;
901 }
902 template<class t_vector_type, class t_type>
903 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
904 operator>(const t_vector_type& v, const t_type& s)
905 {
906 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
907 {
908 if (!(v[dim] > s))
909 return false;
910 }
911 return true;
912 }
913 template<class t_vector_type, class t_type>
914 constexpr typename std::enable_if<IsVecType<t_vector_type, t_type>::value, bool>::type
915 operator>(const t_type& s, const t_vector_type& v)
916 {
917 for (uint01 dim = 0; dim < t_vector_type::NumberOfDimensions(); dim++)
918 {
919 if (!(s > v[dim]))
920 return false;
921 }
922 return true;
923 }
924
925 template<uint01 t_dims, class t_type>
926 constexpr bool operator<=(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
927 {
928 for (uint01 dim = 0; dim < t_dims; dim++)
929 {
930 if (!(v1[dim] <= v2[dim]))
931 return false;
932 }
933 return true;
934 }
935
936
937 /**--------------------------------------------------------------------------------------------------
938 Fn: Vector<t_dims, t_type> cross(const Vector<t_dims, t_type>& v1,
939 const Vector<t_dims, t_type>& v2)
940
941 Returns the cross product of 2 numbers. Note cross product is defined only for certain dimensions
942
943 Author: Tyler Parke
944
945 Date: 2017-05-17
946
947 Parameters:
948 v1 - The first Vector&lt;t_dims,t_type&gt;
949 v2 - The second Vector&lt;t_dims,t_type&gt;
950
951 Returns: A Vector&lt;t_dims,t_type&gt of v1 X v2;
952 *-----------------------------------------------------------------------------------------------**/
953 template<class t_type>
955 {
956 return Vector<1, t_type>(1);
957 }
958 template<class t_type>
959 constexpr t_type cross(const Vector<2, t_type>& v1, const Vector<2, t_type>& v2)
960 {
961 return v1[X] * v2[Y] - v1[Y] * v2[X];
962 }
963 template<class t_type>
964 constexpr Vector<2, t_type> cross(const Vector<2, t_type>& v1, const t_type& v2)
965 {
966 return Vector<2, t_type>(v2 * v1[Y], -v2 * v1[X]);
967 }
968 template<class t_type>
970 {
972 cross[X] = ((v1[Y] * v2[Z]) - (v1[Z] * v2[Y]));
973 cross[Y] = ((v1[Z] * v2[X]) - (v1[X] * v2[Z]));
974 cross[Z] = ((v1[X] * v2[Y]) - (v1[Y] * v2[X]));
975 return cross;
976 }
977
978 /**--------------------------------------------------------------------------------------------------
979 Fn: Vector<t_dims, t_type> getMax(const Vector<t_dims, t_type>& v1,
980 const Vector<t_dims, t_type>& v2)
981
982 Finds the max of the given arguments.
983
984 Author: Tyler Parke
985
986 Date: 2017-11-13
987
988 Parameters:
989 v1 - The first Vector&lt;t_dims,t_type&gt;
990 v2 - The second Vector&lt;t_dims,t_type&gt;
991
992 Returns: The calculated maximum.
993 *-----------------------------------------------------------------------------------------------**/
994 template<uint01 t_dims, class t_type>
996 {
998 for (uint01 dim = 0; dim < t_dims; dim++)
999 {
1000 vec[dim] = getMax(v1[dim], v2[dim]);
1001 }
1002 return vec;
1003 }
1004
1005 /**--------------------------------------------------------------------------------------------------
1006 Fn: Vector<t_dims, t_type> getMin(const Vector<t_dims, t_type>& v1,
1007 const Vector<t_dims, t_type>& v2)
1008
1009 Finds the min of the given arguments.
1010
1011 Author: Tyler Parke
1012
1013 Date: 2017-11-13
1014
1015 Parameters:
1016 v1 - The first Vector&lt;t_dims,t_type&gt;
1017 v2 - The second Vector&lt;t_dims,t_type&gt;
1018
1019 Returns: The calculated minimum.
1020 *-----------------------------------------------------------------------------------------------**/
1021 template<uint01 t_dims, class t_type>
1023 {
1025 for (uint01 dim = 0; dim < t_dims; dim++)
1026 {
1027 vec[dim] = getMin(v1[dim], v2[dim]);
1028 }
1029 return vec;
1030 }
1031
1032 /**--------------------------------------------------------------------------------------------------
1033 Fn: t_type determinate(const Vector<t_dims, t_type>& v1,
1034 const Vector<t_dims, t_type>& v2)
1035
1036 Determinates.
1037
1038 Author: Tyler Parke
1039
1040 Date: 2017-11-13
1041
1042 Parameters:
1043 v1 - The first Vector&lt;t_dims,t_type&gt;
1044 v2 - The second Vector&lt;t_dims,t_type&gt;
1045
1046 Returns: A t_type.
1047 *-----------------------------------------------------------------------------------------------**/
1048 template<uint01 t_dims, class t_type>
1050 {
1051 return (v1[X] * v2[Y]) - (v1[Y] * v2[X]);
1052 }
1053
1054 /**--------------------------------------------------------------------------------------------------
1055 Fn: t_type determinate(const Vector<t_dims, t_type>& v1,
1056 const Vector<t_dims, t_type>& v2, const Vector<t_dims, t_type>& v3)
1057
1058 Determinates.
1059
1060 Author: Tyler Parke
1061
1062 Date: 2017-11-13
1063
1064 Parameters:
1065 v1 - The first Vector&lt;t_dims,t_type&gt;
1066 v2 - The second Vector&lt;t_dims,t_type&gt;
1067 v3 - The third Vector&lt;t_dims,t_type&gt;
1068
1069 Returns: A t_type.
1070 *-----------------------------------------------------------------------------------------------**/
1071 template<uint01 t_dims, class t_type>
1073 {
1074 t_type x_det = v1[X] * determinate(Vector<2, t_type>(v2.dim[Y], v2.dim[Z]), Vector<2, t_type>(v3.dim[Y], v3.dim[Z]));
1075 t_type y_det = v1[Y] * determinate(Vector<2, t_type>(v2.dim[X], v2.dim[Z]), Vector<2, t_type>(v3.dim[X], v3.dim[Z]));
1076 t_type z_det = v1[Z] * determinate(Vector<2, t_type>(v2.dim[X], v2.dim[Y]), Vector<2, t_type>(v3.dim[X], v3.dim[Y]));
1077 return x_det - y_det + z_det;
1078 }
1079
1080 /**--------------------------------------------------------------------------------------------------
1081 Fn: t_type dot(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
1082
1083 Dots.
1084
1085 Author: Tyler Parke
1086
1087 Date: 2017-11-13
1088
1089 Parameters:
1090 v1 - The first Vector&lt;t_dims,t_type&gt;
1091 v2 - The second Vector&lt;t_dims,t_type&gt;
1092
1093 Returns: A t_type.
1094 *-----------------------------------------------------------------------------------------------**/
1095 template<uint01 t_dims, class t_type>
1097 {
1098 t_type value = 0;
1099 for (uint01 dim = 0; dim < t_dims; ++dim)
1100 value += v1[dim] * v2[dim];
1101 return value;
1102 }
1103
1104 /**--------------------------------------------------------------------------------------------------
1105 Fn: bool areParallel(const Vector<t_dims, t_type>& v1,
1106 const Vector<t_dims, t_type>& v2)
1107
1108 Determine if we are parallel.
1109
1110 Author: Tyler Parke
1111
1112 Date: 2017-11-13
1113
1114 Parameters:
1115 v1 - The first Vector&lt;t_dims,t_type&gt;
1116 v2 - The second Vector&lt;t_dims,t_type&gt;
1117
1118 Returns: True if parallel, false if not.
1119 *-----------------------------------------------------------------------------------------------**/
1120 template<uint01 t_dims, class t_type>
1122 {
1123 t_type magnitude_1 = v1.getMagnitudeSquared();
1124 t_type magnitude_2 = v2.getMagnitudeSquared();
1125 return v2 * v2 * (magnitude_1) == v1 * v1 * magnitude_2;
1126 }
1127
1128 /**--------------------------------------------------------------------------------------------------
1129 Fn: bool equals(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2,
1130 const t_type& epsilon = 0)
1131
1132 Tests if objects are considered equal.
1133
1134 Author: Tyler Parke
1135
1136 Date: 2017-11-13
1137
1138 Parameters:
1139 left - Constant vector&lt;t dims,t type&gt;&amp; to be compared.
1140 right - Constant vector&lt;t dims,t type&gt;&amp; to be compared.
1141 epsilon - (Optional) Constant type&amp; to be compared.
1142
1143 Returns: True if the objects are considered equal, false if they are not.
1144 *-----------------------------------------------------------------------------------------------**/
1145 template<uint01 t_dims, class t_type>
1146 constexpr bool equals(const Vector<t_dims, t_type>& left, const Vector<t_dims, t_type>& right, const t_type& epsilon = cast<t_type>(0))
1147 {
1148 return (abs(left - right) < epsilon);
1149 }
1150
1151 /**--------------------------------------------------------------------------------------------------
1152 Fn: t_type abs(const t_type& value)
1153
1154 Abs the given value.
1155
1156 Author: Tyler Parke
1157
1158 Date: 2017-11-13
1159
1160 Parameters:
1161 value - The value.
1162
1163 Returns: A t_type.
1164 *-----------------------------------------------------------------------------------------------**/
1165
1166 template<class t_type>
1167 constexpr typename std::enable_if<!IsVec<t_type>::value, t_type>::type
1168 abs(const t_type& value)
1169 {
1170 return std::abs(value);
1171 }
1172
1173 template<class t_type>
1174 constexpr typename std::enable_if<IsVec<t_type>::value, t_type>::type
1175 abs(const t_type& value)
1176 {
1177 t_type abs_value;
1178 for (uint01 dim = 0; dim < t_type::NumberOfDimensions(); ++dim)
1179 abs_value[dim] = abs(value[dim]);
1180 return abs_value;
1181 }
1182
1183 template<class t_to, class t_from>
1184 constexpr t_to cast(Vector<1, t_from>& value)
1185 {
1186 return static_cast<t_to>(value[0]);
1187 }
1188
1189 /**--------------------------------------------------------------------------------------------------
1190 Fn: uint01 abs(const uint01& value)
1191
1192 Abs the given value.
1193
1194 Author: Tyler Parke
1195
1196 Date: 2017-11-13
1197
1198 Parameters:
1199 value - The value.
1200
1201 Returns: An uint01.
1202 *-----------------------------------------------------------------------------------------------**/
1203 template<>
1204 constexpr uint01 abs(const uint01& value)
1205 {
1206 return value;
1207 }
1208
1209 /**--------------------------------------------------------------------------------------------------
1210 Fn: uint02 abs(const uint02& value)
1211
1212 Abs the given value.
1213
1214 Author: Tyler Parke
1215
1216 Date: 2017-11-13
1217
1218 Parameters:
1219 value - The value.
1220
1221 Returns: An uint02.
1222 *-----------------------------------------------------------------------------------------------**/
1223 template<>
1224 constexpr uint02 abs(const uint02& value)
1225 {
1226 return value;
1227 }
1228
1229 /**--------------------------------------------------------------------------------------------------
1230 Fn: uint04 abs(const uint04& value)
1231
1232 Abs the given value.
1233
1234 Author: Tyler Parke
1235
1236 Date: 2017-11-13
1237
1238 Parameters:
1239 value - The value.
1240
1241 Returns: An uint04.
1242 *-----------------------------------------------------------------------------------------------**/
1243 template<>
1244 constexpr uint04 abs(const uint04& value)
1245 {
1246 return value;
1247 }
1248
1249
1250 /**--------------------------------------------------------------------------------------------------
1251 Fn: uint08 abs(const uint08& value)
1252
1253 Abs the given value.
1254
1255 Author: Tyler Parke
1256
1257 Date: 2017-11-13
1258
1259 Parameters:
1260 value - The value.
1261
1262 Returns: An uint08.
1263 *-----------------------------------------------------------------------------------------------**/
1264 template<>
1265 constexpr uint08 abs(const uint08& value)
1266 {
1267 return value;
1268 }
1269
1270
1271 /**--------------------------------------------------------------------------------------------------
1272 Fn: Vector<t_dims, t_type> abs(const Vector<t_dims, t_type>& vector)
1273
1274 Abs the given vector.
1275
1276 Author: Tyler Parke
1277
1278 Date: 2017-11-13
1279
1280 Parameters:
1281 vector - The vector.
1282
1283 Returns: A Vector&lt;t_dims,t_type&gt;
1284 *-----------------------------------------------------------------------------------------------**/
1285 template<uint01 t_dims, class t_type>
1287 {
1289 for (uint01 dim = 0; dim < t_dims; ++dim)
1290 value[dim] = abs(vector[dim]);
1291 return value;
1292 }
1293
1294 /**--------------------------------------------------------------------------------------------------
1295 Fn: t_type sqrt(const t_type& value)
1296
1297 Sqrts the given value.
1298
1299 Author: Tyler Parke
1300
1301 Date: 2017-11-13
1302
1303 Parameters:
1304 value - The value.
1305
1306 Returns: A t_type.
1307 *-----------------------------------------------------------------------------------------------**/
1308 template<class t_type>
1309 t_type sqrt(const t_type& value)
1310 {
1311 return ::sqrt(value);
1312 }
1313
1314 /**--------------------------------------------------------------------------------------------------
1315 Fn: Vector<t_dims, t_type> sqrt(const Vector<t_dims, t_type>& vector)
1316
1317 Sqrts the given vector.
1318
1319 Author: Tyler Parke
1320
1321 Date: 2017-11-13
1322
1323 Parameters:
1324 vector - The vector.
1325
1326 Returns: A Vector&lt;t_dims,t_type&gt;
1327 *-----------------------------------------------------------------------------------------------**/
1328 template<uint01 t_dims, class t_type>
1330 {
1332 for (uint01 dim = 0; dim < t_dims; ++dim)
1333 {
1334 vec[dim] = std::sqrt(vector[dim]);
1335 }
1336 return vec;
1337 }
1338
1339 /**--------------------------------------------------------------------------------------------------
1340 Fn: t_type distanceSquared(const Vector<t_dims, t_type>& v1,
1341 const Vector<t_dims, t_type>& v2)
1342
1343 Distance squared.
1344
1345 Author: Tyler Parke
1346
1347 Date: 2017-11-13
1348
1349 Parameters:
1350 v1 - The first Vector&lt;t_dims,t_type&gt;
1351 v2 - The second Vector&lt;t_dims,t_type&gt;
1352
1353 Returns: A t_type.
1354 *-----------------------------------------------------------------------------------------------**/
1355 template<uint01 t_dims, class t_type>
1357 {
1358 t_type value = 0;
1359 for (uint01 dim = 0; dim < t_dims; ++dim)
1360 {
1361 const t_type dn = (v1[dim] - v2[dim]);
1362 value += dn * dn;
1363 }
1364 return value;
1365 }
1366
1367 /**--------------------------------------------------------------------------------------------------
1368 Fn: t_type distance(const Vector<t_dims, t_type>& v1,
1369 const Vector<t_dims, t_type>& v2)
1370
1371 Distances.
1372
1373 Author: Tyler Parke
1374
1375 Date: 2017-11-13
1376
1377 Parameters:
1378 v1 - The first Vector&lt;t_dims,t_type&gt;
1379 v2 - The second Vector&lt;t_dims,t_type&gt;
1380
1381 Returns: A t_type.
1382 *-----------------------------------------------------------------------------------------------**/
1383 template<uint01 t_dims, class t_type>
1385 {
1386 return sqrt(distanceSquared(v1, v2));
1387 }
1388
1389 /**--------------------------------------------------------------------------------------------------
1390 Fn: template<class t_distance_type, uint01 t_dims, class t_type> t_distance_type distance(const Vector<t_dims, t_type>& v1,
1391 const Vector<t_dims, t_type>& v2)
1392
1393 Distances.
1394
1395 Author: Tyler Parke
1396
1397 Date: 2017-11-13
1398
1399 Typeparams:
1400 t_distance_type - Type of the distance type.
1401 t_dims - Type of the dims.
1402 t_type - Type of the type.
1403 Parameters:
1404 v1 - The first Vector&lt;t_dims,t_type&gt;
1405 v2 - The second Vector&lt;t_dims,t_type&gt;
1406
1407 Returns: A t_distance_type.
1408 *-----------------------------------------------------------------------------------------------**/
1409 template<class t_distance_type, uint01 t_dims, class t_type>
1410 t_distance_type distance(const Vector<t_dims, t_type>& v1, const Vector<t_dims, t_type>& v2)
1411 {
1413 }
1414
1415 template <uint01 t_dims, typename t_type>
1416 constexpr Vector<t_dims, t_type> clip(const Vector<t_dims, t_type>& value, const Vector<t_dims, t_type>& lower_bound, const Vector<t_dims, t_type>& upper_bound)
1417 {
1418 Vector<t_dims, t_type> clipped;
1419 for (uint01 i = 0; i < t_dims; i++)
1420 {
1421 clipped[i] = clip(value[i], lower_bound[i], upper_bound[i]);
1422 }
1423 return clipped;
1424 }
1425}
Definition VectorFunctions.hpp:46
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
Definition ACIColor.h:37
constexpr Vector< t_dims, t_type > operator/=(Vector< t_dims, t_type > &vec_a, const Vector< t_dims, t_type > &vec_b)
Definition VectorFunctions.hpp:570
bool operator==(const char(&v1)[t_size], const String &v2)
Definition String.h:437
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator.
Definition BaseFunctions.hpp:116
constexpr std::enable_if<!IsVec< t_type >::value, bool >::type AreSame(const t_type &a, const t_type &b)
Definition VectorFunctions.hpp:637
constexpr std::enable_if< IsVecType< t_vector_type, Angle< fltp08 > >::value, t_vector_type >::type operator*(const t_vector_type &angle, const t_type &mult)
Definition AngleFunctions.h:403
constexpr t_type clip(const t_type &value, const t_type &lower_bound, const t_type &upper_bound)
Clips the value given so that that the returned value falls between upper and lower bound.
Definition BaseFunctions.hpp:240
constexpr bool operator<(const Vector< vec_1_size, t_type > &v1, const Vector< vec_2_size, t_type > &v2)
Definition VectorFunctions.hpp:770
t_type dot(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1096
constexpr bool operator!=(const Vector< t_dims, t_type > &vec_a, const Vector< t_dims, t_type > &vec_b)
Definition Vector.hpp:724
constexpr bool operator<=(const Vector< vec_1_size, t_type > &v1, const Vector< vec_2_size, t_type > &v2)
Definition VectorFunctions.hpp:781
bool areParallel(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1121
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
NDEVR_BASE_API TimeSpan operator-(const Time &time, const Time &value)
Definition TimeSpan.cpp:204
t_type determinate(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1049
String operator+(const String &string_a, const String &string_b)
Definition String.h:352
t_type distanceSquared(const Bounds< t_dims, t_type, t_vertex > &bounds, const Vector< t_dims, t_type > &vertex)
Definition Distance.hpp:42
String & operator+=(String &string, const String &value)
Definition String.h:414
constexpr bool operator>=(const Vector< vec_1_size, t_type > &v1, const Vector< vec_2_size, t_type > &v2)
Definition VectorFunctions.hpp:718
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
constexpr Vector< 1, t_type > cross(const Vector< 1, t_type > &, const Vector< 1, t_type > &)
Definition VectorFunctions.hpp:954
constexpr std::enable_if< IsVecType< t_vector_type, Angle< t_angle_type > >::value, t_vector_type >::type operator/(const t_vector_type &angle, const t_type &den)
Definition AngleFunctions.h:459
constexpr bool operator>(const Vector< vec_1_size, t_type > &v1, const Vector< vec_2_size, t_type > &v2)
Definition VectorFunctions.hpp:758
NDEVR_BASE_API Time & operator-=(Time &time, const TimeSpan &value)
Definition TimeSpan.cpp:221
constexpr RGBColor & operator*=(RGBColor &color, const t_type &value)
Definition RGBColor.h:221
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
t_type sqrt(const t_type &value)
Definition VectorFunctions.hpp:1309
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514
constexpr t_type distance(const t_vertex &vertex, const LineSegment< t_dims, t_type, t_vertex > &line)
Definition Distance.hpp:250
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:109
constexpr bool equals(const LineSegment< t_dims, t_type, t_vertex > &left, const LineSegment< t_dims, t_type, t_vertex > &right, const t_type &epsilon=cast< t_type >(0))
Definition Line.hpp:819
constexpr Angle< t_angle_type > abs(const Angle< t_angle_type > &value)
Definition AngleFunctions.h:750
constexpr bool isNaN(const t_type &value)
Query if 'value' is valid or invalid.
Definition BaseFunctions.hpp:200
constexpr Vector< t_dims, Angle< t_angle_type > > operator%(const Vector< t_dims, Angle< t_angle_type > > &vec_a, const Vector< t_dims, Angle< t_angle_type > > &vec_b)
Definition AngleFunctions.h:734
@ Y
Definition BaseValues.hpp:202
@ X
Definition BaseValues.hpp:200
@ Z
Definition BaseValues.hpp:204
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator.
Definition BaseFunctions.hpp:67