5
$\begingroup$

I'm trying to make an unsophisticated 3D model of a continent's path on a globe consisting of snapshots of the planet surface that follows the historical trend of continental drift.

By "unsophisticated" I mean:

  1. Each continent is represented by a simple polygonal approximation. The approximation is based on the respective continent's present shape.

  2. The globe is a perfect sphere.

  3. At the start, the supercontinent Pangaea is less a supercontinent and more a jigsaw puzzle whose pieces (the polygons) can overlap. For reference, you can check this YouTube clip. My starting point would be about $332\text{ mya}$ (3:34) and the terminal point would be what we see today at $0\text{ mya}$ (4:10).

For the purposes of this post, let's suppose a continent is approximated with a small regular hexagon.

  1. How can I render a hexagon on a sphere?

  2. Is it possible to manipulate the hexagon's position on the sphere by means of adjusting the hexagon-on-sphere's centroid's coordinates?

  3. Would it also be possible to rotate the hexagon?

By this I mean I would like to, with the use of Manipulate and sliders, adjust the latitude/longitude of the point on the sphere corresponding to the hexagon's center to place the hexagon wherever I wish - kind of like dragging a coin along the surface of a beach ball.

This is easy enough to do in rectangular coordinates. Given a hexagon like

Graphics[Polygon[CirclePoints[6]]]

I can translate and rotate it in a plane using

Manipulate[
    Graphics[
        Rotate[Polygon[CirclePoints[6] + Table[{x, y}, 6]], t]
       ],
  {x, -1, 1}, {y, -1, 1}, {t, 0, 2Pi}]

but I have no clue as to how to adapt something like this to the sphere's surface.

$\endgroup$
1

1 Answer 1

3
$\begingroup$

A polygon on a sphere has a location specified by a vector h from the origin to the polygon centroid.

PolygonCentroid[p_Polygon] := Mean[Most[p[[1]]]]

Begin with a hexagon p centred on the North pole. Rotate the North pole polygon in two steps. First, rotate down to the proper latitude u, then over to the proper longitude v. The latitude between -90 and +90 degrees is converted to a polar angle running from 0 at the North pole to 180 at the South. Combining two rotation matrices is equivalent to the following matrix m. The outer Transpose is required so that the rotated polygon q may be written as q=p.m.

Transpose[RotationMatrix[v, {0, 0, 1}].RotationMatrix[Pi/2 - u, {1, 0, 0}]]

Finally, use one last RotationMatrix to allow for rotations of the polygon q by a degrees about its centroid.

Manipulate[
   Module[{p, q, m, cv, cu, sv, su, h},
      p = Polygon[Table[{0.15 Cos[t], 0.15 Sin[t], 1}, {t, 0, 2 Pi, Pi/3}]];
      Graphics3D[{
         EdgeForm[{Thick, Black}],
         Sphere[{0, 0, 0}, 0.97],
         Blue, Tube[1.2 {{0, 0, -1}, {0, 0, 1}}, 0.04],
         Red,
         cv = Cos[v*Degree]; cu = Cos[u*Degree];
         sv = Sin[v*Degree]; su = Sin[u*Degree];
         m = {
              {cv, sv, 0},
              {-su sv, cv su, cu},
              {cu sv, -cu cv, su}};
         q = Polygon[p[[1]].m];
         h = Chop[PolygonCentroid[q]];
         Red, Tube[1.2 {-h, h}, 0.04],
         Polygon[q[[1]].Transpose[RotationMatrix[a*Degree, h]]]
      },
     Axes -> True, AxesLabel -> {"x", "y", "z"}, 
     ViewPoint -> {0, -5, 0}, SphericalRegion -> True, 
     BaseStyle -> {FontSize -> 15}, 
     PlotLabel -> "h \[Rule] " <> ToString[h],
     PlotRange -> 1.25 {{-1, 1}, {-1, 1}, {-1, 1}}, ImageSize -> 500]],
   {{u, 0., "Latitude Degrees"}, -90., 90., Appearance -> "Labeled"},
   {{v, 0., "Longitude Degrees"}, -180., 180., Appearance -> "Labeled"},
   {{a, 0., "Rotation Degrees"}, 0., 360., Appearance -> "Labeled"}
]

For example:

hexagon on sphere

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.