From 99ea85a1752caf0d0847ea072c11354fab6d1f9e Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 7 Mar 2023 20:30:30 +0100 Subject: [PATCH] Draw surface vectors on quads --- libsrc/visualization/vssolution.cpp | 25 +++++++++++++++---------- libsrc/visualization/vssolution.hpp | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 1520c3e6..a803b457 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -2202,7 +2202,7 @@ namespace netgen void VisualSceneSolution :: DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp, const Point<3> & pmin, const Point<3> & pmax, - const int sei, const SolData * vsol) + const int sei, const SolData * vsol, bool swap_lam) { shared_ptr mesh = GetMesh(); @@ -2267,12 +2267,17 @@ namespace netgen if (lam1 >= 0 && lam2 >= 0 && lam1+lam2 <= 1) { + if(swap_lam) + { + Swap(lam1, lam2); + lam1 = 1.0-lam1; + lam2 = 1.0-lam2; + } Point<3> cp; for (k = 0; k < 3; k++) cp(k) = lp[0](k) + lam1 * (lp[1](k)-lp[0](k)) + lam2 * (lp[2](k)-lp[0](k)); - Point<2> xref(lam1, lam2); if (mesh->GetCurvedElements().IsHighOrder()) mesh->GetCurvedElements(). @@ -2460,22 +2465,21 @@ namespace netgen } else if (el.GetType() == QUAD) { - /* NgArray < Point<3> > lp(3); lp[0] = mesh->Point(el[0]); lp[1] = mesh->Point(el[1]); - lp[2] = mesh->Point(el[2]); - - DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol); - - lp[0] = mesh->Point(el[0]); - lp[1] = mesh->Point(el[2]); lp[2] = mesh->Point(el[3]); DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol); - */ + + lp[0] = mesh->Point(el[2]); + lp[1] = mesh->Point(el[1]); + lp[2] = mesh->Point(el[3]); + + DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol, true); + /* Point<3> lp[4]; Point<2> p2d[4]; @@ -2574,6 +2578,7 @@ namespace netgen } } + */ } } } diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index c7c4fd1f..0ec17763 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -328,7 +328,7 @@ public: void DrawSurfaceVectors (); void DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp, const Point<3> & pmin, const Point<3> & pmax, - const int sei, const SolData * vsol); + const int sei, const SolData * vsol, bool swap_lam=false); void DrawIsoSurface(const SolData * sol, const SolData * grad, int comp); void DrawIsoLines (const Point<3> & p1,