bugGNU Octave - Bugs: bug #57567, Interpolation techniques for patch...


bug #57567: Interpolation techniques for patch () triangles

Submitter:  Hg200 <hg200>
Submitted:  Thu 09 Jan 2020 08:58:50 PM UTC
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 09 Jan 2020 09:43:04 PM UTC, comment #2: 

It's complicated because you have to understand how OpenGl works (not my strong suit), but the Octave code to start debugging is at libinterp/corefcn/gl-render.cc in the function draw_patch().

Rik <rik5>
Group administrator
Thu 09 Jan 2020 09:36:16 PM UTC, comment #1: 

I was trying some test code with patch related to this bug report and discovered an entirely separate problem in the input validation.  I filed a report about that at bug #57569.

Rik <rik5>
Group administrator
Thu 09 Jan 2020 08:58:50 PM UTC, original submission:  

i.) Create a patch triangle and put the colors R, G and B into the vertices and plot the triangle with a jet map + interpolation. One edge goes directly from blue to red (without green). In matlab R2018 the whole colormap appears over the edges.

ii.) In older matlab releases (R2013) the "exact" interpolation was used for patch plots containing less 120 triangles. For plots > 120 triangles same interpolation as in octave was used. In R2018 this is changed: Interpolation is "exact" for any number of triangles. [Since the "cool" map is not affected my guess is also that was the reason why the pdetools did use "cool".]

iii.) There are some "okay maps". Examples:

## rgb=[0, 1, 1; 1, 0, 1];
## rgb=[1, 1, 0; 1, 0, 1];
rgb=[1, 0, 0; 0, 0, 1];
okmap = interp1 (linspace (0, 1, 2), rgb, linspace (0, 1, 64));

iv.) Both pictures show the difference between R2018 and Octave for jet and cool. One picture shows the solution of the laplace equation derived with P1 (linear) finite elements on an unstructured triangular mesh. This lets me to the assumption that barycentric interpolation from the corners into the triangle area is the correct interpolation technique.

I am very interested if somebody can tell me where the interpolation is done inside the source code.

MWE attached.

Hg200 <hg200>


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

Attach Files:

Attached Files
file #48191:  patchinterpolation.png added by hg200 (50KiB - image/png)
file #48192:  patchinterpolation.m added by hg200 (373B - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-09 rik5 StatusNone Confirmed
        Releaseother dev
    2020-01-09 hg200 Attached File- Added patchinterpolation.png, #48191
        Attached File- Added patchinterpolation.m, #48192
        Attached File- Added patchinterpolationlaplace.png, #48193

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code