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

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

[Octave-bug-tracker] [bug #54922] demo surfl 1 fails


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #54922] demo surfl 1 fails
Date: Fri, 2 Nov 2018 13:04:01 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0

Follow-up Comment #6, bug #54922 (project octave):

Here the results with Matlab R2016a for a surface object:

>> format compact
>> clf;
>> Z = peaks ();
>> h = surf (Z, 'facelighting', 'none');
>> get (h, 'facelighting')
ans =
none
>> isempty(get (h, 'vertexnormals'))
ans =
     0
>> set (h, 'facelighting', 'gouraud')
>> isempty(get (h, 'vertexnormals'))
ans =
     0
>> hl = light ();
>> isempty(get (h, 'vertexnormals'))
ans =
     0


And for the sake of completeness with flat lighting:

>> clf;
>> Z = peaks ();
>> h = surf (Z, 'facelighting', 'none');
>> get (h, 'facelighting')
ans =
none
>> isempty(get (h, 'facenormals'))
ans =
     0
>> set(h, 'facelighting', 'flat')
>> isempty(get (h, 'facenormals'))
ans =
     0
>> hl = light ();
>> isempty(get (h, 'facenormals'))
ans =
     0


Similarly, for a patch object:

>> clf;
>> h = patch('facelighting', 'none');
>> get (h, 'facelighting')
ans =
none
>> isempty(get (h, 'vertexnormals'))
ans =
     1
>> set (h, 'facelighting', 'gouraud')
>> isempty(get (h, 'vertexnormals'))
ans =
     1
>> hl = light ();
>> drawnow
>> isempty(get (h, 'vertexnormals'))
ans =
     0


And with flat lighting:

>> clf;
>> h = patch('facelighting', 'none');
>> get (h, 'facelighting')
ans =
none
>> isempty(get (h, 'facenormals'))
ans =
     1
>> set(h, 'facelighting', 'flat')
>> isempty(get (h, 'facenormals'))
ans =
     1
>> hl = light ();
>> drawnow
>> isempty(get (h, 'facenormals'))
ans =
     0


So it looks like that delayed calculation of normals only applies to patch
objects. Both kinds of normals seem to be calculated for surfaces
immediately.

Calculating the normals for surfaces is easier because all vertices are on a
regular grid (no self-intersection, ...). The logic involved for patches is
more complex. That might be a motivation for the difference in behavior.
Is this what we want to do as well? If yes, I can try to create a patch over
the weekend.

This would also fix surfl without any further changes to the function itself.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54922>

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




reply via email to

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