Computing Geodesics on Two Dimensional Surfaces

advertisement
Computing Geodesics on Two Dimensional Surfaces
Jesse Klang
May 2005
Abstract
Methods for finding geodesic equations on surfaces will be presented without
assumption of prior knowledge of differential geometry. Basic definitions and theorems
will be presented and employed in computations. Techniques will include hand
computation as well as m-files for Matlab assisted approaches. Examples and
applications of geodesics will be presented with use of Matlab.
Introduction:
A geodesic is the real world analog to a straight line. Where a straight line on a
flat piece of paper minimizes the distance between two points, a geodesic minimizes the
distance between two points on any surface; be it flat or not. Another characteristic of a
geodesic is that it describes a non-accelerated path relative to the surface on which it
travels. A path with such characteristics is desirable to find in applications ranging from
aerospace engineering to navigation to road construction.
Definitions:

Surface: M  R³ is a surface if for any x  M, there exists an open
neighborhood U  R³ containing x, an open neighborhood W  R² containing x,
and a map x: W  U  M that is differentiable with differentiable inverse. Such
a function is called a parameterization or a coordinate patch since it allows
us to assign coordinates to the surface corresponding to the coordinates
of R².
That is to say, a surface is a set of continuous coordinates which can be
defined in R2 and R3. In addition, there must be a set of equations that can be
used to translate between R2 and R3.
 x (u , v) 
X (u , v )   y (u , v ) 
 z (u , v) 
These equations must be differentiable. Here, u(t) and v(t) must be linearly
independent and x, y, and z must be linearly independent.
Analysis:
Knowing that we want to define a geodesic as an analog to a straight line, we will
require certain traits be common to both. Knowing that the equation of a straight line in a
Euclidian plane is y  mx  b , we can see that y   m and more importantly, y   0 . We
shall thus require the second derivative (acceleration) of a geodesic α(t) described in R2
to be equal to 0. It is important to note that this limitation only affects the position vector
α(t) as described in R2. Since this requirement still allows for acceleration normal to a
surface, we see that α(t) described in R3 is not necessarily 0.
If u and v are orthogonal and unit vectors, the following technique may be used to find
α(t).

We first define  (t ) :
 x (u , v) 
Given a surface X (u , v )   y (u , v )  , we know that a geodesic α(t) must stay


 z (u , v) 
confined to that space, and so will be of the form:
 x(u (t ), v(t )) 
 t   X (u (t ), v(t ))   y(u (t ), v(t )) 
 z (u (t ), v(t )) 
(Eq1)
Thus
 t   X (u(t ), v(t ))  X U u   X V v
and
 t   X (u (t ), v(t ))  X UU u  2  X UV v u   X U u   X VU u v   X VV v  2  X V v 

(Eq2)
We then define  (t ) as a linear combination of XU, XV, and N:
 x(u (t ), v(t )) 
X  X (u (t ), v(t ))   y (u (t ), v(t )) 
 z (u (t ), v(t )) 
therefore
d

x(u (t ), v(t )) 

 x(u (t ), v(t ))   du

d 
   d y (u (t ), v(t )) 
XU 
y
(
u
(
t
),
v
(
t
))
  du
du 

 z (u (t ), v(t ))   d

 du z (u (t ), v(t )) 
d

x(u (t ), v(t )) 

 x(u (t ), v(t ))   dv

d 
   d y (u (t ), v(t )) 
XV 
y
(
u
(
t
),
v
(
t
))
  dv
dv 

 z (u (t ), v(t ))   d

 dv z (u (t ), v(t )) 
d

x(u (t ), v(t )) 

 x(u (t ), v(t ))   dt

d 
d
N  X U  X V   y (u (t ), v(t ))    y (u (t ), v(t )) 
dt
 dt

 z (u (t ), v(t ))   d

 dt z (u (t ), v(t )) 
(Eq3)
(Eq4)
(Eq5)
Since XU, XV, and N are orthogonal vectors that span the space in which the surface
is found, we can define the surface as a linear combination of the three vectors.
 (t )  c1 X U  c2 X V c 3 N

(Eq6)
We now write Equation 2 in terms of XU, XV, and N.
 t   X (u (t ), v(t ))  X UU u  2  X UV v u   X U u   X VU u v   X VV v  2  X V v 
(Eq2)
In order to define XUU, XUV, and XVV in terms of XU, XV, and N we say that
X UU  a1 X U  a 2 X V  a3 N
X UV  a 4 X U  a5 X V  a 6 N
(Eq7)
X VV  a7 X U  a8 X V  a9 N
So Equation 2 becomes
 t  (a1 X U  a2 X V  a3 N )u  2  (a4 X U  a5 X V  a6 N )vu   X U u  
(a4 X U  a5 X V  a6 N )u v  (a7 X U  a8 X V  a9 N )v 2  X V v
Distributing gives
 t  a1 X U u  2  a2 X V u  2  a3 Nu  2  a4 X U vu   a5 X V vu   a6 Nvu   X U u  
a4 X U u v  a5 X V u v  a6 Nu v  a7 X U v 2  a8 X V v 2  a9 Nv 2  X V v
Re-arranging terms:
 t   X U u   a1 X U u  2  a 4 X U u v   a 4 X U v u   a 7 X U v  2
 X V v   a 2 X V u  2  a5 X V u v   a5 X V v u   a8 X V v  2
 a3 Nu  2  a 6 Nu v   a 6 Nv u   a9 Nv  2
Factoring gives
 t  (u   a1u  2  a 4 u v   a 4 v u   a 7 v  2 ) X U
 (v   a 2 u  2  a5 u v   a5 v u   a8 v  2 ) X V
 (a3u   a 6 u v   a 6 v u   a9 v  ) N
2
2
Simplifying gives
 t  (u   a1u  2  2a 4 u v   a7 v  2 ) X U
 (v   a 2 u  2  2a5 u v   a8 v  2 ) X V
 (a3u  2  2a 6 u v   a9 v  2 ) N
(Eq8)
By definition of a geodesic, we know that acceleration in the surface, and thus in the
directions XU and XV, are equal to 0, and we are given the following set of equations:

u   a1u  2  2a 4 u v  a7 v 2  0
(Eq9)
v  a 2 u  2  2a5 u v  a8 v 2  0
(Eq10)
We then make use of three new variables—E, F, and G—to find the ai variables.
E  XU  XU
F*  X U  X V
G  XV  XV
*Note that if u and v are orthogonal, F = 0.
X UU  X U  a1 X U  X U  a 2 X V  X U  a3 N  X U
X UU  X U  a1 X U  X U  0  0
X UU  X U  a1 E
But
E  XU  XU
EU  X UU  X U  X U  X UU
EU  2 X UU  X U
so
X UU  X U 
a1 
EU
 a1 E
2
EU
2E
X UU  X V  a1 X U  X V  a 2 X V  X V  a3 N  X V
X UU  X V  0  a 2 X V  X V  0
X UU  X V  a 2 G
a2 
X UU  X V
G
(Eq11)
but
E  XU  XU
EV  X UV  X U  X U  X UV
EV  2 X UV  X U
so
X UV  X U 
EV
2
but
F  XU  XV
FU  X UU  X V  X U  X VU  0 (orthogonal )
so
X UU  X V   X U  X VU
thus
a2 
X UU  X V
X  XU
E
  UV
 v
G
G
2G
(Eq12)
X UV  X U  a 4 X U  X U  a5 X V  X U  a6 N  X U
X UV  X U  a 4 E  0  0
X UV  X U  a 4 E
X UV  X U
E
but from Eq9
a4 
X UV  X U 
EV
2
so
EV
E
a4  2  V
E
2E
(Eq13)
X UV  X V  a 4 X U  X V  a5 X V  X V  a6 N  X V
X UV  X V  0  a5 G  0
X UV  X V  a5 G
a5 
X UV  X V
E
but
G  XV  XV
GU  X VU  X V  X V  X VU  2 X VU  X V
X VU  X V 
GU
2
so
GU
G
a5  2  U
E
2E
(Eq14)
X VV  X U  a7 X U  X U  a8 X V  X U  a9 N  X U
X VV  X U  a7 E  0  0
X VV  X U  a7 E
a7 
X VV  X U
E
but
F  XU  XV
FV  X UV  X V  X U  X VV  0
1
X VV  X U   X UV  X V   GU
2
so
a7 
 X UV  X V
G
 U
E
2E
(Eq15)
X VV  X V  a7 X U  X V  a8 X V  X V  a9 N  X V
X VV  X V  0  a8 G  0
X VV  X V  a8 G
a8 
X VV  X V
G
but
G  XV  XV
GV  X VV  X V  X V  X VV  2 X VV  X V
X VV  X V 
GV
2
so
GV
G
a8  2  V
G
2G

(Eq16)
Now that we have found all the ai coefficients in terms of E, F, and G, we can
substitute them back into Equations 9 and 10.
E 
E 
 G 
u    U u  2  2 V u v     U v  2  0
 2E 
 2E 
 2E 
 E 
G 
G 
v     v u  2  2 U u v    V v  2  0
 2G 
 2E 
 2G 
Simplifying gives
E 
E 
G 
u    U u  2   V u v    U v  2  0
 2E 
 E 
 2E 
E 
G 
G 
v    v u  2   U u v    V v  2  0
 2G 
 E 
 2G 
(Eq17)
(Eq18)
Solving the system of second order differential equations:
To solve this system, we will make the following substitutions:
x1  u
x2  u 
x3  v
x4  v
Differentiating this system gives
(Eq19)

x1  u   x 2

x 2  u 

x3  v   x 4

x 4  v 
Using Equations 17 and 18 to substitute for u” and v” gives

x1  x 2
E 
E

x 2   U u  2   V
 2E 
 E

x3  x 4

G 
u v    U v  2

 2E 
G 
G 
 E 
x 4   v u  2   U u v    V v  2
 2G 
 E 
 2G 
Substituting with Equation 19 gives

x1  x 2
E  2 E 
G  2

x 2   U  x 2   V  x 2 x 4   U  x 4
 2E 
 E 
 2E 

x3  x 4
G  2
  E  2 G 
x4   v  x2   U  x2 x4   V  x4
 2G 
 E 
 2G 
This is a system of second order ODE’s which is dependant on both time and the surface
of the form of Equation 1. Matlab can be used to quickly solve this system using a
numeric solver. In the appendix to this paper is a program which I have written which
will compute a geodesic given a surface and initial conditions.
Examples
Great Circles: In navigation of both ships and airplanes, it is desirable to follow
the shortest path between two points. To accomplish this, navigators have made maps of
the Great Circles, which are the geodesics of the earth’s surface (simplifying the earth as
a sphere).
x=cos(u)*cos(v);
y=sin(u)*cos(v);
z=sin(v);
1
0.5
0
-0.5
-1
-1
0
1
1
0.5
0
-0.5
-1
Road Construction
When a road is being designed, the banking of curves is an important element.
These curves are designed so that if a car enters the curve at the suggested constant
speed, the banking will turn the car so that it comes out of the curve on course without
the driver having to turn his wheels. This is done not only for ease of driving, but to
ensure that if, for instance, the road is icy and the car looses all traction with the road, the
car will be able to remain on the road.
Some Other Cool Looking Surfaces and Geodesics:
Taurus:
x=(2+cos(u))*cos(v);
y=(2+cos(u))*sin(v);
z=sin(u);
1
0
-1
4
2
4
2
0
0
-2
-2
-4
-4
The “Two-Banana” Surface:
x=(2+cos(u))*cos(v)
y=cos(v)*sin(u)
z= sin(v))
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
1
0
-1
-3
-2
-1
0
1
2
3
Gravity well
x=u*cos(v)
y=u*sin(v)
z=log(u)
Geodesics are used in theoretical Physics and Astronomy to chart the paths of
elementary particles as they travel through space. Though such equations actually
involve four dimensions and are beyond the scope of this paper, the following image is
nevertheless often used to explain the attractive role of massive bodies due to gravity.
3
2
1
0
-1
-2
-3
-10
0
10
10
20
5
0
-5
-10
Conclusion:
We have shown how to compute a geodesic given a surface and initial conditions
for position and velocity. In doing so, we have made the assumption that the surface is
defined by orthogonal unit vectors. We defined a geodesic as a path whose acceleration
is 0. We could have arrived at the same result by defining other characteristics of a
geodesic. For instance, one can define a geodesic as the shortest distance between two
points. But however a geodesic path is found, that path lends itself to not only helping
define the nature of the surface, but to provide the shortest path between any two points.
Applications run the gamut from charting flight declinations to modeling the movement
of elementary particles.
Appendix
Matlab M-files used to calculate and graph geodesics:
Four separate M-files were written for this process. Geodesic1 is the main file. It is
here where you define your surface in R3 with three orthogonal unit vectors in terms of u
and v (the orthogonal R2 cooridnates). Define your time interval and initial conditions.
To run the program, enter geodesic1 in the command window. This file will run the
three function m-files. The surface(x,y,z) function m-file draws a three
dimensional grid of your surface. geodesic2(x,y,z)calculates the differentials used
in the second order ordinary differential equations. These values are passed to the
geodesic3(t,xx,flag,C) m-file as the C variable matrix. The
geodesic3(t,xx,flag,C) file defines the system of second order ODE’s.
Geodesic1 runs the ode23s program on geodesic3(t,xx,flag,C) .
ode23s integrates the system of differential equations from time T0 to TFINAL with
initial conditions for position and velocity.
%geodesic1
u=sym('u');
v=sym('v');
%define surface
x=(2+cos(u)).*cos(v);
y=(2+cos(u)).*sin(v);
z=sin(u);
%time interval
dt=[0,20*pi];
%initial conditions INIT=[uinit;duinit;vinit;dvinit]
INIT=[pi/2;.1;-pi/2;.1];
surface(x,y,z);
%you might have to adjust surface to get the right
%linspace.
hold on
geodesic2(x,y,z);
C=ans;
[t,X]=ode23s('geodesic3',dt,INIT,[],C);
u=X(:,1);
v=X(:,3);
x=subs(x);
y=subs(y);
z=subs(z);
plot3(x,y,z)
function f=surface(x,y,z)
[u,v]=meshgrid(linspace(0,2*pi,25),linspace(0,2*pi,25));
x=subs(x);
y=subs(y);
z=subs(z);
mesh(x,y,z)
hold on
function C=geodesic2(x,y,z)
%this function only works assuming that u and v are
orthogonal
U=[x;y;z];
XsubU=diff(U,'u');
XsubV=diff(U,'v');
E=simple(XsubU.'*XsubU);
G=simple(XsubV.'*XsubV);
EsubU=diff(E,'u');
EsubV=diff(E,'v');
GsubU=diff(G,'u');
GsubV=diff(G,'v');
C=[E;G;EsubU;EsubV;GsubU;GsubV];
function xp=geodesic3(t,xx,flag,C);
xp=zeros(4,1);
u=xx(1);
v=xx(3);
H=(C(3)/(2*C(1)));
H=subs(H);
I=subs(C(4)/C(1));
J=subs(C(5)/(2*C(1)));
K=subs(C(4)/(2*C(2)));
L=subs(C(5)/C(2));
M=subs(C(6)/(2*C(2)));
xp(1)=xx(2);
xp(2)=-H*xx(2)^2-I*xx(2)*xx(4)+J*xx(4)^2;
xp(3)=xx(4);
xp(4)=K*xx(2)^2-L*xx(2)*xx(4)-M*xx(4)^2;
Works Cited
Chesler, Paul. “Numerical Solutions for Geodesics on Two Dimensional Surfaces.”
May 21, 1999.
“Geodesic”. 4/30/2005. Wikipedia, The Free Encyclopedia. 5/11/05
<http://en.wikipedia.org/wiki/Geodesic>.
Lewis, Jacob. “Geodesics Using Mathematica.” Columbia University. 5/11/2005
<http://www.rose-hulman.edu/mathjournal/2002/vol3-n1/paper3/v3n13pd.pdf#search='geodesic%20R2'>
Oprea, John. Differential Geometry and its Applications, Prentice Hall, 1997.
Download