casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geometry.h
Go to the documentation of this file.
1 //# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration)
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: Combinatorics.h 21116 2011-07-21 11:23:15Z gervandiepen $
27 
28 #ifndef SCIMATH_GEOMETRY_H
29 #define SCIMATH_GEOMETRY_H
30 
31 #include <casacore/casa/aips.h>
33 #include <utility>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 // <summary>
38 // Geometry related methods.
39 // </summary>
40 
41 // <use visibility=export>
42 
43 //# <author>Dave Mehringer</author>
44 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
45 // </reviewed>
46 // <etymology>
47 // self-explanatory
48 // </etymology>
49 
50 // <synopsis>
51 // Various geometry related functions
52 // </synopsis>
53 
54 // <motivation>
55 // Commonly used geometrical functions for various image and region
56 // applications.
57 // </motivation>
58 
59 class Geometry {
60 
61 public:
62 
63  // Get result of rotating a 2-D vector counterclockwise through an angle
64  // <src>theta</src>. The output pair will have x as the first
65  // member and y as the second. <src>theta</src> must have angular units (no explicit
66  // checking is done, but an exception will be thrown from the Quanta code if not).
67  static std::pair<Double, Double> rotate2D(
68  Double x, Double y, const Quantity& theta
69  );
70 
71  // Determine if two coplanar line segments, a and b, intersect. Line segment a
72  // has end points a0 and a1, and line segment b has endpoints b0 and b1.
73  // Algorithm from
74  // http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
76  Double a0x, Double a0y, Double a1x, Double a1y,
77  Double b0x, Double b0y, Double b1x, Double b1y
78  );
79 
80 };
81 } //# NAMESPACE CASACORE - END
82 
83 #endif
84 
static std::pair< Double, Double > rotate2D(Double x, Double y, const Quantity &theta)
Get result of rotating a 2-D vector counterclockwise through an angle theta.
static Bool doLineSegmentsIntersect(Double a0x, Double a0y, Double a1x, Double a1y, Double b0x, Double b0y, Double b1x, Double b1y)
Determine if two coplanar line segments, a and b, intersect.
Geometry related methods.
Definition: Geometry.h:59
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42