mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
py visualization
This commit is contained in:
parent
34b90d5254
commit
c1935691e2
@ -21,6 +21,7 @@ geom = CSGeometry()
|
|||||||
geom.Add (all)
|
geom.Add (all)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vis = VS(geom)
|
vis = VS(geom)
|
||||||
# vis.Draw()
|
# vis.Draw()
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from netgen.csg import *
|
from netgen.csg import *
|
||||||
import netgen.meshing as meshing
|
import netgen.meshing as meshing
|
||||||
|
import libvisual
|
||||||
|
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
from OpenGL.GLU import *
|
from OpenGL.GLU import *
|
||||||
@ -9,18 +10,22 @@ from OpenGL.GLUT import *
|
|||||||
|
|
||||||
sp1 = Sphere (Pnt(0,0,0), 0.2)
|
sp1 = Sphere (Pnt(0,0,0), 0.2)
|
||||||
sp2 = Sphere (Pnt(0.5,0,0), 0.2)
|
sp2 = Sphere (Pnt(0.5,0,0), 0.2)
|
||||||
sp3 = Sphere (Pnt(0,0,0.5), 0.2)
|
|
||||||
sp4 = Sphere (Pnt(0,0.2,0.7), 0.2)
|
|
||||||
sp5 = Sphere (Pnt(0,0,0.3), 0.2)
|
|
||||||
|
|
||||||
|
all = sp1+sp2
|
||||||
all = sp1+sp2+sp3+sp4+sp5
|
|
||||||
|
|
||||||
|
|
||||||
geom = CSGeometry()
|
geom = CSGeometry()
|
||||||
geom.Add (all)
|
geom.Add (all)
|
||||||
|
|
||||||
|
|
||||||
|
param = meshing.MeshingParameters()
|
||||||
|
param.maxh = 0.1
|
||||||
|
m1 = GenerateMesh (geom, param)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vismesh = libvisual.meshvis.VS(m1)
|
||||||
|
|
||||||
vis = VS(geom)
|
vis = VS(geom)
|
||||||
# vis.Draw()
|
# vis.Draw()
|
||||||
|
|
||||||
@ -44,7 +49,8 @@ def myMotionHandler( x, y ):
|
|||||||
MouseMove(vis,xold,yold, x,y, mode) # 'm','z'
|
MouseMove(vis,xold,yold, x,y, mode) # 'm','z'
|
||||||
xold = x
|
xold = x
|
||||||
yold = y
|
yold = y
|
||||||
mydraw()
|
glutPostRedisplay()
|
||||||
|
# mydraw()
|
||||||
|
|
||||||
def myPassiveMotionHandler( x, y ):
|
def myPassiveMotionHandler( x, y ):
|
||||||
global xold, yold
|
global xold, yold
|
||||||
@ -90,6 +96,16 @@ glMatrixMode(GL_MODELVIEW);
|
|||||||
glutMainLoop()
|
glutMainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
# import threading
|
||||||
|
# threading.start_new_thread (glutMainLoop, [])
|
||||||
|
|
||||||
|
|
||||||
|
# from threading import Thread
|
||||||
|
# thread = Thread(target = glutMainLoop)
|
||||||
|
# thread.start()
|
||||||
|
# thread.join()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# param = meshing.MeshingParameters(maxh=0.2)
|
# param = meshing.MeshingParameters(maxh=0.2)
|
||||||
# mesh = GenerateMesh (geom, param)
|
# mesh = GenerateMesh (geom, param)
|
||||||
|
@ -2,7 +2,8 @@ from netgen import __platform
|
|||||||
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
if __platform.startswith('linux') or __platform.startswith('darwin'):
|
||||||
# Linux or Mac OS X
|
# Linux or Mac OS X
|
||||||
from libcsg.csg import *
|
from libcsg.csg import *
|
||||||
from libcsgvis.csgvis import *
|
import libcsgvis.csgvis as csgvis
|
||||||
|
from libcsgvis.csgvis import MouseMove
|
||||||
import libmesh.meshing
|
import libmesh.meshing
|
||||||
# from libmesh.meshing import *
|
# from libmesh.meshing import *
|
||||||
if __platform.startswith('win'):
|
if __platform.startswith('win'):
|
||||||
@ -10,3 +11,13 @@ if __platform.startswith('win'):
|
|||||||
from nglib.csg import *
|
from nglib.csg import *
|
||||||
from nglib.csgvis import *
|
from nglib.csgvis import *
|
||||||
from nglib.meshing import *
|
from nglib.meshing import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CSGeometry.VS = csgvis.VS
|
||||||
|
del csgvis
|
||||||
|
|
||||||
|
def VS (obj):
|
||||||
|
return obj.VS()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user