Visualization bug(?) in Polymake 4.6

Questions and problems about using polymake go here.
ren
Posts: 38
Joined: 03 May 2011, 15:21

Visualization bug(?) in Polymake 4.6

Postby ren » 27 Jan 2022, 19:17

In Polymake 4.6, the following visualization (using threejs) produces 2-faces that appear/disappear depending on the angle of view. In Polymake 4.3 everything is visualized correctly:

Code: Select all

application "tropical"; $f1 = toTropicalPolynomial("max(1*x+2*y+3*z+4*w,3*x+3*y+3*z+1*w,2*x+1*y+5*z+2*w)",qw( w x y z )); $f2 = toTropicalPolynomial("max(5*x+2*y+3*z+0*w,7*x+1*y+1*z+1*w)",qw( w x y z )); $f3 = toTropicalPolynomial("max(2*x+6*y+0*z+2*w,3*x+1*y+4*z+2*w)",qw( w x y z )); $T1 = new Hypersurface<Max>(POLYNOMIAL=>$f1); $T2 = new Hypersurface<Max>(POLYNOMIAL=>$f2); $T3 = new Hypersurface<Max>(POLYNOMIAL=>$f3); compose($T1->VISUAL(FacetColor=>"polymakeorange"), $T2->VISUAL(FacetColor=>"midnightblue"), $T3->VISUAL(FacetColor=>"darkolivegreen"));
Not sure whether this is a bug or whether visualization has changed in Polymake 4.6 and I am using it incorrectly.

User avatar
joswig
Main Author
Posts: 288
Joined: 24 Dec 2010, 11:10

Re: Visualization bug(?) in Polymake 4.6

Postby joswig » 27 Jan 2022, 20:30

We did make changes concerning threejs in order to obtain correct visualization for https://www.matchthenet.de/xmas. And I can confirm your problem.

Requires an investigation. Stay tuned.

blorenz
Developer
Posts: 140
Joined: 10 Jan 2011, 17:21

Re: Visualization bug(?) in Polymake 4.6

Postby blorenz » 27 Jan 2022, 20:54

Some of the new changes to improve the transparency don't play well with intersecting faces. I have an idea what we might change but I need to check various cases for side-effects ...

For now, please try pasting the following in the javascript console of you browser after opening the visualization:

Code: Select all

for (var i=0; i<scene.children.length; i++) { child = scene.children[i]; if ( child.userData.hasOwnProperty("facetmaterial") ) { if (Array.isArray(child.userData.facetmaterial)) { for (var j=0; j<child.userData.facetmaterial.length; j++) { child.userData.facetmaterial[j].depthWrite = true; child.userData.facetmaterial[j].depthTest = true; } } else { child.userData.facetmaterial.depthWrite = true; child.userData.facetmaterial.depthTest = true; } } }

ren
Posts: 38
Joined: 03 May 2011, 15:21

Re: Visualization bug(?) in Polymake 4.6

Postby ren » 03 Oct 2022, 11:22

Sorry for the late reply, I just wanted to say that Benjamin's suggestion helped. I couldn't figure out how to run code in the javascript console in Firefox, but adding his code to the generated html file helped:

Code: Select all

if ( THREE.WEBGL.isWebGLAvailable() ) { render(); + for (var i=0; i<scene.children.length; i++) { + child = scene.children[i]; + if ( child.userData.hasOwnProperty("facetmaterial") ) { + if (Array.isArray(child.userData.facetmaterial)) { + for (var j=0; j<child.userData.facetmaterial.length; j++) { + child.userData.facetmaterial[j].depthWrite = true; + child.userData.facetmaterial[j].depthTest = true; + } + } else { + child.userData.facetmaterial.depthWrite = true; + child.userData.facetmaterial.depthTest = true; + } + } + } } else { var warning = WEBGL.getWebGLErrorMessage(); three.appendChild( warning ); }


Return to “Helpdesk”