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

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

[Octave-bug-tracker] [bug #65641] 'view' produces incorrect viewpoint wh


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #65641] 'view' produces incorrect viewpoint when given a vector aligned with the X axis
Date: Fri, 26 Apr 2024 00:01:40 -0400 (EDT)

Follow-up Comment #22, bug #65641 (group octave):

yes, regarding neg 0 matlab does still preserve that:

matlab 2023b:

>> x = -0
x =
     0
>> x=1/x
x =
  -Inf
>> x=1/x
x =
     0


same in octave.

a little compatibility test in matlab with 1/x's to check for all main axis
viewpoints and include the -0 cases:

idx = 1;
for x1 = [-1, -0, 1, 0]
  for x2 = [-1, -0, 1, 0]
    for x3 = [-1, -0, 1, 0]
      if (([x1,x2,x3]==[0,0,0]))
       az = NaN;
       el = NaN;
      else
        view([x1,x2,x3]);
        [az, el]=view();
      end
      output(idx,:) = [x1, x2, x3, 1/x1, 1/x2, 1/x3, az, el, 1/az, 1/el];
      idx = idx + 1;
    end
  end
end


produces:

output =
    -1.0000    -1.0000    -1.0000    -1.0000    -1.0000    -1.0000   -45.0000 
 -35.2644    -0.0222    -0.0284
    -1.0000    -1.0000          0    -1.0000    -1.0000       -Inf   -45.0000 
        0    -0.0222       -Inf
    -1.0000    -1.0000     1.0000    -1.0000    -1.0000     1.0000   -45.0000 
  35.2644    -0.0222     0.0284
    -1.0000    -1.0000          0    -1.0000    -1.0000        Inf   -45.0000 
        0    -0.0222        Inf
    -1.0000          0    -1.0000    -1.0000       -Inf    -1.0000   -90.0000 
 -45.0000    -0.0111    -0.0222
    -1.0000          0          0    -1.0000       -Inf       -Inf   -90.0000 
        0    -0.0111       -Inf
    -1.0000          0     1.0000    -1.0000       -Inf     1.0000   -90.0000 
  45.0000    -0.0111     0.0222
    -1.0000          0          0    -1.0000       -Inf        Inf   -90.0000 
        0    -0.0111        Inf
    -1.0000     1.0000    -1.0000    -1.0000     1.0000    -1.0000  -135.0000 
 -35.2644    -0.0074    -0.0284
    -1.0000     1.0000          0    -1.0000     1.0000       -Inf  -135.0000 
        0    -0.0074       -Inf
    -1.0000     1.0000     1.0000    -1.0000     1.0000     1.0000  -135.0000 
  35.2644    -0.0074     0.0284
    -1.0000     1.0000          0    -1.0000     1.0000        Inf  -135.0000 
        0    -0.0074        Inf
    -1.0000          0    -1.0000    -1.0000        Inf    -1.0000   -90.0000 
 -45.0000    -0.0111    -0.0222
    -1.0000          0          0    -1.0000        Inf       -Inf   -90.0000 
        0    -0.0111       -Inf
    -1.0000          0     1.0000    -1.0000        Inf     1.0000   -90.0000 
  45.0000    -0.0111     0.0222
    -1.0000          0          0    -1.0000        Inf        Inf   -90.0000 
        0    -0.0111        Inf
          0    -1.0000    -1.0000       -Inf    -1.0000    -1.0000          0 
 -45.0000       -Inf    -0.0222
          0    -1.0000          0       -Inf    -1.0000       -Inf          0 
        0       -Inf       -Inf
          0    -1.0000     1.0000       -Inf    -1.0000     1.0000          0 
  45.0000       -Inf     0.0222
          0    -1.0000          0       -Inf    -1.0000        Inf          0 
        0       -Inf        Inf
          0          0    -1.0000       -Inf       -Inf    -1.0000          0 
 -90.0000        Inf    -0.0111
          0          0          0       -Inf       -Inf       -Inf        NaN 
      NaN        NaN        NaN
          0          0     1.0000       -Inf       -Inf     1.0000          0 
  90.0000        Inf     0.0111
          0          0          0       -Inf       -Inf        Inf        NaN 
      NaN        NaN        NaN
          0     1.0000    -1.0000       -Inf     1.0000    -1.0000  -180.0000 
 -45.0000    -0.0056    -0.0222
          0     1.0000          0       -Inf     1.0000       -Inf  -180.0000 
        0    -0.0056       -Inf
          0     1.0000     1.0000       -Inf     1.0000     1.0000  -180.0000 
  45.0000    -0.0056     0.0222
          0     1.0000          0       -Inf     1.0000        Inf  -180.0000 
        0    -0.0056        Inf
          0          0    -1.0000       -Inf        Inf    -1.0000          0 
 -90.0000        Inf    -0.0111
          0          0          0       -Inf        Inf       -Inf        NaN 
      NaN        NaN        NaN
          0          0     1.0000       -Inf        Inf     1.0000          0 
  90.0000        Inf     0.0111
          0          0          0       -Inf        Inf        Inf        NaN 
      NaN        NaN        NaN
     1.0000    -1.0000    -1.0000     1.0000    -1.0000    -1.0000    45.0000 
 -35.2644     0.0222    -0.0284
     1.0000    -1.0000          0     1.0000    -1.0000       -Inf    45.0000 
        0     0.0222       -Inf
     1.0000    -1.0000     1.0000     1.0000    -1.0000     1.0000    45.0000 
  35.2644     0.0222     0.0284
     1.0000    -1.0000          0     1.0000    -1.0000        Inf    45.0000 
        0     0.0222        Inf
     1.0000          0    -1.0000     1.0000       -Inf    -1.0000    90.0000 
 -45.0000     0.0111    -0.0222
     1.0000          0          0     1.0000       -Inf       -Inf    90.0000 
        0     0.0111       -Inf
     1.0000          0     1.0000     1.0000       -Inf     1.0000    90.0000 
  45.0000     0.0111     0.0222
     1.0000          0          0     1.0000       -Inf        Inf    90.0000 
        0     0.0111        Inf
     1.0000     1.0000    -1.0000     1.0000     1.0000    -1.0000   135.0000 
 -35.2644     0.0074    -0.0284
     1.0000     1.0000          0     1.0000     1.0000       -Inf   135.0000 
        0     0.0074       -Inf
     1.0000     1.0000     1.0000     1.0000     1.0000     1.0000   135.0000 
  35.2644     0.0074     0.0284
     1.0000     1.0000          0     1.0000     1.0000        Inf   135.0000 
        0     0.0074        Inf
     1.0000          0    -1.0000     1.0000        Inf    -1.0000    90.0000 
 -45.0000     0.0111    -0.0222
     1.0000          0          0     1.0000        Inf       -Inf    90.0000 
        0     0.0111       -Inf
     1.0000          0     1.0000     1.0000        Inf     1.0000    90.0000 
  45.0000     0.0111     0.0222
     1.0000          0          0     1.0000        Inf        Inf    90.0000 
        0     0.0111        Inf
          0    -1.0000    -1.0000        Inf    -1.0000    -1.0000          0 
 -45.0000        Inf    -0.0222
          0    -1.0000          0        Inf    -1.0000       -Inf          0 
        0        Inf       -Inf
          0    -1.0000     1.0000        Inf    -1.0000     1.0000          0 
  45.0000        Inf     0.0222
          0    -1.0000          0        Inf    -1.0000        Inf          0 
        0        Inf        Inf
          0          0    -1.0000        Inf       -Inf    -1.0000          0 
 -90.0000        Inf    -0.0111
          0          0          0        Inf       -Inf       -Inf        NaN 
      NaN        NaN        NaN
          0          0     1.0000        Inf       -Inf     1.0000          0 
  90.0000        Inf     0.0111
          0          0          0        Inf       -Inf        Inf        NaN 
      NaN        NaN        NaN
          0     1.0000    -1.0000        Inf     1.0000    -1.0000   180.0000 
 -45.0000     0.0056    -0.0222
          0     1.0000          0        Inf     1.0000       -Inf   180.0000 
        0     0.0056       -Inf
          0     1.0000     1.0000        Inf     1.0000     1.0000   180.0000 
  45.0000     0.0056     0.0222
          0     1.0000          0        Inf     1.0000        Inf   180.0000 
        0     0.0056        Inf
          0          0    -1.0000        Inf        Inf    -1.0000          0 
 -90.0000        Inf    -0.0111
          0          0          0        Inf        Inf       -Inf        NaN 
      NaN        NaN        NaN
          0          0     1.0000        Inf        Inf     1.0000          0 
  90.0000        Inf     0.0111
          0          0          0        Inf        Inf        Inf        NaN 
      NaN        NaN        NaN


octave produces different results for the following rows:

octave:

܀ans =

          0          0    -1.0000       -Inf       -Inf    -1.0000  -180.0000 
 -90.0000    -0.0056    -0.0111
          0          0     1.0000       -Inf       -Inf     1.0000  -180.0000 
  90.0000    -0.0056     0.0111
          0          0    -1.0000       -Inf        Inf    -1.0000          0 
 -90.0000       -Inf    -0.0111
          0          0     1.0000       -Inf        Inf     1.0000          0 
  90.0000       -Inf     0.0111
          0          0    -1.0000        Inf       -Inf    -1.0000   180.0000 
 -90.0000     0.0056    -0.0111
          0          0     1.0000        Inf       -Inf     1.0000   180.0000 
  90.0000     0.0056     0.0111


for which matlab produces:

 ꖜ଀
         0         0   -1.0000      -Inf      -Inf   -1.0000         0 
-90.0000       Inf   -0.0111
         0         0    1.0000      -Inf      -Inf    1.0000         0  
90.0000       Inf    0.0111
         0         0   -1.0000      -Inf       Inf   -1.0000         0 
-90.0000       Inf   -0.0111
         0         0    1.0000      -Inf       Inf    1.0000         0  
90.0000       Inf    0.0111
         0         0   -1.0000       Inf      -Inf   -1.0000         0 
-90.0000       Inf   -0.0111
         0         0    1.0000       Inf      -Inf    1.0000         0  
90.0000       Inf    0.0111



so, for [+/-0, +/-0, +/-1] case, only [+0, +0, +/-1] is correct. the azimuth
is flipped 180deg when y is -0, and the sign should match the size of x.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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