bugGNU Octave - Bugs: bug #47677, non-planar patches are not...

 
 

bug #47677: non-planar patches are not supported in Octave

Submitted by:  Markus Mützel <mmuetzel>
Submitted on:  Tue 12 Apr 2016 01:14:40 PM UTC  
 
Category: Plotting with OpenGLSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 18 Jul 2016 04:39:37 PM UTC, comment #5:

The attached changeset adds a demo with a non-planar patch. other than that it is the same as file #37672 from comment #4.

(file #37933)

Markus Mützel <mmuetzel>
Project Member
Sat 02 Jul 2016 07:53:47 PM UTC, comment #4:

Attached is a patch that finds planar subsets for non-planar faces.
When using OpenGL, these subsets are drawn separately.

There are different approaches for separating non-planar polygons into planar subsets. The approach taken in this patch is the following:
1- Find the largest sequence starting from edge(1) that gives a planar polygon.
2- Including edge(1), find the largest sequence starting from the last edge of the prior polygon that gives a planar polygon.
3- Repeat from 2 until the face is complete.

I also attached a script for testing with some exemplary non-planar polygons.

(file #37672, file #37673)

Markus Mützel <mmuetzel>
Project Member
Tue 19 Apr 2016 01:58:42 PM UTC, comment #3:

After some debugging, I am under the impression that OpenGL does not support non-coplanar polygons at all.
For the missing vertex, patch_tesselator::combine is called and the point is collapsed onto [0 1 0].

From the OpenGL docs [1]:
GLU_TESS_COMBINE
The combine callback is called to create a new vertex when the tessellation detects an intersection or wishes to merge features.

If I understand correctly, this is something OpenGL does automatically.
The only thing that occurs to me that would enable non-coplanar polygons would be to divide the polygons into coplanar subsets and draw them seperately...

With the attaches patch that adds a bunch of debugging messages, I get the following:

(file #36963)

Markus Mützel <mmuetzel>
Project Member
Fri 15 Apr 2016 07:23:06 AM UTC, comment #2:

Rik:
Please, find the resulting figure from the example in comment #0 in "non-plane_patch.pdf". To better visualize the "elbow" in the patch surface, "non-plane_patch+line.pdf" was saved after executing this additional line (from vertices(1,:) to vertices(3,:) ):

The triangle that is produced by Octave 4.0.1 with the same example from comment #0 is none of the two parts of that surface but lies on the "space diagonal" surface given by [1, 1, 0; 0, 0, 0; 0, 0, 1] ( = vertices(2:4,:) ), see "non-plane_patch_Octave.pdf" for Octave's result from a similar perspective.

I do not know where the thin, white, dashed and dotted lines come from in the latter pdf. I cannot see them in the original figure on the screen before and after saving to pdf. Maybe that is a different bug or they might even give a hint on what is going wrong...

(file #36932, file #36933, file #36934)

Markus Mützel <mmuetzel>
Project Member
Thu 14 Apr 2016 08:18:52 PM UTC, comment #1:

Could you attach a png or pdf of what the output should look like?

The problematic code is going to be in libinterp/corefcn/gl-render.cc. Either the draw_patch routine or the callback that handles the tesselation. My guess is that the callback is filtering out one of the resulting triangles because it is seeing the shared edge and somehow calculating them to be the same triangle.

Rik <rik5>
Project Administrator
Tue 12 Apr 2016 01:14:40 PM UTC, original submission:

In Matlab, the following example gives a patch with a bent surface (similar to two triangles sharing one edge):

While the same code sample does not error for "fltk" or "qt" in Octave, the resulting patch is incorrect. The first edge (at [0, 1, 0]) seems to be ignored.

For "gnuplot", this error is thrown:

Markus Mützel <mmuetzel>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #37673:  test_nonplanar_patches.m added by mmuetzel (2KiB - text/x-objcsrc)
file #36932:  non-plane_patch.pdf added by mmuetzel (3KiB - application/pdf)
file #36933:  non-plane_patch+line.pdf added by mmuetzel (3KiB - application/pdf)
file #36934:  non-plane_patch_Octave.pdf added by mmuetzel (4KiB - application/pdf)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by mmuetzel
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mmuetzel (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Nov 2016 07:04:14 PM UTCrik5StatusNone=>Confirmed
      Release4.0.1=>dev
    Fri 23 Sep 2016 04:42:49 PM UTCrik5Dependencies-=>bugs #38779 is dependent
    Mon 18 Jul 2016 04:39:37 PM UTCmmuetzelAttached File-=>Added patch_with_nonplanar_faces_v2.patch, #37933
      Carbon-Copy-=>Added pantxo
    Sat 02 Jul 2016 07:53:47 PM UTCmmuetzelAttached File-=>Added patch_with_nonplanar_faces.patch, #37672
      Attached File-=>Added test_nonplanar_patches.m, #37673
    Tue 19 Apr 2016 01:58:42 PM UTCmmuetzelAttached File-=>Added patch_tesselator_debug.patch, #36963
    Fri 15 Apr 2016 07:23:06 AM UTCmmuetzelAttached File-=>Added non-plane_patch.pdf, #36932
      Attached File-=>Added non-plane_patch+line.pdf, #36933
      Attached File-=>Added non-plane_patch_Octave.pdf, #36934

    Back to the top


    Powered by Savane 3.1-cleanup1