mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 06:30:34 +05:00
draw stl meshing 2d local coordinates
This commit is contained in:
parent
6ad36f73cb
commit
cd78f0e440
@ -1,9 +1,12 @@
|
|||||||
#include <mystdlib.h>
|
#include <mystdlib.h>
|
||||||
#include "meshing.hpp"
|
#include "meshing.hpp"
|
||||||
|
#include <visual.hpp>
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
extern DLL_HEADER void Render(bool blocking = false);
|
||||||
static void glrender (int wait);
|
static void glrender (int wait);
|
||||||
|
VisualSceneSurfaceMeshing vssurfacemeshing;
|
||||||
|
|
||||||
|
|
||||||
// global variable for visualization
|
// global variable for visualization
|
||||||
@ -15,7 +18,7 @@ namespace netgen
|
|||||||
// // static int geomtrig;
|
// // static int geomtrig;
|
||||||
// //static const char * rname;
|
// //static const char * rname;
|
||||||
// static int cntelem, trials, nfaces;
|
// static int cntelem, trials, nfaces;
|
||||||
// static int oldnl;
|
static int oldnl;
|
||||||
// static int qualclass;
|
// static int qualclass;
|
||||||
|
|
||||||
|
|
||||||
@ -242,13 +245,19 @@ namespace netgen
|
|||||||
|
|
||||||
// double h;
|
// double h;
|
||||||
|
|
||||||
NgArray<Point3d> locpoints;
|
auto locpointsptr = make_shared<NgArray<Point3d>>();
|
||||||
|
vssurfacemeshing.locpointsptr = locpointsptr;
|
||||||
|
auto& locpoints = *locpointsptr;
|
||||||
NgArray<int> legalpoints;
|
NgArray<int> legalpoints;
|
||||||
NgArray<Point2d> plainpoints;
|
auto plainpointsptr = make_shared<NgArray<Point2d>>();
|
||||||
|
auto& plainpoints = *plainpointsptr;
|
||||||
|
vssurfacemeshing.plainpointsptr = plainpointsptr;
|
||||||
NgArray<int> plainzones;
|
NgArray<int> plainzones;
|
||||||
NgArray<INDEX_2> loclines;
|
auto loclinesptr = make_shared<NgArray<INDEX_2>>();
|
||||||
|
auto &loclines = *loclinesptr;
|
||||||
|
vssurfacemeshing.loclinesptr = loclinesptr;
|
||||||
int cntelem = 0, trials = 0, nfaces = 0;
|
int cntelem = 0, trials = 0, nfaces = 0;
|
||||||
int oldnl = 0;
|
oldnl = 0;
|
||||||
int qualclass;
|
int qualclass;
|
||||||
|
|
||||||
|
|
||||||
@ -1579,14 +1588,11 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef OPENGL
|
||||||
// #define OPENGL
|
|
||||||
#ifdef OPENGLxx
|
|
||||||
|
|
||||||
/* *********************** Draw Surface Meshing **************** */
|
/* *********************** Draw Surface Meshing **************** */
|
||||||
|
|
||||||
|
|
||||||
#include <visual.hpp>
|
|
||||||
#include <stlgeom.hpp>
|
#include <stlgeom.hpp>
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
@ -1594,7 +1600,6 @@ namespace netgen
|
|||||||
|
|
||||||
extern STLGeometry * stlgeometry;
|
extern STLGeometry * stlgeometry;
|
||||||
extern Mesh * mesh;
|
extern Mesh * mesh;
|
||||||
VisualSceneSurfaceMeshing vssurfacemeshing;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1604,8 +1609,9 @@ namespace netgen
|
|||||||
|
|
||||||
if (multithread.drawing)
|
if (multithread.drawing)
|
||||||
{
|
{
|
||||||
// vssurfacemeshing.Render();
|
// vssurfacemeshing.Render();
|
||||||
Render ();
|
// Render ();
|
||||||
|
Render();
|
||||||
|
|
||||||
if (wait || multithread.testmode)
|
if (wait || multithread.testmode)
|
||||||
{
|
{
|
||||||
@ -1630,7 +1636,12 @@ namespace netgen
|
|||||||
|
|
||||||
void VisualSceneSurfaceMeshing :: DrawScene ()
|
void VisualSceneSurfaceMeshing :: DrawScene ()
|
||||||
{
|
{
|
||||||
int i, j, k;
|
// int i, j, k;
|
||||||
|
if(!locpointsptr)
|
||||||
|
return;
|
||||||
|
auto& locpoints = *locpointsptr;
|
||||||
|
auto& loclines = *loclinesptr;
|
||||||
|
auto& plainpoints = *plainpointsptr;
|
||||||
|
|
||||||
if (loclines.Size() != changeval)
|
if (loclines.Size() != changeval)
|
||||||
{
|
{
|
||||||
@ -1657,7 +1668,7 @@ namespace netgen
|
|||||||
// SetLight();
|
// SetLight();
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glMultMatrixf (transformationmat);
|
glMultMatrixd (transformationmat);
|
||||||
|
|
||||||
glShadeModel (GL_SMOOTH);
|
glShadeModel (GL_SMOOTH);
|
||||||
// glDisable (GL_COLOR_MATERIAL);
|
// glDisable (GL_COLOR_MATERIAL);
|
||||||
@ -1694,7 +1705,7 @@ namespace netgen
|
|||||||
glPolygonOffset (1, -1);
|
glPolygonOffset (1, -1);
|
||||||
glLineWidth (3);
|
glLineWidth (3);
|
||||||
|
|
||||||
for (i = 1; i <= loclines.Size(); i++)
|
for (int i = 1; i <= loclines.Size(); i++)
|
||||||
{
|
{
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
{
|
{
|
||||||
@ -1731,7 +1742,7 @@ namespace netgen
|
|||||||
float mat_colp[] = { 1, 0, 0, 1 };
|
float mat_colp[] = { 1, 0, 0, 1 };
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_colp);
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_colp);
|
||||||
glBegin (GL_POINTS);
|
glBegin (GL_POINTS);
|
||||||
for (i = 1; i <= locpoints.Size(); i++)
|
for (int i = 1; i <= locpoints.Size(); i++)
|
||||||
{
|
{
|
||||||
Point3d p = locpoints.Get(i);
|
Point3d p = locpoints.Get(i);
|
||||||
glVertex3f (p.X(), p.Y(), p.Z());
|
glVertex3f (p.X(), p.Y(), p.Z());
|
||||||
@ -1751,7 +1762,7 @@ namespace netgen
|
|||||||
double scalex = 0.1, scaley = 0.1;
|
double scalex = 0.1, scaley = 0.1;
|
||||||
|
|
||||||
glBegin (GL_LINES);
|
glBegin (GL_LINES);
|
||||||
for (i = 1; i <= loclines.Size(); i++)
|
for (int i = 1; i <= loclines.Size(); i++)
|
||||||
{
|
{
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col2d);
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col2d);
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
@ -1776,7 +1787,7 @@ namespace netgen
|
|||||||
|
|
||||||
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_colp);
|
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_colp);
|
||||||
glBegin (GL_POINTS);
|
glBegin (GL_POINTS);
|
||||||
for (i = 1; i <= plainpoints.Size(); i++)
|
for (int i = 1; i <= plainpoints.Size(); i++)
|
||||||
{
|
{
|
||||||
Point2d p = plainpoints.Get(i);
|
Point2d p = plainpoints.Get(i);
|
||||||
glVertex3f (scalex * p.X(), scaley * p.Y(), -5);
|
glVertex3f (scalex * p.X(), scaley * p.Y(), -5);
|
||||||
@ -1971,7 +1982,7 @@ namespace netgen
|
|||||||
|
|
||||||
void VisualSceneSurfaceMeshing :: BuildScene (int zoomall)
|
void VisualSceneSurfaceMeshing :: BuildScene (int zoomall)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
// int i, j, k;
|
||||||
/*
|
/*
|
||||||
center = stlgeometry -> GetBoundingBox().Center();
|
center = stlgeometry -> GetBoundingBox().Center();
|
||||||
rad = stlgeometry -> GetBoundingBox().Diam() / 2;
|
rad = stlgeometry -> GetBoundingBox().Diam() / 2;
|
||||||
|
@ -96,6 +96,10 @@ namespace netgen
|
|||||||
class VisualSceneSurfaceMeshing : public VisualScene
|
class VisualSceneSurfaceMeshing : public VisualScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
shared_ptr<NgArray<Point3d>> locpointsptr;
|
||||||
|
shared_ptr<NgArray<INDEX_2>> loclinesptr;
|
||||||
|
shared_ptr<NgArray<Point2d>> plainpointsptr;
|
||||||
|
bool clearptr;
|
||||||
VisualSceneSurfaceMeshing ();
|
VisualSceneSurfaceMeshing ();
|
||||||
virtual ~VisualSceneSurfaceMeshing ();
|
virtual ~VisualSceneSurfaceMeshing ();
|
||||||
|
|
||||||
|
@ -1940,7 +1940,7 @@ namespace netgen
|
|||||||
vs = &vsmeshdoc;
|
vs = &vsmeshdoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (strcmp (vismode, "surfmeshing") == 0) vs = &vssurfacemeshing;
|
if (strcmp (vismode, "surfmeshing") == 0) vs = &vssurfacemeshing;
|
||||||
if (strcmp (vismode, "specpoints") == 0) vs = &vsspecpoints;
|
if (strcmp (vismode, "specpoints") == 0) vs = &vsspecpoints;
|
||||||
if (strcmp (vismode, "solution") == 0) vs = &netgen::GetVSSolution();
|
if (strcmp (vismode, "solution") == 0) vs = &netgen::GetVSSolution();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user