![]() |
![]() |
![]() |
|||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||||
![]() |
|
![]() |
|||||||||||||||||
![]() |
![]() |
![]() |
![]() |
geom_utils.hGo to the documentation of this file.00001 /* 00002 * This file is part of Healpix_cxx. 00003 * 00004 * Healpix_cxx is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * Healpix_cxx is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with Healpix_cxx; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 * 00018 * For more information about HEALPix, see http://healpix.jpl.nasa.gov 00019 */ 00020 00021 /* 00022 * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik 00023 * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt 00024 * (DLR). 00025 */ 00026 00027 /*! \file geom_utils.h 00028 * Geometric utility functions. 00029 * 00030 * Copyright (C) 2003, 2006 Max-Planck-Society 00031 * \author Martin Reinecke 00032 * \author Reinhard Hell 00033 */ 00034 00035 #include "cxxutils.h" 00036 #include "vec3.h" 00037 00038 /*! Returns the orientation when looking from point \a loc on the unit 00039 sphere in the direction \a dir. \a loc must be normalized. The result 00040 ranges from -pi to pi, is 0 for North and pi/2 for West, i.e. the angle 00041 is given in mathematically positive sense. 00042 00043 If \a loc is the North or South pole, the returned angle is 00044 \a atan2(dir.y,dir.x). */ 00045 inline double orientation (const vec3 &loc, const vec3 &dir) 00046 { 00047 // FIXME: here is still optimization potential 00048 if (loc.x==0 && loc.y==0) 00049 { 00050 if (loc.z>0) return safe_atan2(dir.y,-dir.x); 00051 else return safe_atan2(dir.y,dir.x); 00052 } 00053 vec3 east (-loc.y, loc.x, 0); 00054 vec3 north = crossprod(loc,east); 00055 double y = dotprod(dir,east); 00056 double x = dotprod(dir,north); 00057 return safe_atan2(-y,x); 00058 } 00059 00060 /*! Returns the angle between \a v1 and \a v2 in radians. */ 00061 inline double v_angle (const vec3 &v1, const vec3 &v2) 00062 { 00063 return atan2 (crossprod(v1,v2).Length(), dotprod(v1,v2)); 00064 } Generated on Fri Jun 18 16:12:29 2010 for LevelS C++ support library |
![]() |
![]() |
![]() |
![]() |
||||
![]() |
|
![]() |
||||
![]() |
![]() |
![]() |
||||
![]() |
|
![]() |
||||
![]() |
![]() |
![]() |
||||
![]() |
![]() |
![]() |