[metapost] Drawing 3d spherical arcs

Camm Maguire camm at maguirefamily.org
Wed Nov 30 16:21:58 CET 2011


Greetings!  I'm trying to draw (great circle) arcs on a sphere with
proper perspective.  I do all the manipulations in 3d color vectors, and
then draw the projections onto a pair taking out the line of sight.

The basic command I have is

  draw pp(-nq){pp(-nq+m)-pp(-nq-m)}
    ..tension ten..pp(e){pp(e+ep)-pp(e-ep)} dashed withdots withcolor c;
  draw pp(e){pp(e+ep)-pp(e-ep)}
    ..tension ten..pp(m){pp(m+nq)-pp(m-nq)}
    ..tension tenn..pp(ep){pp(ep-e)-pp(ep+e)}
    ..tension tennn..pp(nq){pp(nq-m)-pp(nq+m)} withcolor c;

Here pp is the projection macro, nq is the intersection of the arc with
the equator, e is the arc intersection with the visible edge of the
sphere, m is the point of northernmost latitude, and ep is the point of
the arc orthogonal to e.  So the basic strategy is to specify the
tangent at each point using the orthogonal vector in 3d.

This works, but the default tension parameter can result in visible
distortion.  So I've fudged it with by hand tweaked variables ten, tenn,
and tennn.

I'd like to compute these (or equivalent) within metapost.  As the curve
is mathematically well defined, it seems as though the faithful drawing
should have a unique metapost representation.

Suggestions?

Take care,
-- 
Camm Maguire			     		    camm at maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah


More information about the metapost mailing list