Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to draw an arc between two points given centre and radius
Date: Tue, 30 Mar 2010 14:41:08 -0500
Lines: 30
Message-ID: <hotk4m\$hl8\$1@canopus.cc.umanitoba.ca>
References: <hotir8\$8a8\$1@fred.mathworks.com>
NNTP-Posting-Host: ibd-nat.ibd.nrc.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: canopus.cc.umanitoba.ca 1269978070 18088 192.70.172.18 (30 Mar 2010 19:41:10 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Tue, 30 Mar 2010 19:41:10 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.24 (X11/20100317)
Xref: news.mathworks.com comp.soft-sys.matlab:621996

Chanpreet wrote:
> how to draw an arc between two points given centre and radius on matlab

If you are given the two points, and given the centre and radius, then you
cannot always do that. The distance from the centre and each of the points
define radii, and if those two radii are not equal or are not equal to the
given radius, then you cannot draw a circular arc.

The circular arcs that pass through any two given points define a line. If the
centre is not on that line, you cannot do what you ask. Only one coordinate of
the centre would need to be given, and the radius would not be needed. If,
alternately, the radius were given, then that would narrow it to one of
exactly two points, and the only reason the centre would need to be given
would be to distinguish which of the two points it was.

Did you have something different in mind, such as a non-circular arc? Perhaps
a parabolic arc, and the centre is really the focus?

Anyhow...

You can use arctan to find the sector angle to be drawn. Be sure to check in
case you are crossing over the periodic boundary, as you probably want to draw
the smaller of the two arcs. Then, knowing the angles involved, linspace() the
angle range into an appropriate number of points, and then the points of the
arc are

[radius * cos(theta_range) + x of centre, radius * sin(theta_range) + y of
centre)]