http://www.mathworks.com/matlabcentral/newsreader/view_thread/278872
MATLAB Central Newsreader  Distance calculation in sphere
Feed for thread: Distance calculation in sphere
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Thu, 08 Apr 2010 20:55:23 +0000
Distance calculation in sphere
http://www.mathworks.com/matlabcentral/newsreader/view_thread/278872#734368
kamal abuhassan
I have used the following code to generate a sphere of radius 8:<br>
[x,y,z] = sphere(30);<br>
x=x*8;<br>
y=y*8;<br>
z=z*8;<br>
<br>
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 ?<br>
<br>
Thanks,<br>
Kamal.

Thu, 08 Apr 2010 21:30:14 +0000
Re: Distance calculation in sphere
http://www.mathworks.com/matlabcentral/newsreader/view_thread/278872#734383
Roger Stafford
"kamal abuhassan" <kamal.abuhassan@hotmail.com> wrote in message <hplfrr$r8k$1@fred.mathworks.com>...<br>
> I have used the following code to generate a sphere of radius 8:<br>
> [x,y,z] = sphere(30);<br>
> x=x*8;<br>
> y=y*8;<br>
> z=z*8;<br>
> <br>
> 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 ?<br>
> <br>
> Thanks,<br>
> Kamal.<br>
<br>
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?<br>
<br>
d = 8*atan2(norm(cross(P1,P2)),dot(P1,P2));<br>
<br>
Roger Stafford

Fri, 09 Apr 2010 11:17:20 +0000
Re: Distance calculation in sphere
http://www.mathworks.com/matlabcentral/newsreader/view_thread/278872#734553
kamal abuhassan
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hplht6$396$1@fred.mathworks.com>...<br>
> "kamal abuhassan" <kamal.abuhassan@hotmail.com> wrote in message <hplfrr$r8k$1@fred.mathworks.com>...<br>
> > I have used the following code to generate a sphere of radius 8:<br>
> > [x,y,z] = sphere(30);<br>
> > x=x*8;<br>
> > y=y*8;<br>
> > z=z*8;<br>
> > <br>
> > 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 ?<br>
> > <br>
> > Thanks,<br>
> > Kamal.<br>
> <br>
> 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?<br>
> <br>
> d = 8*atan2(norm(cross(P1,P2)),dot(P1,P2));<br>
> <br>
> Roger Stafford<br>
<br>
<br>
Thank you so much Roger<br>
Kamal.