Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From: TideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Line between two points on a sphere
Date: Wed, 25 Jul 2012 01:33:04 -0700 (PDT)
Organization: http://groups.google.com
Lines: 31
Message-ID: <ffc76cc0-cd22-4d23-bd25-131e8f18a774@googlegroups.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> <juma6d$mk0$1@newscl01ah.mathworks.com>
 <jumap6$ote$1@newscl01ah.mathworks.com> <juo7ib$aee$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: 118.148.176.97
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1343205185 22884 127.0.0.1 (25 Jul 2012 08:33:05 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 25 Jul 2012 08:33:05 +0000 (UTC)
In-Reply-To: <juo7ib$aee$1@newscl01ah.mathworks.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=118.148.176.97;
 posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
Xref: news.mathworks.com comp.soft-sys.matlab:774855

On Wednesday, July 25, 2012 7:34:35 PM UTC+12, Vinita  wrote:
> Bruno I have a little problem :-
> I want to select 4 random points on a unit sphere and then draw a line connecting them. Can you please help m,e on this. Heres what I could do till now.
> 
> 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
> ALPHA(&#39;clear&#39;); % renders the sphere transparent
> 
> 
> &quot;Bruno Luong&quot; &lt;b.luong@fogale.findmycountry&gt; wrote in message &lt;jumap6$ote$1@newscl01ah.mathworks.com&gt;...
> &gt; &quot;Vinita &quot; &lt;rsingh2083@gmail.com&gt; wrote in message 
> &gt; &gt; But its not showing on the 3d sphere plot. Although its working if i plot it in a new figure.
> &gt; 
> &gt; The line is inside the sphere, you might know it, no ?
> &gt; 
> &gt; Use &quot;alpha&quot; to set the transparency of the patches.
> &gt; 
> &gt; Bruno

What you need is the gnomonic map transformation.
This enables you to draw straight lines on the surface of a sphere.
You can get this from the (free) Matlab toolbox m_map (Google it).