Path: news.mathworks.com!not-for-mail
From: "Vinita " <rsingh2083@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Line between two points on a sphere
Date: Tue, 24 Jul 2012 14:01:11 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 36
Message-ID: <jum9r7$lba$1@newscl01ah.mathworks.com>
References: <hopnd6$19c$1@fred.mathworks.com> <hoqmkn$871$1@fred.mathworks.com> <dc084b59-3128-495b-8814-1e50bbe98b29@k21g2000vbj.googlegroups.com> <jum41g$q60$1@newscl01ah.mathworks.com>
Reply-To: "Vinita " <rsingh2083@gmail.com>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1343138471 21866 172.30.248.46 (24 Jul 2012 14:01:11 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 24 Jul 2012 14:01:11 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3425922
Xref: news.mathworks.com comp.soft-sys.matlab:774774

Actually I used this code to generate a 3d sphere :-

theta=linspace(0,2*pi,40);
phi=linspace(0,pi,40);
[theta,phi]=meshgrid(theta,phi);
rho=1;
x=rho*sin(phi).*cos(theta);
y=rho*sin(phi).*sin(theta);
z=rho*cos(phi);
mesh(x,y,z)
axis equal
grid on

now suppose i select 2 points on this unit sphere
                              x1,y1,z1=-.8203, -.06622, .5681
                              x2,y2,z2=-.2918, -.7695, .5682
Now I want to draw a straight line between these two points(cutting through the sphere) and not an arc on the circle.
 

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <jum41g$q60$1@newscl01ah.mathworks.com>...
> Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <dc084b59-3128-495b-8814-1e50bbe98b29@k21g2000vbj.googlegroups.com>...
> > 
> > You mean
> > 
> > t=linspace(0,1,10);
> > plot3(x1+t*(x2-x1),y1+t*(y2-y1),z1+t*(z2-z1));
> > 
> 
> I think visually:
> 
> plot3([x1 x2],[y1 y2],[z1 z2]); %or
> line([x1 x2],[y1 y2],[z1 z2]);
> 
> would look more or less the similar, but without surcharging the internal graphic data.
> 
> % Bruno