Skip to content
Snippets Groups Projects
Commit 48584dc5 authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

[Num] fix a bug in LinearInterpolationOnSurface. pnt should be rotated

parent ee4a1fbc
No related branches found
No related tags found
No related merge requests found
...@@ -69,12 +69,14 @@ double LinearInterpolationOnSurface::interpolateInTri( ...@@ -69,12 +69,14 @@ double LinearInterpolationOnSurface::interpolateInTri(
std::vector<GeoLib::Point> pnts; std::vector<GeoLib::Point> pnts;
for (unsigned i=0; i<3; i++) for (unsigned i=0; i<3; i++)
pnts.emplace_back(*tri.getPoint(i)); pnts.emplace_back(*tri.getPoint(i));
std::vector<GeoLib::Point*> p_pnts = {{&pnts[0], &pnts[1], &pnts[2]}}; pnts.emplace_back(pnt, -1);
std::vector<GeoLib::Point*> p_pnts = {{&pnts[0], &pnts[1], &pnts[2], &pnts[3]}};
GeoLib::rotatePointsToXY(p_pnts); GeoLib::rotatePointsToXY(p_pnts);
GeoLib::Point const& v1(pnts[0]); GeoLib::Point const& v1(pnts[0]);
GeoLib::Point const& v2(pnts[1]); GeoLib::Point const& v2(pnts[1]);
GeoLib::Point const& v3(pnts[2]); GeoLib::Point const& v3(pnts[2]);
GeoLib::Point const& v_pnt(pnts[3]);
const double area = GeoLib::calcTriangleArea(v1, v2, v3); const double area = GeoLib::calcTriangleArea(v1, v2, v3);
if (area==.0) { if (area==.0) {
...@@ -102,7 +104,7 @@ double LinearInterpolationOnSurface::interpolateInTri( ...@@ -102,7 +104,7 @@ double LinearInterpolationOnSurface::interpolateInTri(
double val = .0; double val = .0;
for (unsigned i=0; i<3; i++) for (unsigned i=0; i<3; i++)
val += (a[i]+b[i]*pnt[0]+c[i]*pnt[1]) * vertex_values[i]; val += (a[i]+b[i]*v_pnt[0]+c[i]*v_pnt[1]) * vertex_values[i];
return val; return val;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment