From: TideMan <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Line between two points on a sphere
Date: Wed, 25 Jul 2012 01:33:04 -0700 (PDT)
Lines: 31
Message-ID: <>
References: <hopnd6$19c$> <hoqmkn$871$>
 <jum41g$q60$> <juma6d$mk0$>
 <jumap6$ote$> <juo7ib$aee$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: 1343205185 22884 (25 Jul 2012 08:33:05 GMT)
NNTP-Posting-Date: Wed, 25 Jul 2012 08:33:05 +0000 (UTC)
In-Reply-To: <juo7ib$aee$>
Injection-Info:; posting-host=;
User-Agent: G2/1.0
Xref: 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$;...
> &gt; &quot;Vinita &quot; &lt;; 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).