bugGNU Octave - Bugs: bug #50361, [octave forge] (geometry)...

 
 

bug #50361: [octave forge] (geometry) Incorrect result in intersectLinePlane function

Submitter:  None
Submitted:  Mon 20 Feb 2017 03:16:09 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Mike Bloom Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 13 Aug 2017 09:51:24 PM UTC, comment #5: 

@devs: Please close this bug.

Juan Pablo Carbajal <juanpi>
Group Member
Tue 21 Mar 2017 06:20:06 PM UTC, comment #4: 

Hi,

It wasn't a problem with argument checking but actually a bug on the origina code.

When function cross is used, the dimension is not specified (should be 2) and then when the input is 3x3 the 1st dimension was used instead of the 2nd.

I grep for 'cross[[:space:]]*\([[:alum:]]+,[[:space:]]*[[:alum:]]+\)' and found some functions that still call cross without specifying dimension, which are potential bugs. However these functions are not yet added to geometry.

@devs: Please close this bug.

Juan Pablo Carbajal <juanpi>
Group Member
Mon 06 Mar 2017 08:00:02 PM UTC, comment #3: 

Hi,

Yes, geometry is not doing a lot of checking regarding the inputs. It assumes that data is always in columns. I will fix this.

Thanks for the reports.

Juan Pablo Carbajal <juanpi>
Group Member
Mon 06 Mar 2017 03:09:50 PM UTC, comment #2: 

Original poster here.  I believe I also found an identical issue with the function normalizePlane on line 51.  Again the dimension 2 is not specified in the cross function.  So when you pass 3 inputs are row vectors the cross product is calculated on dim 1 instead of 2.  There are other instances where dimension of 2 is specified so I think it has been omitted in this function and the original posted one.

Mike Bloom <mbloom>
Mon 20 Feb 2017 03:37:51 PM UTC, comment #1: 

cc'ing package maintainer.

Setting release -> other, OS -> any

Philip Nienhuis <philipnienhuis>
Group Member
Mon 20 Feb 2017 03:16:09 PM UTC, original submission:  

Hi all,

I noticed an error with the result of the intersectLinePlane function in the geometry package when the inputs are 3 lines and 3 planes.  This code reproduces the issue:


line = [1611.1586, 384.0586, 175.7812, -18.5273, -12.4366, 2.9297; ...
  1708.1188, 453.5282, 136.7188, -14.9586, -11.1981, 2.4414; ...
  1782.0696, 511.4073, 241.6992, -2.9366, -2.3760, -46.3867];

plane = [1.6233e+003, 3.9252e+002, 1.0000e+002, 0.0000e+000, -3.8123e-005, -1.0000e+000, -5.6653e-001, 8.2404e-001, -3.1415e-005; ...
  1.7045e+003, 4.5089e+002, 9.9996e+001, 0.0000e+000, -1.5495e-005, -1.0000e+000, -5.9962e-001, 8.0028e-001, -1.2401e-005; ...
  1.7833e+003, 5.1241e+002, 9.9998e+001, 0.0000e+000, 3.9994e-005, -1.0000e+000, -6.1524e-001, 7.8834e-001, 3.1528e-005];

incorrectResult = intersectLinePlane(line, plane);

for i=1:3
  correctResult(i,:) = intersectLinePlane(line(i, :), plane(i, :));
end


Looking at the function code, the problem seems to lie with line 82.  The function should always be done along dim 2, but when a 3x3 matrix is provided it incorrectly is done on dim 1.  Adding dim argument of 2 corrects the issue.

I attached the code to reproduce and the corrected function.  Thanks

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #39800:  bugReproduce.m added by None (759B - application/octet-stream)
file #39801:  intersectLinePlane.m added by None (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by mbloom (Posted a comment)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by None (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-16 juanpi StatusNone Fixed
    2017-08-14 jwe Open/ClosedOpen Closed
    2017-08-12 jwe SummaryIncorrect result in geometry package intersectLinePlane function [octave forge] (geometry) Incorrect result in intersectLinePlane function
    2017-02-20 philipnienhuis Release4.2.0 other
        Operating SystemMicrosoft Windows Any
        Carbon-Copy- Added -email is unavailable-
    2017-02-20 None Attached File- Added bugReproduce.m, #39800
        Attached File- Added intersectLinePlane.m, #39801

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code