Game Development Reference

In-Depth Information

k

P

φ

r

θ

j

i

Figure C.3.
Spherical coordinates.

angle formed between the
z
axis and the line connecting
P
to the origin. The po-

lar angle
φ
always satisfies 0
φ π

≤≤

.

The Cartesian coordinates

x yz
corresponding to a point having spherical

,,

coordinates

r θφ
are given by

,,

x r φθ

y r φθ

zr φ

=

=

=

sin

cos

sin

sin

cos

.

(C.13)

The spherical coordinates

r θφ
can be written in terms of the Cartesian coor-

,,

dinates

x yz
as follows.

,,

(

)

2

2

2

rxyz

,,

=++

x

y

z

x

(

)

(

)

−

1

θ xyz

,,

=

sgn

y

cos

2

2

x

+

y

z

(

)

−

1

φ xyz

,,

=

cos

(C.14)

2

2

2

xyz

++

Search Nedrilad ::

Custom Search