Tessellation polygons visulization problem when parallel with z axis

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Tessellation polygons visulization problem when parallel with z axis

yaqiang
I am developing open source MeteoInfo sotware with 3D plot function powered by JOGL (https://github.com/meteoinfo/MeteoInfo). For 3D contourf function, GLUtessellator was used for polygon tessellation (https://github.com/meteoinfo/MeteoInfo/tree/master/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/tessellator). Every thing is ok when the contour filled polygons perpendicular to z axis, even the polygons with holes.


Same polygons with y fixed, so the polygons parallel with z axis, can not be visulized correct.


Any idea on it? Thanks!

The MeteoInfoLab scripts (Jython language) for test:

fn = os.path.join(migl.get_sample_folder(), 'GrADS', 'model.ctl')
f = addfile(fn)
ps_z = f['U'][0,2,:,'0:180']

#Plot
ax = axes3d()
grid(False)
geoshow('continent', facecolor=(255,229,181), edgecolor='b', linewidth=1)
ax.contourf(ps_z, 10, offset=3, zdir='z', edgecolor='gray', alpha=0.8)
colorbar()
xlim(0, 180)
xlabel('Longitude')
ylabel('Latitude')
title('contourf z fixed')


-----------------------------------------------------------------------------------

fn = os.path.join(migl.get_sample_folder(), 'GrADS', 'model.ctl')
f = addfile(fn)
ps_z = f['U'][0,1,:,'0:180']

#Plot
ax = axes3d()
grid(False)
geoshow('continent', facecolor=(255,229,181), edgecolor='b', linewidth=1,
    offset=-90)
ax.contourf(ps_z, 10, offset=0, zdir='y', edgecolor='gray', alpha=0.8)
colorbar()
xlim(0, 180)
xlabel('Longitude')
ylabel('Latitude')
title('contourf y fixed')
www.meteothink.org
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

gouessej
Administrator
Hello

Please can you be more explicit about what is wrong?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

yaqiang
X slice contour polygons were traced from 3D data array, so all endpoints of the polygons have same x coordinates. In this situation, tessellation result looks blurred and some polygons were not filled correctly. Please see the figure below.


I tried to add random small value to x coordinates fo each endpoint, so the x coordinate values are not all same. Then the tessellation result looks correct.


I am not sure if it's a bug or not.
www.meteothink.org
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

gouessej
Administrator
Thank you, I see what you mean now. I'll have to investigate. I remember that we have a partial Java implementation of GLU, I don't know whether the tessellation is in our Java source code.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

gouessej
Administrator
In reply to this post by yaqiang
Please can you provide a reproducer using only JOGL with no third party library?

I think that there's a bug in our implementation:
https://jogamp.org/cgit/jogl.git/tree/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

yaqiang
Sorry, this is my program bug. JOGL tessellation has no problem. The program checks if a polygon is convex which will be plotted directly. The convex checking function only used x and y coordinates of the endpoints, which is the source of the problem.
www.meteothink.org
Reply | Threaded
Open this post in threaded view
|

Re: Tessellation polygons visulization problem when parallel with z axis

gouessej
Administrator
Thank you for the feedback.
Julien Gouesse | Personal blog | Website