greatCircles.mws
Plotting 6-Pole Spheres in Maple
by Jason Schattman, Waterloo Maple, Inc.
>
with(plots):with(plottools):
The
sphere
command in Maple plots 2-pole spheres by drawing longitudinal great circles and latitudinal small circles. We show how to plot 6-pole spheres using great circles.
Here is the standard 2-pole sphere.
>
mySphere := sphere([1,1,1], 3.3):
>
display( mySphere, scaling=constrained, axes=none );
To plot great circles exclusively, use the
spacecurve
command, which plots the curve given by the parametric functions [x(t), y(t), z(t)]. As a first example, we'll plot just one great circle at angle Pi/3.
>
t := Pi / 3;
>
myGreatCircle := spacecurve( [cos(t)*cos(s), sin(t)*cos(s), sin(s)],
s=0..2*Pi, axes=normal, scaling=constrained, orientation=[30,60]):
Click and drag the plot below to see it from different perspectives.
>
display( myGreatCircle );
To plot many great circles at once in six hemispheres, it's best to define a procedure that takes as input the number of circles we want. In this procedure, we'll define three arrays of great circles, one for circles about the x-, y- and z-axis respectively. Within each array, each circle will lie at a different angle about its axis.
For generality, we'll actually plot great ellipses with major and minor axis lengths r1 and r2.
>
GreatCircles := proc( numCircles, r1, r2, colorZ, colorX, colorY, orientation1, orientation2 )
local t, k, s, zCircles, xCircles, yCircles;
for k from 1 to numCircles do
t := 2*Pi*k / numCircles;
zCircles[k] := spacecurve([r1*cos(t)*cos(s), r1*sin(t)*cos(s), r2*sin(s)],
s=0..2*Pi,axes=none, scaling=constrained,
color=colorZ):
xCircles[k] := spacecurve([r2*sin(s), r1*sin(t)*cos(s), r1*cos(t)*cos(s)],
s=0..2*Pi,axes=none, scaling=constrained,
color=colorX):
yCircles[k] := spacecurve([r1*cos(t)*cos(s), r2*sin(s), r1*sin(t)*cos(s)],
s=0..2*Pi,axes=none, scaling=constrained,
color=colorY):
end do:
display( {seq(zCircles[k], k=1..numCircles),
seq(xCircles[k], k=1..numCircles),
seq(yCircles[k], k=1..numCircles)},
insequence=false, orientation=[orientation1,orientation2] );
end proc:
Notice the six poles, one for each dimension.
>
GreatCircles( 30, 1, 1, red, blue, black, 30, 60 );
With elongated axes.
>
GreatCircles( 30, 1, 1.5, red, blue, black, 45, -30 );
Let's get artistic.
>
GreatCircles( 43, 1, 1.2, gold, red, yellow, 135,-180 );