bugGNU Octave - Bugs: bug #57537, lighting exits with error when...


bug #57537: lighting exits with error when scatter combination is used

Submitted by:  Hg200 <hg200>
Submitted on:  Sat 04 Jan 2020 10:09:12 AM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  other Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


Tue 07 Jan 2020 05:47:04 PM UTC, comment #4: 

thanks for providing the patch.

i didn't know we can have axes as subobject of (example) a hggroup. i was able to create a test code which tests also the mentioned code line
=> the updated patch is fully tested and works fine.

Hg200 <hg200>
Mon 06 Jan 2020 08:58:54 PM UTC, comment #3: 

I eliminated the for loop, and also the temporary variable "tmp", in this cset: https://hg.savannah.gnu.org/hgweb/octave/rev/4a30a58a44ab.

The restriction to axes is because we only want to traverse down the tree of graphic objects in to ones that might contain a patch or surface object.  That would either be an axes or an hggroup.

Rik <rik5>
Project Administrator
Mon 06 Jan 2020 04:30:14 PM UTC, comment #2: 

i think you can collect kids directly without collecting the parents (see below). this removes one complete loop.

i have one question: why do we need the line "parents = kids(strcmp (types, "axes"))"? i am not able to create an example returning a valid handle there. can we assume this line always return arrays instead of cells?

  hlist = [];
  kids = get (hax, "children");
  while (! isempty (kids))
    types = get (kids, "type");
    hlist = [hlist; kids(strcmp(types, "patch"))];
    hlist = [hlist; kids(strcmp(types, "surface"))];
    parents = kids(strcmp (types, "axes"));
    hglist = kids(strcmp (types, "hggroup"));
    kids = get (parents, "children");
    for i = 1 : numel (hglist)
      props = get (hglist(i));
      if (! isfield (props, "levelstep"))
        tmp = get (hglist(i), "children");
        kids = [kids; tmp];

Hg200 <hg200>
Mon 06 Jan 2020 03:53:27 PM UTC, comment #1: 
Rik <rik5>
Project Administrator
Sat 04 Jan 2020 10:09:12 AM UTC, original submission:  

execution of

hold on;
h1 = scatter3 (1, 0, 0, 20);
h2 = scatter3 ([2,3], [0,0], [0,0], 20);
lighting gouraud;

returns with an error but shouldn't. it should be allowed to add scatter objects also to patch plots when lighting is used. patch objects can be added to the code above but it does not have an effect. tested with 5.1 on windows and on linux with 2b78bc0ef3c5.

in lighting.m patch and surface handles are isolated to apply lighting on those objects only. it looks like the code gets confused because get (parents, "children") can return a cell but then get (kids, "type") exits with error because it is not a graphics handle.

Hg200 <hg200>


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

Attach Files:

No files currently attached


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)

    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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-06 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5