00001 //# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration) 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: Combinatorics.h 21116 2011-07-21 11:23:15Z gervandiepen $ 00027 00028 #ifndef SCIMATH_GEOMETRY_H 00029 #define SCIMATH_GEOMETRY_H 00030 00031 #include <casacore/casa/aips.h> 00032 #include <casacore/casa/Quanta/Quantum.h> 00033 #include <utility> 00034 00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00036 00037 // <summary> 00038 // Geometry related methods. 00039 // </summary> 00040 00041 // <use visibility=export> 00042 00043 //# <author>Dave Mehringer</author> 00044 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00045 // </reviewed> 00046 // <etymology> 00047 // self-explanatory 00048 // </etymology> 00049 00050 // <synopsis> 00051 // Various geometry related functions 00052 // </synopsis> 00053 00054 // <motivation> 00055 // Commonly used geometrical functions for various image and region 00056 // applications. 00057 // </motivation> 00058 00059 class Geometry { 00060 00061 public: 00062 00063 // Get result of rotating a 2-D vector counterclockwise through an angle 00064 // <src>theta</src>. The output pair will have x as the first 00065 // member and y as the second. <src>theta</src> must have angular units (no explicit 00066 // checking is done, but an exception will be thrown from the Quanta code if not). 00067 static std::pair<Double, Double> rotate2D( 00068 Double x, Double y, const Quantity& theta 00069 ); 00070 00071 // Determine if two coplanar line segments, a and b, intersect. Line segment a 00072 // has end points a0 and a1, and line segment b has endpoints b0 and b1. 00073 // Algorithm from 00074 // http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect 00075 static Bool doLineSegmentsIntersect( 00076 Double a0x, Double a0y, Double a1x, Double a1y, 00077 Double b0x, Double b0y, Double b1x, Double b1y 00078 ); 00079 00080 }; 00081 } //# NAMESPACE CASACORE - END 00082 00083 #endif 00084