8#include <kernel/util/tiny_algebra.hpp>
67 template<
typename DT_,
int helper_dim,
int world_dim,
int sc_,
int sp_,
int smx_,
int snx_,
68 typename std::enable_if<helper_dim == world_dim+1, bool>::type =
true>
76 for(
int i(0); i < world_dim; ++i)
78 for(
int j(0); j < world_dim; ++j)
80 A(i,j) = x(j+1,i) - x(0,i);
89 coeffs = Ainv*(point - x[0]);
140 template<
typename DT_,
int world_dim,
int sc_,
int sp_,
int smx_,
int snx_>
146 static_assert( (world_dim == 2 || world_dim == 3),
147 "world dim has to be 2 or 3 for complementary barycentric coordinates");
149 auto tmp = x[1]-x[0];
154 tmp = point - (x[0] + coeffs[0]*(x[1]-x[0]));
204 template<
typename DT_,
int sc_,
int sp_,
int smx_,
int snx_>
210 static constexpr int world_dim = 3;
211 static constexpr int shape_dim = world_dim-1;
216 for(
int i(0); i < world_dim; ++i)
218 for(
int j(0); j < shape_dim; ++j)
219 A(i,j) = x(j+1,i) - x(0,i);
232 for(
int i(0); i < world_dim; ++i)
233 A(i,world_dim-1) = ortho(i);
240 coeffs = Ainv*(point - x[0]);
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & set_inverse(const Matrix< T_, m_, n_, sma_, sna_ > &a)
Sets this matrix to the inverse of another matrix.
Tiny Vector class template.
CUDA_HOST_DEVICE Vector & normalize()
Normalizes this vector.
CUDA_HOST_DEVICE DataType norm_euclid() const
Computes the euclid norm of this vector.
T_ sqr(T_ x)
Returns the square of a value.
CUDA_HOST_DEVICE T_ dot(const T_ &a, const T_ &b)
Computes the dot-product of two scalars.
CUDA_HOST_DEVICE void orthogonal_3x2(Vector< T_, mx_, smx_ > &nu, const Matrix< T_, ma_, na_, sm_, sn_ > &tau)
Computes the positively oriented orthogonal vector to the columns of a 3x2 matrix.
void inverse_mapping(Tiny::Vector< DT_, world_dim, sc_ > &coeffs, const Tiny::Vector< DT_, world_dim, sp_ > &point, const Tiny::Matrix< DT_, helper_dim, world_dim, smx_, snx_ > &x)
Computes the inverse coordinate mapping wrt. a full-dimensional Simplex.