Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TVector4.ipp
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector4.h"
4#include "Math/math.h"
5
6#include <Common/assertion.h>
7
8#include <cmath>
9#include <algorithm>
10#include <type_traits>
11#include <array>
12
13namespace ph::math
14{
15
16template<typename T>
17inline TVector4<T>::TVector4(const T vx, const T vy, const T vz, const T vw) :
18 Base(std::array<T, 4>{vx, vy, vz, vw})
19{}
20
21template<typename T>
22template<typename U>
23inline TVector4<T>::TVector4(const TVector4<U>& other) :
25 static_cast<T>(other[0]),
26 static_cast<T>(other[1]),
27 static_cast<T>(other[2]),
28 static_cast<T>(other[3]))
29{}
31template<typename T>
32inline T& TVector4<T>::x()
34 return m[0];
37template<typename T>
38inline T& TVector4<T>::y()
40 return m[1];
43template<typename T>
44inline T& TVector4<T>::z()
46 return m[2];
49template<typename T>
50inline T& TVector4<T>::w()
51{
52 return m[3];
53}
54
55template<typename T>
56inline const T& TVector4<T>::x() const
57{
58 return m[0];
59}
60
61template<typename T>
62inline const T& TVector4<T>::y() const
63{
64 return m[1];
65}
66
67template<typename T>
68inline const T& TVector4<T>::z() const
69{
70 return m[2];
71}
72
73template<typename T>
74inline const T& TVector4<T>::w() const
75{
76 return m[3];
77}
78
79template<typename T>
80inline T& TVector4<T>::r()
81{
82 return m[0];
83}
84
85template<typename T>
86inline T& TVector4<T>::g()
87{
88 return m[1];
89}
90
91template<typename T>
92inline T& TVector4<T>::b()
93{
94 return m[2];
95}
96
97template<typename T>
98inline T& TVector4<T>::a()
99{
100 return m[3];
101}
102
103template<typename T>
104inline const T& TVector4<T>::r() const
105{
106 return m[0];
107}
108
109template<typename T>
110inline const T& TVector4<T>::g() const
111{
112 return m[1];
113}
114
115template<typename T>
116inline const T& TVector4<T>::b() const
117{
118 return m[2];
119}
120
121template<typename T>
122inline const T& TVector4<T>::a() const
123{
124 return m[3];
125}
126
127}// end namespace ph::math
Represents a 4-D vector.
Definition TVector4.h:15
T & r()
Definition TVector4.ipp:80
T & g()
Definition TVector4.ipp:86
T & w()
Definition TVector4.ipp:50
T & y()
Definition TVector4.ipp:38
TVector4(T vx, T vy, T vz, T vw)
Definition TVector4.ipp:17
T & x()
Definition TVector4.ipp:32
T & z()
Definition TVector4.ipp:44
T & b()
Definition TVector4.ipp:92
T & a()
Definition TVector4.ipp:98
Miscellaneous math utilities.
Math functions and utilities.
Definition TransformInfo.h:10
Definition TAABB2D.h:96