bugGNU Octave - Bugs: bug #63582, Octave patch function accepts one...

 
 

bug #63582: Octave patch function accepts one incorrect input form and produces incorrect result.

Submitter:  Liang Tang <lt1234>
Submitted:  Tue 27 Dec 2022 08:11:47 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Closed
Release:  * 7.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 29 Dec 2022 10:55:52 AM UTC, comment #5: 

`1` isn't replaced by `[1 1 1]`. In your example, it is scaled into the colormap of the parent axes of the patch being created.

See the documentation for that property here:
https://docs.octave.org/interpreter/Patch-Properties.html

Markus Mützel <mmuetzel>
Group administrator
Thu 29 Dec 2022 10:51:38 AM UTC, comment #4: 

Hi Markus,

When I used patch in the past,  it was mainly for 2-D.  So I never noticed that the specification of patch must include color.  In the same time, I am unaware of any other geometry related function require the same.  This combination trapped me into double/triple checking everything else, not knowing that a single 1 seems to be interpreted as [1 1 1]. 

Thanks,

Liang Tang <lt1234>
Thu 29 Dec 2022 10:28:25 AM UTC, comment #3: 

The example in comment #0 corresponds to a shorthand form of basically this:

h4=patch('xdata',x, 'ydata',y, 'facecolor', 'flat', 'cdata', z(:));


This is valid input.

Markus Mützel <mmuetzel>
Group administrator
Thu 29 Dec 2022 10:21:17 AM UTC, comment #2: 

The code as it is today does check for if facecolor specification meet the acceptable/allowable  internal color format.  For my incorrect input, the value of a single 1 does not match the three digit color map format.  My original post is actually to request for an existing check being made. 

The two lines below show the z in my example does not meet some check you already have.

h3=patch('xdata',x, 'ydata',y, 'facecolor',[1 0 0]);  % works
h4=patch('xdata',x, 'ydata',y, 'facecolor',z      );  % error: _go_patch_: invalid value for color property "facecolor"

Thanks,

Liang Tang <lt1234>
Thu 29 Dec 2022 09:07:21 AM UTC, comment #1: 

I don't think there is a way to distinguish this programmatically from `patch(x, y, c)` where `c` is a color value (indexing into the current colormap for the parent axes) for each vertex.

Closing as invalid.

Markus Mützel <mmuetzel>
Group administrator
Tue 27 Dec 2022 08:11:47 PM UTC, original submission:  


>> which patch

'patch' is a function from the file C:\Octave\Octave-7.1.0\mingw64\share\octave\7.1.0\m\plot\draw\patch.m

The correct syntax for 3-D patch is patch(x,y,z,color).  I used patch(x,y,z) instead.  This is an incorrect input. 

There is no error or waning message from this incorrect input. I think there should be an error message for this wrong input.   

The code did not reject my input and subsequently produced wrong results.  For the example below, zdata was set to [] when color is absent.  The input patch did not display for this example.  In other cases, Octave might show patch at zero z. 


x = [1, 1, 0, 0, 1];
y = [0, 1, 1, 0, 0];
z = [1, 1, 1, 1, 1];
f = figure(1); 
% correct input
h1=patch(x, y, z, 'b'); get(h1, 'zdata'),
hold on;
% incorrect input
h2=patch(x, y, z     ); get(h2, 'zdata') 

Thanks. 

Liang Tang <lt1234>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by lt1234 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-29 mmuetzel StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code