Graphics Gems II by James Arvo

Graphics Gems II by James Arvo

Author:James Arvo
Language: eng
Format: mobi, pdf
Tags: Computer Graphics Mathematics, Computer Graphics, Programming, Games, Computers
ISBN: 9780120644810
Publisher: Academic Press
Published: 1991-09-15T16:37:22+00:00


 k

Moreover, we now can take

Q = P ,

j

0 j

N = {( P – P ) × ( P – P )}/|( P – P ) × ( P – P )|

j

1 j

0 j

2 j

0 j

1 j

0 j

2 j

0 j

Putting this all together, we get the formula:

1 

 

Volume(Polyhedron) = ∑ ( P ⋅ N ) N ⋅ ∑ P × P

6

0 j

j

j

kj

k +1, j

j



k

 ,

where N is defined in the preceding in terms of the vertices of the

j

polyhedron. Notice again that these two formulas for volume are valid

even for nonconvex polyhedra.

See also I.1 The Area of a Simple Polygon, Jon Rokne

GRAPHICS GEMS II Edited by JAMES ARVO

171

IV.2 GETTING AROUND ON A SPHERE

IV.2

GETTING AROUND ON A

SPHERE

Clifford A. Shaffer

Virginia Tech

Blacksburg, Virginia

Given a point P on a sphere, this gem describes how to compute the new

coordinates that result from moving in some direction. I recently used

this material when developing a browsing system for world-scale maps.

When “looking down” at a position on the sphere, the user of the

browsing system can shift the view to the left, right, up, or down.

The first thing to realize is that while latitude and longitude are

convenient for people, most calculations for the sphere are done more

easily in Cartesian coordinates. Given longitude λ, latitude φ, and a

sphere of radius R with center at the origin of the coordinate system, the

conversions are:

x = R cos λ cos φ;

y = R sin λ cos φ;

z = R sin φ;

 y

z

R = x 2 + y 2 + z 2 ;

λ = arctan   ;

φ = arctan

x

 x 2 + y 2  .

Given point P on the sphere, the plane T tangent to the sphere at P

will have its normal vector going from the origin through P. Thus, the

first three coefficients for the plane equation will be T = P , T = P ,

a

x

b

y

T = P . Since the plane must contain P, T = –( P ⋅ P), i.e., the negative c

z

d

of the dot product between the vector from the origin to P and itself.

Movement on the sphere must be in some direction. One way to specify

directions is by means of a great circle G going through the current point

P. In this way, we can describe movement as either along G, or in a

direction at some angle at G. G will be contained in some plane J, with

J = 0 (since it must go through the origin). For example, the plane for

d

the great circle containing point P and the north pole N at (0, 1, 0) will

GRAPHICS GEMS II Edited by JAMES ARVO

172

IV.2 GETTING AROUND ON A SPHERE

have normal P × N, or the cross product of the vector from the origin to

P with the vector from the origin to N. Taking the cross product in this

order will make rotations by θ appear clockwise when looking along the

direction of the normal vector from the plane.

Moving along the great circle simply will be a rotation by some angle θ.

The rotation axis will be the normal vector for the plane of the great

circle.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.