octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53958] 'light' function not working for patch


From: Rik
Subject: [Octave-bug-tracker] [bug #53958] 'light' function not working for patch objects
Date: Wed, 23 May 2018 17:14:12 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #53958 (project octave):

              Item Group:        Incorrect Result => Matlab Compatibility   
                  Status:                    None => Confirmed              
                 Summary: 'light' function not working for some plots =>
'light' function not working for patch objects

    _______________________________________________________

Follow-up Comment #1:

I've simplified things further.  There is now just a single data file,
patch.mat, and a single test file, tst_light.m.  Both are attached to this bug
report.

Have you looked at the help text for light?  It seems that you need to supply
the vertex normals when you are working with patch objects, as opposed to
surface objects.


     Create a light object in the current axes or for axes HAX.

     When a light object is present in an axes object, and the
     properties "EdgeLighting" or "FaceLighting" of a 'patch' or
     'surface' object are set to a value other than "none", these
     objects are drawn with light and shadow effects.  Supported values
     for Lighting properties are "none" (no lighting effects), "flat"
     (faceted look of the objects), and "gouraud" (linear interpolation
     of the lighting effects between the vertices).  For 'patch'
     objects, the normals must be set manually (property
     "VertexNormals").


The VertexNormals property for patch objects is controlled by the 
VertexNormalsMode property.  You might try the following in Matlab.


close all
load ('patch.mat')
p = patch (fv, 'VertexNormalsMode', 'manual');
vn = get (p, 'VertexNormals')  % Is this empty?
light (gca)
view (gca, 3)


Alternatively, you could grab the vertexnormals and later use them in Octave


close all
load ('patch.mat')
p = patch (fv);
vn = get (p, 'VertexNormals');
save vn.mat vn


And then in Octave


close all
load patch.mat
load vn.mat
p = patch (hax, fv, 'FaceAlpha', 1.0, 'FaceColor', 'r', 'EdgeColor', 'none');
set (p, 'VertexNormals', vn);
light (gca);
view (gca, 3);




(file #44203, file #44204)
    _______________________________________________________

Additional Item Attachment:

File name: patch.mat                      Size:13 KB
File name: tst_light.m                    Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53958>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]