bugGNU Octave - Bugs: bug #48626, Patch with FaceColor...

 
 

bug #48626: Patch with FaceColor "flat" does not display correctly if "FaceVertexCData" is a scalar

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Mon 25 Jul 2016 03:06:39 PM UTC
   
 
Category:  Plotting with gnuplot 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
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 09 Aug 2016 10:11:19 PM UTC, comment #7: 

@Dan: I pushed your fix for gnuplot here (http://hg.savannah.gnu.org/hgweb/octave/rev/f7b70f3a8fc1).

@Markus: I added your extra %!demo here (http://hg.savannah.gnu.org/hgweb/octave/rev/669fc8cf1fdd).  We now have a primitive oct2mat converter within the dump_demos script so we no longer have to follow Matlab syntax quite so closely in %!demo blocks.  I'm sorry that I led you astray with earlier advice on that subject.

Closing report.

Rik <rik5>
Group administrator
Thu 04 Aug 2016 06:53:30 PM UTC, comment #6: 

You are right: 'margin' does not seem to work. But that is probably something for a new bug report.

And also right: Lights are stationary with the axes.

Markus Mützel <mmuetzel>
Group administrator
Thu 04 Aug 2016 06:20:34 PM UTC, comment #5: 

The third demo is much better.  I can see the difference in the fourth plot right away.  The annotation text box for your note doesn't have much margin.  It appears the margin doesn't work:


demo('isosurface', 3)
h = annotation("textbox", [0.5 0.5 5 5], "String", "Hello World!")
set(h, 'margin', 20)


Perhaps I'm misunderstanding 'margin'.

The first two demos I don't understand how lighting works, but I'm not familiar with it.  The light source is stationary with the plotting axes?  Not the view, correct?  Just something I need to get used to.

Dan Sebald <sebald>
Thu 04 Aug 2016 05:33:35 PM UTC, comment #4: 

Thanks for pointing out the issues in demo isosurface 2.
The lighting was actually correct since isosurface without output arguments should display a lighted patch object. However, that was misleading here since the vertexnormals are popinting in different directions in the different subplots which made the patches appear differently when they shouldn't.

Attached, please find a changeset for isosurface.m which changes that demo in that way and uses Matlab compatible syntax as should be used in demos. I also moved the textbox a little bit more to the center of the figure and increased the font size slightly. Initially, this demo was thought as a test for the 'noshare' option and the different input types. Since tests should not display figures, I made it into a demo instead.
Additionally, a demo is added for the first example in comment #0.

(file #38107)

Markus Mützel <mmuetzel>
Group administrator
Tue 02 Aug 2016 03:09:09 AM UTC, comment #3: 

OK, thanks.

I'd say isosurface is good.  It currently only has a couple demos, and the second demo is kind of uneventful.  It looks like four dark green patches--at least until rotating the individual plots with Qt toolkit where the different color assignments can be seen.  Perhaps we should choose a different viewing angle, such as in the attached screen shot.  Note that when I rotate those four subplots, it appears there is still some kind of lighting effect going on.  Is that a holdover from the first demo?  Can't read the small font in the note in the upper left corner.


Dan Sebald <sebald>
Mon 01 Aug 2016 11:39:11 AM UTC, comment #2: 

I can confirm that your changeset fixes the examples for me.

Wrt new demos:
The second example is essentially what "demo surface 1" produces since hg-id e50536734855.
Should I prepare a changeset for the first example and post it here? Or should I open a new bug report for that? Should it better be added to isosurface.m as well or to patch.m like you suggested?

Markus Mützel <mmuetzel>
Group administrator
Sat 30 Jul 2016 03:47:56 PM UTC, comment #1: 

Nice examples.  Consider adding as two separate demos to the patch routine.  The mid-range color is valuable because it is easy to have the color range computation incorrect and still end up with extremal values (in this case purple and yellow).

Attached is a simple change that seems to work.  I understand what the code is doing, but of course there are so many property values and scenarios that I'm not sure this covers everything.  But, I too wonder why if there is a color value available why it should not be used in preference for the z-coordinates.


(file #38053)

Dan Sebald <sebald>
Mon 25 Jul 2016 03:06:39 PM UTC, original submission:  

The following example produces an isosurface of a sphere with the "center color" (a blue-ish green) of the current colormap with qt and fltk and in Matlab:

figure ();
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
val = x.^2 + y.^2 + z.^2;
iso = 1;
fvc = isosurface (x, y, z, val, iso);
hp = patch (fvc, 'FaceColor', 'flat', 'FaceVertexCData', iso);
view (3);


With gnuplot, the sphere has no uniform color. Instead, the z-value (?) is used for coloring the patches.

The following example gives two nested spheres with qt and fltk and in Matlab. The inner one in violet the outer one in yellow (=edges of the default colormap):

figure ();
[x,y,z] = meshgrid (-2:0.5:2, -2:0.5:2, -2:0.5:2);
val = x.^2 + y.^2 + z.^2;
iso = 3;
fvc3 = isosurface (x, y, z, val, iso);
hp3 = patch (fvc3, 'FaceColor', 'flat', 'FaceVertexCData', iso);
iso = 5;
fvc5 = isosurface (x, y, z, val, iso);
hp5 = patch (fvc5, 'FaceColor', 'flat', 'FaceVertexCData', iso);
view (3)


Both spheres are violet with gnuplot.

Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

 

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 sebald (Updated the item)
  • -email is unavailable- added by mmuetzel (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
    2016-08-11 rik5 Open/ClosedOpen Closed
    2016-08-09 rik5 StatusNone Fixed
    2016-08-04 mmuetzel Attached File- Added bug48626_isosurface_demos.patch, #38107
    2016-08-02 sebald Attached File- Added Screenshot from 2016-08-01 22:06:24.png, #38073
    2016-07-30 sebald Attached File- Added octave-gnuplot_patch_broadcast-djs2016jul30.patch, #38053

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code