Distance calculation in sphere

  • Follow


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.
0
Reply kamal 4/8/2010 8:55:23 PM

"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
0
Reply Roger 4/8/2010 9:30:14 PM


"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.
0
Reply kamal 4/9/2010 11:17:20 AM

2 Replies
393 Views

(page loaded in 0.11 seconds)

Similiar Articles:













7/26/2012 12:05:02 PM


Reply: