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

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

[Octave-bug-tracker] [bug #55180] surfl errors on valid 4x4 input matrix


From: Rik
Subject: [Octave-bug-tracker] [bug #55180] surfl errors on valid 4x4 input matrix
Date: Fri, 7 Dec 2018 11:30:27 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063

URL:
  <https://savannah.gnu.org/bugs/?55180>

                 Summary: surfl errors on valid 4x4 input matrix
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Fri 07 Dec 2018 08:30:26 AM PST
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Valid calling form for surfl is


surfl (Z)


where Z is a 2-D real matrix.

However, this fails when Z has four columns


Z = rand (4,4);
surfl (Z)
error: varargin(0): subscripts must be either integers 1 to (2^63)-1 or
logicals
error: called from
    surfl at line 122 column 3


Trouble seems to be in the input validation here


  ## Check for reflection properties argument.
  ##
  ## r = [ambient light strength,
  ##      diffuse reflection strength,
  ##      specular reflection strength,
  ##      specular shine]
  if (isnumeric (varargin{end}) && length (varargin{end}) == 4)
    r = varargin{end};
    varargin(end) = [];
  else
    ## Default values.
    r = [0.55, 0.6, 0.4, 10];
  endif


At the very least, should be checking for a 1x4 vector.  This would prevent
misinterpretation of an array that happens to have number of rows or number of
columns equal to 4.

The input validation for light vector should also be checked because it might
have the same issues.






    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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