123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #pragma once
- #include <Mathematics/Logger.h>
- #include <Mathematics/Vector3.h>
- namespace WwiseGTE
- {
- template <typename Real, typename TetrahedronMesh>
- class IntpLinearNonuniform3
- {
- public:
-
- IntpLinearNonuniform3(TetrahedronMesh const& mesh, Real const* F)
- :
- mMesh(&mesh),
- mF(F)
- {
- LogAssert(mF != nullptr, "Invalid input.");
- }
-
-
-
- bool operator()(Vector3<Real> const& P, Real& F) const
- {
- int t = mMesh->GetContainingTetrahedron(P);
- if (t == -1)
- {
-
- return false;
- }
-
-
- std::array<Real, 4> bary;
- if (!mMesh->GetBarycentrics(t, P, bary))
- {
-
-
- return false;
- }
-
- std::array<int, 4> indices;
- mMesh->GetIndices(t, indices);
- F = bary[0] * mF[indices[0]] + bary[1] * mF[indices[1]] +
- bary[2] * mF[indices[2]] + bary[3] * mF[indices[4]];
- return true;
- }
- private:
- TetrahedronMesh const* mMesh;
- Real const* mF;
- };
- }
|