Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Distance calculation in sphere
Date: Fri, 9 Apr 2010 11:17:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <hpn2c0$pnh$1@fred.mathworks.com>
References: <hplfrr$r8k$1@fred.mathworks.com> <hplht6$396$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1270811840 26353 172.30.248.37 (9 Apr 2010 11:17:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 Apr 2010 11:17:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2305282
Xref: news.mathworks.com comp.soft-sys.matlab:625000

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hplht6$396$1@fred.mathworks.com>...
> "kamal abuhassan" <kamal.abuhassan@hotmail.com> wrote in message <hplfrr$r8k$1@fred.mathworks.com>...
> > I have used the following code to generate a sphere of radius 8:
> > [x,y,z] = sphere(30);
> > x=x*8;
> > y=y*8;
> > z=z*8;
> > 
> > for now, I am trying to calculate the distance between two points on the sphere, Can you please help me? I am also looking for a method to get all neighrong points of a certain point (on sphere) within a circle of radius 0.5 ?
> > 
> > Thanks,
> > Kamal.
> 
>   I'll just answer your first question.  If P1 = [x1,y1,z1] and P2 = [x2,y2,z2] are two vectors pointing from the center of the sphere to the two given points (x1,y1,z1) and (x2,y2,z2) on the sphere, what is the shortest great circle distance d between them?
> 
>  d = 8*atan2(norm(cross(P1,P2)),dot(P1,P2));
> 
> Roger Stafford


Thank you so much Roger
Kamal.