[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49851] Plot error when using geometry functio
From: |
Andrew |
Subject: |
[Octave-bug-tracker] [bug #49851] Plot error when using geometry functions |
Date: |
Thu, 15 Dec 2016 13:21:21 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36 OPR/36.0.2130.80 |
URL:
<http://savannah.gnu.org/bugs/?49851>
Summary: Plot error when using geometry functions
Project: GNU Octave
Submitted by: simulsys
Submitted on: Thu 15 Dec 2016 01:21:20 PM GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Andrew
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.3
Operating System: Microsoft Windows
_______________________________________________________
Details:
Hi,
I have a bug which plots the points of intersection incorrectly. Here is the
requested code:
#BEESWAX6 for Oilseed Rape fields
# AJL 20161008
#package loads
#pkg load geometry
#pkg load mapping
clear all
#constants
beehiverange=2.5;
fieldblock= [
[1,0.,0.],
[2,0.,10.],
[3,10.,10.],
[4,10.,8.],
[5,10.,0.],
[6,20.,8.],
[7,20.,15.],
[8,18.,13.],
[9,18.,12.],
[10,10.,12.],
[11,10.,11.],
[12,0.,11.],
[13,0.,29.],
[14,8.,29.],
[15,8.,30.],
[16,23.,30.],
[17,24.,13.],
[18,8.,12.]];
fieldblock;
fieldedges=[[1,[1,2],0],
[2,[2,3], 1],
[3,[3,4], 1],
[4,[4,5], 1],
[5,[5,1], 0],
[6,[4,6], 1],
[7,[6,7], 0],
[8,[7,8], 0],
[9,[8,9],1],
[10,[9,10],1],
[11,[10,11],1],
[12,[11,12],1],
[13,[12,13],0],
[14,[13,14],0],
[15,[14,15],0],
[16,[15,16],0],
[17,[16,17],0],
[18,[7,17],0],
[19,[3,11],1],
[20,[10,18],1],
[21,[14,18],1]];
%fieldedges(19,[1 2 3])
%[x,y]=max(fieldblock,[],1);
%x(2)
%y(3)
%# Lat Long Distance -> If your displacements aren't too great (less than a
few kilometers) and you're not right at the poles, use the quick and dirty
estimate that 111,111 meters (111.111 km) in the y direction is 1 degree (of
latitude) and 111,111 * cos(latitude) meters in the x direction is 1 degree
(of longitude).
%
%c=dome(9);
%c
#distance(lat1,lat2,long1,long2])
dist =
distance(fieldblock(2,[2]),fieldblock(3,[2]),fieldblock(2,[3]),fieldblock(3,[3]))
#get list of inner edges
idx1=(fieldedges(:,4)==1);
innerlines=fieldedges(idx1,[2,3]);
# calculate number of circles
numofcircles=round(dist/beehiverange)
fieldblock2=fieldblock(:,[2,3]);
centblock=centroid(fieldblock2);
#to find the start point find th closest point on the lines plACE IN ARRAY =
IDX
[idx d] = findClosestPoint (centblock, fieldblock2);
startpoint=fieldblock2(idx,[1,2]);
#for each innerline, pick up points2d
CIRCLE=createCircle(startpoint, startpoint+beehiverange);
for z= 1:(numel(innerlines)/2-1)
w=innerlines(z,[1]);
v=innerlines(z,[2]);
newpoint1=fieldblock(w,[2:3]);
newpoint2=fieldblock(v,[2:3]);
EDGE=createEdge(newpoint1,newpoint2);
drawEdge(EDGE);
LINE=createLine(newpoint1,newpoint2);
LINE=LINE(~isnan(LINE));
EDGE=EDGE(~isnan(EDGE));
pts=intersectLineCircle(edgeToLine(EDGE),CIRCLE);
pointer1=pts(1,:);
pointer2=pts(2,:);
%if (isPointOnEdge(pointer1,EDGE) && !isPointOnEdge(pointer2,EDGE))
%if (isPointOnLine(pointer1,LINE) && !isPointOnLine(pointer2,LINE))
%if(pointer1=intersectLineEdge(LINE,EDGE))
drawPoint(pts,"ro");
%elseif (!isPointOnEdge(pointer1,EDGE) && isPointOnEdge(pointer2, EDGE))
%elseif (!isPointOnLine(pointer1,LINE) && isPointOnLine(pointer2, LINE))
% drawPoint(pts,"go") ;
%else
% drawPoint(pts,"yo");
%endif
hold on;
endfor
drawPoint(startpoint);
drawCircle(CIRCLE);
axis([-5 25 -5 25]);
axis equal;
I hope you can help, please?
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Thu 15 Dec 2016 01:21:20 PM GMT Name: octavegeometrybug01output.pdf
Size: 4kB By: simulsys
Output from program attached.
<http://savannah.gnu.org/bugs/download.php?file_id=39236>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49851>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #49851] Plot error when using geometry functions,
Andrew <=