Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members Related Pages Search
sphericalcoord.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <cmath>
00019
00020 #include "sphericalcoord.h"
00021 #include "cartesian3dcoord.h"
00022
00023 SphericalCoord::SphericalCoord(double a, double p, double r) : azimuthal(a), polar(p), radial(r)
00024 {
00025 }
00026
00027 Cartesian3DCoord SphericalCoord::toCartesianCoord()
00028 {
00029 double x,y,z;
00030
00031 x = radial * cos(azimuthal) * sin(polar);
00032 y = radial * sin(azimuthal) * sin(polar);
00033 z = radial * cos(polar);
00034
00035 return Cartesian3DCoord(x,y,z);
00036 }
|