Re: Re: A question about a sphere

• To: mathgroup at smc.vnet.net
• Subject: [mg107110] Re: [mg107097] Re: A question about a sphere
• From: "David Park" <djmpark at comcast.net>
• Date: Wed, 3 Feb 2010 06:08:54 -0500 (EST)
• References: <hk6cu2\$m1a\$1@smc.vnet.net> <25869435.1265112391516.JavaMail.root@n11>

```Presentations does have a 3-dimensional circle, Circle3D in which one
specifies the origin, the normal, the radius and the angle range. Here is my
previous example using Circle3D and RotateOp to rotate about the z axis to
each position longitude position. (RotateOp is a postfix version of Rotate
which is convenient if one is rotating a large piece of graphics
specifications.)

Needs["Presentations`Master`"]

sphere[r_, \[Phi]_, \[Theta]_] :=
r {Cos[\[Phi]] Cos[\[Theta]], Cos[\[Phi]] Sin[\[Theta]], Sin[\[Phi]]}
primeMeridian =
Circle3D[{0, 0, 0}, {0, 1, 0}, 1, {-\[Pi]/2, \[Pi]/2}];

Draw3DItems[
{(* Draw the sphere *)
Opacity[.5], Orange,
Sphere[],
(* Draw 5 lines of latitude *)
Opacity[1], Black,
Table[Circle3D[{0, 0, Sin[lat]}, {0, 0, 1},
Cos[lat]], {lat, {80 \[Degree], 40 \[Degree],
0, -40 \[Degree], -80 \[Degree]}}],
(* Draw lines of longitude *)
Table[primeMeridian // RotateOp[long, {0, 0, 1}], {long, 0,
288 \[Degree], 72 \[Degree]}]},
NeutralLighting[0, .5, .1, 0 \[Degree], -30 \[Degree]],
NiceRotation,
Boxed -> False,
ImageSize -> 400]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

From: dh [mailto:dh at metrohm.com]

Hi,
in mathematica there is no 3 dim circle. Therefore, we have to
approximate the circles using small lines. Here is an example for what
you asked for:
lat[phi_] :=
Line[Table[{Cos[phi] Sin[th], Cos[phi] Cos[th], Sin[phi]}, {th, 0,
2 Pi, Pi/20}]];
long[phi_] :=
Line[Table[{Cos[th] Sin[phi], Cos[th] Cos[phi],
Sin[th]}, {th, -Pi/2, Pi/2, Pi/20}]];
Graphics3D[{Sphere[{0, 0, 0}, 1]
, Table[lat[th], {th, -Pi/2, Pi/2, Pi/6}]
, Table[long[th], {th, -Pi, Pi, Pi/2.5}]
}]
Note, as the circles are on the sphere it is not clear if they are
visible or not. For certain positions the circles are not alsways drawn
fully. To prevent this, you may either draw the circles a little bit
larger than the spehre or use Opacity.
Daniel

Marwa Abd El-Wahaab wrote:
> Dear Sir,
>
> I am a Mathematica 7 user.
>
> I have a question :
>
> I want to draw a sphere, then draw 5 circles on this sphere like
> *latitudes*and draw 5 lines on this sphere like
> *longitudes*.
>
> I need your help.
>
> Thanks in advance
>
> Marwa Ali
>
>

```

• Prev by Date: Re: Re: What does & mean?
• Next by Date: Re: Export[..., ImageResolution, ... ImageSize]
• Previous by thread: Re: Re: A question about a sphere
• Next by thread: Re: Re: A question about a sphere