Wildmeshing Toolkit
PositionMapEvaluator.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <memory>
3 #include <wmtk/Types.hpp>
4 #include <wmtk/image/Sampling.hpp>
5 
6 namespace wmtk::image {
7 class Image;
8 class SamplingAnalyticFunction;
9 } // namespace wmtk::image
10 
11 namespace wmtk::function::utils {
13 {
14 protected:
15  std::unique_ptr<wmtk::image::Sampling> m_sampling;
16 
17 public:
20  PositionMapEvaluator(PositionMapEvaluator&&); // move assignment operator
21  PositionMapEvaluator& operator=(PositionMapEvaluator&&); // move assignment operator
22 
29  PositionMapEvaluator(const image::Image& image);
30 
32  const wmtk::image::SamplingAnalyticFunction::FunctionType type,
33  const double a,
34  const double b,
35  const double c);
36 
37 
38  // Dont forget to update this if we change autodiff tyeps (add declarations in the cpp)
39  template <typename T>
40  Vector3<T> uv_to_pos(const Vector2<T>& uv) const
41 {
42  return Vector3<T>(uv.x(), uv.y(), m_sampling->sample(uv.x(), uv.y()));
43 }
44 };
45 
46 } // namespace wmtk::function::utils
Vector3< T > uv_to_pos(const Vector2< T > &uv) const
std::unique_ptr< wmtk::image::Sampling > m_sampling
PositionMapEvaluator & operator=(PositionMapEvaluator &&)
PositionMapEvaluator(PositionMapEvaluator &&)
Vector< T, 3 > Vector3
Definition: Types.hpp:24
Vector< T, 2 > Vector2
Definition: Types.hpp:22