123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #pragma once
- #include <Mathematics/Delaunay2Mesh.h>
- #include <Mathematics/IntpQuadraticNonuniform2.h>
- #include <memory>
- namespace WwiseGTE
- {
- template <typename InputType, typename ComputeType, typename RationalType>
- class IntpVectorField2
- {
- public:
-
- ~IntpVectorField2() = default;
- IntpVectorField2(int numPoints, Vector2<InputType> const* domain,
- Vector2<InputType> const* range)
- :
- mMesh(mDelaunay)
- {
-
-
-
- mXRange.resize(numPoints);
- mYRange.resize(numPoints);
- for (int i = 0; i < numPoints; ++i)
- {
- mXRange[i] = range[i][0];
- mYRange[i] = range[i][1];
- }
-
- mDelaunay(numPoints, &domain[0], (ComputeType)0);
-
- mXInterp = std::make_unique<IntpQuadraticNonuniform2<InputType, TriangleMesh>>(
- mMesh, &mXRange[0], (InputType)1);
-
-
- mYInterp = std::make_unique<IntpQuadraticNonuniform2<InputType, TriangleMesh>>(
- mMesh, &mYRange[0], (InputType)1);
- }
-
-
-
- bool operator()(Vector2<InputType> const& input, Vector2<InputType>& output) const
- {
- InputType xDeriv, yDeriv;
- return (*mXInterp)(input, output[0], xDeriv, yDeriv)
- && (*mYInterp)(input, output[1], xDeriv, yDeriv);
- }
- protected:
- typedef Delaunay2Mesh<InputType, ComputeType, RationalType> TriangleMesh;
- Delaunay2<InputType, ComputeType> mDelaunay;
- TriangleMesh mMesh;
- std::vector<InputType> mXRange;
- std::vector<InputType> mYRange;
- std::unique_ptr<IntpQuadraticNonuniform2<InputType, TriangleMesh>> mXInterp;
- std::unique_ptr<IntpQuadraticNonuniform2<InputType, TriangleMesh>> mYInterp;
- };
- }
|