1#ifndef TATOOINE_DETAIL_LINE_VERTEX_PROPERTY_SAMPLER_H
2#define TATOOINE_DETAIL_LINE_VERTEX_PROPERTY_SAMPLER_H
9template <floating_point Real, std::size_t NumDimensions,
typename Property,
10 template <
typename>
typename InterpolationKernel>
31 while (
range.second.index() -
range.first.index() > 1) {
35 range.second = center;
42 t = (t - lt) / (rt - lt);
45 return interpolant(t);
49template <
floating_po
int Real, std::
size_t NumDimensions,
typename Property>
51 interpolation::cubic> {
75 auto const stencil_size =
77 auto const half = stencil_size / 2;
78 auto derivatives = std::vector<value_type>{};
81 auto lv = half > v.index() ?
handle_type{0} : v - half;
82 auto const rv = lv.index() + stencil_size - 1 >=
m_line.
vertices().size()
84 : lv + stencil_size - 1;
85 auto const rpotential = stencil_size - (rv.index() - lv.index() + 1);
86 lv = rpotential > lv.index() ?
handle_type{0} : lv - rpotential;
88 auto ts = std::vector<Real>(stencil_size);
89 auto i = std::size_t{};
90 for (
auto vi = lv; vi <= rv; ++vi, ++i) {
96 for (
auto vi = lv; vi <= rv; ++vi, ++i) {
107 m_interpolants.emplace_back(
116 if constexpr (tensor_rank<value_type> == 0) {
117 return nan<value_type>();
123 while (
range.second.index() -
range.first.index() > 1) {
127 range.second = center;
129 range.first = center;
134 t = (t - lt) / (rt - lt);
136 return m_interpolants[
range.first.index()](t);
Definition: concepts.h:84
auto finite_differences_coefficients(std::size_t const derivative_order, floating_point auto const ... xs)
See What is this? for an explanation.
Definition: finite_differences_coefficients.h:13
typename value_type_impl< T >::type value_type
Definition: type_traits.h:280
auto size(vec< ValueType, N > const &v)
Definition: vec.h:148
auto nan(const char *arg="")
Definition: nan.h:26
constexpr auto min(A &&a, B &&b)
Definition: math.h:15
std::vector< interpolation::cubic< value_type > > m_interpolants
Definition: vertex_property_sampler.h:65
line_type const & m_line
Definition: vertex_property_sampler.h:62
vertex_property_sampler(line_type const &line, property_type const &property)
Definition: vertex_property_sampler.h:68
Property property_type
Definition: vertex_property_sampler.h:58
auto operator()(Real t) const -> value_type
Definition: vertex_property_sampler.h:114
typename line_type::parameterization_property_type parameterization_property_type
Definition: vertex_property_sampler.h:57
typename line_type::tangent_property_type tangent_property_type
Definition: vertex_property_sampler.h:55
parameterization_property_type const & m_parameterization
Definition: vertex_property_sampler.h:64
typename property_type::value_type value_type
Definition: vertex_property_sampler.h:59
property_type const & m_property
Definition: vertex_property_sampler.h:63
typename line_type::vertex_handle handle_type
Definition: vertex_property_sampler.h:54
Real real_type
Definition: vertex_property_sampler.h:52
Definition: vertex_property_sampler.h:11
Property property_type
Definition: vertex_property_sampler.h:14
line_type const & m_line
Definition: vertex_property_sampler.h:19
typename line_type::vertex_handle handle_type
Definition: vertex_property_sampler.h:13
auto operator()(Real t) const
Definition: vertex_property_sampler.h:29
typename line_type::parameterization_property_type parameterization_property_type
Definition: vertex_property_sampler.h:16
vertex_property_sampler(line_type const &line, property_type const &property)
Definition: vertex_property_sampler.h:24
property_type const & m_property
Definition: vertex_property_sampler.h:20
parameterization_property_type const & m_parameterization
Definition: vertex_property_sampler.h:21
auto vertices() const
Definition: line.h:250
typed_vertex_property_type< Real > parameterization_property_type
Definition: line.h:61
typed_vertex_property_type< vec< Real, NumDimensions > > tangent_property_type
Definition: line.h:63