Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Visualising a spherical triangle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85476] Re: [mg85431] Re: Visualising a spherical triangle
  • From: Syd Geraghty <sydgeraghty at mac.com>
  • Date: Mon, 11 Feb 2008 06:19:41 -0500 (EST)
  • References: <fojr91$gk2$1@smc.vnet.net> <200802101018.FAA17855@smc.vnet.net>

Jens,

When I run the section

With[{nSubdivde = 4},
  Graphics3D[{Sphere[{0, 0, 0}, 1],
    ToSphere[
      SubDivide[Polygon[{{Pi/3, 0}, {2 Pi/3, 0}, {Pi/3, Pi/3}}],  
nSubdivde],
      1.1] /. Polygon[pnts_] :> {Hue[Random[]], Polygon[pnts]}}]]


I get

  ToSphere is not a Graphics3D primitive or directive.

Is this a version issue?

Syd

Syd Geraghty B.Sc, M.Sc.

sydgeraghty at mac.com

My System

Mathematica 6.0.1 for Mac OS X x86 (64 - bit) (June 19, 2007)
MacOS X V 10.5 .10
MacBook Pro 2.33 Ghz Intel Core 2 Duo  2GB RAM



On Feb 10, 2008, at 2:18 AM, Jens-Peer Kuska wrote:

> Hi,
>
> what is with
>
> SubDivide[Polygon[tri : {{_, _} ..}]] :=
>  Module[{center},
>   center = Mean /@ Transpose[{tri, RotateLeft[tri]}];
>   Polygon /@
>    Append[Transpose[{RotateRight[center], tri, center}], center]
>   ]
> SubDivide[lst : {__Polygon}] := Flatten[SubDivide /@ lst]
>
> SubDivide[lst_, n_Integer] := Nest[SubDivide, lst, n]
>
> ToSphere[{th_?NumericQ, phi_?NumericQ}] :=
>  {Cos[phi]*Sin[th], Sin[phi]*Sin[th], Cos[th]}
> ToSphere[Polygon[pnts_]] := Polygon[ToSphere /@ pnts]
> ToSphere[lst : {__Polygon}] := ToSphere /@ lst
>
> and
>
> With[{nSubdivde = 4},
>  Graphics3D[
>   {Sphere[{0, 0, 0}, 1],
>    ToSphere[
>      SubDivide[Polygon[{{Pi/3, 0}, {2 Pi/3, 0}, {Pi/3, Pi/3}}],
>       nSubdivde] ] /.
>     Polygon[pnts_] :> Line[Append[pnts, First[pnts]]]}
>   ]
>  ]
>
> should give you a triangle on the sphere ...
> and
>
> With[{nSubdivde = 4},
>  Graphics3D[
>   {Sphere[{0, 0, 0}, 1],
>    ToSphere[
>      SubDivide[Polygon[{{Pi/3, 0}, {2 Pi/3, 0}, {Pi/3, Pi/3}}],
>       nSubdivde] ,1.1] /.
>     Polygon[pnts_] :> {Hue[Random[]], Polygon[pnts]}}
>   ]
>  ]
>
> will color the individual polygons
>
> and
>
> With[{nSubdivde = 4},
>  Graphics3D[
>   {Sphere[{0, 0, 0}, 0.975], EdgeForm[], RGBColor[1, 0, 0, 0.5],
>    ToSphere[
>     SubDivide[Polygon[{{Pi/3, 0}, {2 Pi/3, 0}, {Pi/3, Pi/3}}],
>      nSubdivde] , 1]}
>   ]
>  ]
>
> will draw a transparent red triangle on the sphere.
> Be careful when setting the radius of the sphere a bit smaller
> than the radius of the triangle, otherwise some parts
> of the triangle mesh may be hidden ..
>
> Regards
>   Jens
>
>
>
>
>
> Alexander Erlich wrote:
>> Hello,
>>
>> I would like to visualize the a spherical triangle between Bremen  
>> (Germany),
>> Chicago and Shanghai on the world sphere. Although there are some  
>> notebooks
>> on the Documentation Project which deal with spherical triangles, I  
>> had
>> trouble understanding them (being rather new to mathematica), and I  
>> could
>> not find a way to modify any of them to my purpose.
>>
>> Could you tell me how to visualize a spherical triangle? Or (if  
>> this is
>> easier) how to modify an existing notebook to visualize it?
>>
>> Regards,
>> Alexander
>>
>>
>



  • Prev by Date: Re: Where to put ConvexHull3D.m
  • Next by Date: Re: Creating notebook templates
  • Previous by thread: Re: Visualising a spherical triangle
  • Next by thread: International Mathematica Symposium: last call, 3 days to go