[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #40970] inpolygon incompatibility (Octave and
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #40970] inpolygon incompatibility (Octave and Matlab disagrees about points on edges) |
Date: |
Thu, 19 Dec 2013 11:37:58 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0 |
URL:
<http://savannah.gnu.org/bugs/?40970>
Summary: inpolygon incompatibility (Octave and Matlab
disagrees about points on edges)
Project: GNU Octave
Submitted by: None
Submitted on: Thu 19 Dec 2013 11:37:57 AM UTC
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: Anders A. Søndergaard
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 3.6.4
Operating System: GNU/Linux
_______________________________________________________
Details:
The inpolygon function in Matlab returns 1 if a point is inside
a polygon __or on the edge of it__.
In Octave, inpolygon only returns 1 if the point is strictly inside the
polygon, and 0 if it is on the edge.
The following function demonstrates the incompatibility
function octavematlab()
xs = [0,1,2]; % Triangle from 0,0 to 1,1 and 2,0
ys = [0,1,0];
inmatlab = inpolygon(1,1,xs,ys); % Is the vertex 1,1 in the polygon?
if inmatlab
disp('Hello from Matlab!');
else
disp('Hello from Octave!');
end
xs = [0,1,1,0]; % Rectangle from 0,0 to 1,1
ys = [1,1,0,0];
if (inpolygon(0.5,1,xs,ys)) % Is a point on an edge in the polygon?
disp('Edge is inside polygon');
else
disp('Edge is outside polygon');
end
When called from matlab, the result is
Hello from Matlab!
Edge is inside polygon
When called from Octave:
Hello from Octave!
Edge is outside polygon
Anders Søndergaard
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40970>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #40970] inpolygon incompatibility (Octave and Matlab disagrees about points on edges),
anonymous <=