Home

Download

Features

Screenshots

Handbook

Browse Source

Authors

SourceForge.net Logo
Hosted by SourceForge.net

OSI Certified


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Search  

sphericalcoord.cpp

00001 /***************************************************************************
00002                           sphericalcoord.cpp  -  description
00003                              -------------------
00004     begin                : Sat Nov 30 2002
00005     copyright            : (C) 2002 by Fungmeista
00006     email                : mizunoami44@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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 }