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

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

[Octave-bug-tracker] [bug #55895] __go_patch__ fails when NaN vertices e


From: Eddy
Subject: [Octave-bug-tracker] [bug #55895] __go_patch__ fails when NaN vertices exist
Date: Sat, 16 Mar 2019 12:06:32 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #4, bug #55895 (project octave):

Thanks for the clarification.

In the attached patch, I skipped coplanar test when any of the face vertex
contain NaN or Inf, matches the original behavior.

I checked the implementation `opengl_renderer::draw_patch` in gl-render.cc.
The coplanar test results (in `coplanar_last_idx`) are used in this way:


  // nf = number of faces/polygon
  for (int i = 0; i < nf; i++)
    {
      if (clip_f(i))
        continue;

      bool is_non_planar = false;
      if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1)
        {
          is_non_planar = true;
          ...
        }
      ...
    }
  ...
  for (int i = 0; i < nf; i++)
    {
      bool is_non_planar = false;
      if (props.coplanar_last_idx.size () > 0 && (*it1).size () > 1)
        is_non_planar = true;
      if (clip_f(i) || is_non_planar)
        {
          // This is an unclosed contour or a non-planar face.
          // Draw it as a line.
         ...
      ...
    }


In both for-loop, whenever clip_f(i) == true (face `i` is unclosed contour,
i.e. contain NaN or Inf vertex), `is_non_planar` is then useless. In other
words, an "unclosed contour" is distinct from a face (planar or non-planar),
only the face need coplanar test. This also justifies my patch.

A separate but related issue, in `opengl_renderer::draw_patch`, it seems that
the coplanar test results are not properly used sometimes. Can be observed
like this:


clf;
v = [0 0 0; 1 0 0; 1 1 0; 0 1 0; 0 1 1; 0 0 1;];
f = [1:4; 3:6];  % buggy patch
%f = [3:6; 1:4];  % correct patch
patch ('Vertices', v, 'Faces', f, 'FaceColor', 'g');


Should I fix that also?

(file #46557)
    _______________________________________________________

Additional Item Attachment:

File name: bug55895_allow_nan.patch       Size:7 KB
    <https://savannah.gnu.org/file/bug55895_allow_nan.patch?file_id=46557>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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