35 using Eigen::MatrixXd;
36 using Eigen::VectorXd;
37 using Eigen::Vector4d;
42 const std::vector<std::vector<double>> &coords)
49 A = MatrixXd::Zero(4, 4);
50 b = VectorXd::Zero(4);
56 A = MatrixXd::Zero(10, 10);
57 b = VectorXd::Zero(10);
63 std::cerr <<
"Error: order: " <<
order <<
" is not supported" 68 basis.resize(coords.size());
69 for (
int i = 0; i < coords.size(); ++i)
77 std::unique_ptr<polyApprox>
79 const std::vector<std::vector<double>> &coords)
81 return std::unique_ptr<polyApprox>(
new polyApprox(order, coords));
87 for (
int i = 0; i <
basis.size(); ++i)
91 a =
A.partialPivLu().solve(
b);
105 return (P.transpose() *
a)(0, 0);
117 basisVec(1) = coord[0];
118 basisVec(2) = coord[1];
119 basisVec(3) = coord[2];
126 basisVec(1) = coord[0];
127 basisVec(2) = coord[1];
128 basisVec(3) = coord[2];
129 basisVec(4) = coord[0] * coord[0];
130 basisVec(5) = coord[0] * coord[1];
131 basisVec(6) = coord[0] * coord[2];
132 basisVec(7) = coord[1] * coord[1];
133 basisVec(8) = coord[1] * coord[2];
134 basisVec(9) = coord[2] * coord[2];
139 std::cerr <<
"Error: order " <<
order <<
" is not supported." static std::unique_ptr< polyApprox > CreateUnique(int order, const std::vector< std::vector< double >> &coords)
data_type data
Edge/face with sorted point ids (a, b, c, ...) is located at some index i in data[b], with data[b][i].first == [a, c] (for edges, third point id treated as -1).
double eval(const std::vector< double > &coord) const
void computeCoeff(const Eigen::VectorXd &data)
std::vector< Eigen::VectorXd > basis
polyApprox(int _order, const std::vector< std::vector< double >> &coords)
Eigen::Matrix< double, 10, 1 > Vector10d
Eigen::VectorXd computeBasis(const std::vector< double > &coord) const