bugGNU Octave - Bugs: bug #48392, "shading" converts mesh...

 
 

bug #48392: "shading" converts mesh to surf

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Sun 03 Jul 2016 07:32:11 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
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

Mon 22 Aug 2016 04:17:56 PM UTC, comment #8: 

I made a few changes to the patch and then pushed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/0b2edd6408be).  We're getting very close to Matlab compatibility with OpenGL graphics which is just great.

Rik <rik5>
Group administrator
Mon 18 Jul 2016 08:36:26 PM UTC, comment #7: 

The attached patch includes the feedback and bugfixes by Rik from patch #9040 "lighting".

(file #37941)

Markus Mützel <mmuetzel>
Group administrator
Tue 05 Jul 2016 05:45:43 PM UTC, comment #6: 

Yes, I think it is an improvement in the right direction.  It's hard to get this exactly right until users explore all the corner cases.

With regard to the transparent background, I have a mod for that in some other bug report:

https://savannah.gnu.org/bugs/?48200
https://savannah.gnu.org/bugs/download.php?file_id=37532

It allows a background of 'none' and fixes a bug if there are no handle elements for properties.  We wondered why exactly the background color is changed to white when printing to a hardcopy, but I think in any case one should be able to turn off the background with 'none'.

Dan Sebald <sebald>
Tue 05 Jul 2016 05:32:14 PM UTC, comment #5: 

Dan, to be on the save side with the axes' parent, I added a check whether "color" is one of its properties.

With the aforementioned change: Is the patch OK for you to be applied?

I agree that the black figure looks like a bug in Matlab. When saving the figure with background color 'none' to a png, the background is white (not transparent). But this might also be due to the Matlab bug mentioned in [1].
I am tempted to not file a bug about this because I prefer Octave's current behavior.

[1] https://de.mathworks.com/matlabcentral/newsreader/view_thread/243116

(file #37722)

Markus Mützel <mmuetzel>
Group administrator
Mon 04 Jul 2016 05:47:11 PM UTC, comment #4: 


> Is it ok to assume that this is the figure?


If the axes are accessed via the figure, then probably true.  But generally speaking (and how likely the case is that the user constructed some strange arrangement), I don't know.  What you've done though, i.e., use "parent" property, seems most logical.


> renders the figure background black in Matlab


Strange.  Seems buggish, or maybe it was intended to show that something is present but invisible?

Dan Sebald <sebald>
Mon 04 Jul 2016 10:29:18 AM UTC, comment #3: 

Dan, thank you for your feedback.

With respect to your first point, this is absolutly true and you describe what Matlab seems to do as well. I haven't thought of this before. With the attached patch, is_mesh is determined by comparing the "FaceColor" in the following order:
1- If it is the same as the "Color" property of the parent axes --> is_mesh
2- If the parent axes has "Color" set to "none" -> Compare to the "Color" property of the axes' parent. Is it ok to assume that this is the figure?
3- If the figure has "Color" set to "none" as well -> Compare to [1 1 1] (= white).

In the last step there is a discrepancy to Matlab: Setting the "Color" property to "none" renders the figure background black in Matlab but white in Octave. If this is a bug at all, it is a different one. I will file another report on this, and we can decide whether we should act on this or not. Personally, I find Octave's behavior better...

With respect to your second comment: Matlab seems to overwrite "EdgeColor" when there is "no facecolor" and set it to "none", too. Shading does (and did) the same in Octave wrt this.
I modified the test to explicitly check this as well.

(file #37702)

Markus Mützel <mmuetzel>
Group administrator
Sun 03 Jul 2016 10:47:26 PM UTC, comment #2: 

Thanks Markus.  Why would a white face color be treated as "no surface"?  Couldn't someone select a background color other than white and have the surface white?

Also, the facecolor and edgecolor are independent.  So it could be that there is both a face and an edge.  Say that is the case, then


+  set (hlist(!is_mesh), "facecolor", mode, "edgecolor", ec);


may be turning off the edge.  Is that correct behavior?

Dan Sebald <sebald>
Sun 03 Jul 2016 07:43:24 PM UTC, comment #1: 

Here the patch that also adds more demos and some tests.

(file #37691)

Markus Mützel <mmuetzel>
Group administrator
Sun 03 Jul 2016 07:32:11 PM UTC, original submission:  

When calling "shading flat" or "shading interp" for a mesh plot, it gets converted to a surf plot in Octave. E.g.:

hm = mesh (sombrero ());
shading interp


In Matlab, "shading flat" or "shading interp" changes the "EdgeColor" property for mesh plots instead of the "FaceColor" property.

I will attach a patch as soon as I have the bug number.

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:
   

Attached Files
file #37941:  shading_mesh_v4.patch added by mmuetzel (5KiB - text/x-diff)
file #37722:  shading_mesh_v3.patch added by mmuetzel (5KiB - text/x-diff)
file #37702:  shading_mesh_v2.patch added by mmuetzel (4KiB - text/x-diff)
file #37691:  shading_mesh.patch added by mmuetzel (4KiB - text/x-diff)

 

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 lachlan (Updated the item)
  • -email is unavailable- added by sebald (Posted a comment)
  • -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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-22 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2016-07-18 mmuetzel Attached File- Added shading_mesh_v4.patch, #37941
    2016-07-05 mmuetzel Attached File- Added shading_mesh_v3.patch, #37722
    2016-07-04 mmuetzel Attached File- Added shading_mesh_v2.patch, #37702
    2016-07-03 lachlan StatusPatch Submitted In Progress
    2016-07-03 lachlan StatusNone Patch Submitted
    2016-07-03 mmuetzel Attached File- Added shading_mesh.patch, #37691

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code