Re: a visualization problem in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg38295] Re: a visualization problem in Mathematica
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 12 Dec 2002 01:31:13 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <at4e6d$f34$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
toSphere[{x_, y_, z_}] := {Sqrt[x^2 + y^2 + z^2],
ArcCos[z/Sqrt[x^2 + y^2 + z^2]], ArcTan[x, y]}
SphereCurve[p1_, p2_] :=
Module[{sp1, sp2, ip, t},
sp1 = toSphere[p1];
sp2 = toSphere[p2];
ip = (1 - t)*sp1 + t*sp2;
ParametricPlot3D[Evaluate[
#1{Cos[#3]*Sin[#2], Sin[#3]*Sin[#2], Cos[#2]} & @@ ip],
{t, 0, 1}]
]
SphereCurve[pt1, pt2]
may help.
Regards
Jens
Borut L wrote:
>
> Hi,
>
> I have the following problem. Given two random points on a sphere, I would
> like to connect them with a curve that goes 'approximately' on the sufrace
> of the spehere. I wrote approximately, because the curve would be made of
> line segments.
>
> Connecting the points with a straigh line is achived by Line[{pt1,pt2}].
>
> I am failing to get good ideas on how to approach the problem, would
> appreciate any hint / trick / tip.
>
> Thank you,
>
> Borut Levart
>
> Slovenia