Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!f2g2000yqh.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: perpendicular line -- follow up
Date: Tue, 31 May 2011 21:57:52 -0700 (PDT)
Organization: http://groups.google.com
Lines: 25
Message-ID: <4950aad6-c34c-43d6-b694-000a3954e575@f2g2000yqh.googlegroups.com>
References: <is3fg5$25i$1@newscl01ah.mathworks.com> <is40r2$ikd$1@newscl01ah.mathworks.com>
 <is4bga$e2j$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: 195.18.217.10
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1306904272 22330 127.0.0.1 (1 Jun 2011 04:57:52 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 1 Jun 2011 04:57:52 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f2g2000yqh.googlegroups.com; posting-host=195.18.217.10; posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-Google-Web-Client: true
X-Google-Header-Order: ARLEUHCNK
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
 2.0.50727; InfoPath.2; MS-RTC LM 8; .NET CLR 1.1.4322),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:729610

On Jun 1, 5:26 am, "Lisa " <_awalt...@web.de> wrote:
> Roger,
>
> i am sorry but when i take your solution to matlab, it does not plot two orthogonal lines but two separate ones. maybe i should clarify my problem a little bit more: i am plotting patch objects (rectangles) that span the distance from one point to another. these two points may lie anywhere in the 2D space. my actual problem is that the rectangle between them is never perfectly rectangular but always a little bit skewed so that not all of its angles have 90 degrees. this i would like to avoid by plotting the perpendicular lines.

That's a different task than the question you asked.
If you have two points, p1 = [x1 y1] and p2 = [x2,y2],
you need to do something like

P00 = [min(x1,x2),min(y1,y2)];
P10 = [max(x1,x2),min(y1,y2)];
P11 = [max(x1,x2),max(y1,y2)];
P01 = [min(x1,x2),max(y1,y2)];

patch([P00(1) P10(1) P11(1) P01(1)],[P00(2) P10(2) P11(2) P01(2)],
[1,0,0]);

Rune