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 OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


( Jump to the original submission)

Sat 02 Jun 2018 12:57:18 PM UTC, comment #7:

Closing as fixed.

Markus Mützel <mmuetzel>
Project Member
Thu 31 May 2018 11:23:55 AM UTC, comment #6:

I refreshed this patch to apply on the current tip and pushed it here:

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
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]:
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:

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 Files:

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

   bug dependencies.


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

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

    Only project members can vote.




    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-02 mmuetzel StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2018-05-31 mmuetzel StatusConfirmed => Ready For Test
    2016-11-15 rik5 StatusNone => Confirmed
        Release4.0.1 => dev
    2016-09-23 rik5 Dependencies- => bugs #38779 is dependent
    2016-07-18 mmuetzel Attached File- => Added patch_with_nonplanar_faces_v2.patch, #37933
        Carbon-Copy- => Added pantxo
    2016-07-02 mmuetzel Attached File- => Added patch_with_nonplanar_faces.patch, #37672
        Attached File- => Added test_nonplanar_patches.m, #37673
    2016-04-19 mmuetzel Attached File- => Added patch_tesselator_debug.patch, #36963
    2016-04-15 mmuetzel Attached 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.3