Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TVector3.h
Go to the documentation of this file.
1#pragma once
2
4#include "Math/math_fwd.h"
5#include "Math/constant.h"
6#include "Utility/utility.h"
7
8#include <Common/Utility/string_utils.h>
9
10namespace ph::math
11{
12
15template<typename T>
16class TVector3 final : public TVectorNBase<TVector3<T>, T, 3>
17{
18private:
19 using Base = TVectorNBase<TVector3<T>, T, 3>;
20
21protected:
22 using Base::m;
23
24public:
25 static TVector3 weightedSum(
26 const TVector3& vA, T wA,
27 const TVector3& vB, T wB,
28 const TVector3& vC, T wC);
29
30 static TVector3 lerp(
31 const TVector3& vA,
32 const TVector3& vB,
33 T parametricT);
34
35public:
37
38 using Base::Base;
39
40 TVector3(T vx, T vy, T vz);
41
42 template<typename U>
43 explicit TVector3(const TVector3<U>& other);
44
45 TVector3 rotate(const TQuaternion<T>& rotation) const;
46 void rotate(const TQuaternion<T>& rotation, TVector3* out_result) const;
47
48 TVector3 cross(const TVector3& rhs) const;
49 void cross(const TVector3& rhs, TVector3* out_result) const;
50
51 TVector3& maddLocal(T multiplier, const TVector3& adder);
52
53 TVector3 reflect(const TVector3& normal) const;
54 TVector3& reflectLocal(const TVector3& normal);
55
59 void sort(TVector3* out_result) const;
60
61 T& x();
62 T& y();
63 T& z();
64 const T& x() const;
65 const T& y() const;
66 const T& z() const;
67
68 T& r();
69 T& g();
70 T& b();
71 const T& r() const;
72 const T& g() const;
73 const T& b() const;
74};
75
76}// end namespace ph::math
77
78template<typename T>
80
81#include "Math/TVector3.ipp"
PH_DEFINE_INLINE_TO_STRING_FORMATTER_TEMPLATE(ph::math::TVector3< T >)
Represents a quaternion.
Definition TQuaternion.h:17
Represents a 3-D vector.
Definition TVector3.h:17
T & y()
Definition TVector3.ipp:189
TVector3 & maddLocal(T multiplier, const TVector3 &adder)
Definition TVector3.ipp:95
T & z()
Definition TVector3.ipp:195
TVector3 & reflectLocal(const TVector3 &normal)
Definition TVector3.ipp:113
T & x()
Definition TVector3.ipp:183
void sort(TVector3 *out_result) const
Definition TVector3.ipp:125
TVector3 rotate(const TQuaternion< T > &rotation) const
Definition TVector3.ipp:51
TVector3(T vx, T vy, T vz)
Definition TVector3.ipp:37
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(TVector3)
static TVector3 weightedSum(const TVector3 &vA, T wA, const TVector3 &vB, T wB, const TVector3 &vC, T wC)
Definition TVector3.ipp:19
static TVector3 lerp(const TVector3 &vA, const TVector3 &vB, T parametricT)
Definition TVector3.ipp:28
T & r()
Definition TVector3.ipp:219
TVector3 reflect(const TVector3 &normal) const
Definition TVector3.ipp:106
T & b()
Definition TVector3.ipp:231
T & g()
Definition TVector3.ipp:225
TVector3 cross(const TVector3 &rhs) const
Definition TVector3.ipp:75
Definition TVectorNBase.h:14
std::array< T, N > m
Definition TArithmeticArrayBase.h:217
Math functions and utilities.
Definition TransformInfo.h:10