source: projectionDesigner/tag/ProjectionDesigner_1.1.5/projdesigner/include/gmtl/SphereOps.h @ 2

Last change on this file since 2 was 2, checked in by Torben Dannhauer, 10 years ago
File size: 3.0 KB
Line 
1/************************************************************** ggt-head beg
2 *
3 * GGT: Generic Graphics Toolkit
4 *
5 * Original Authors:
6 *   Allen Bierbaum
7 *
8 * -----------------------------------------------------------------
9 * File:          SphereOps.h,v
10 * Date modified: 2003/08/30 17:13:13
11 * Version:       1.7
12 * -----------------------------------------------------------------
13 *
14 *********************************************************** ggt-head end */
15/*************************************************************** ggt-cpr beg
16*
17* GGT: The Generic Graphics Toolkit
18* Copyright (C) 2001,2002 Allen Bierbaum
19*
20* This library is free software; you can redistribute it and/or
21* modify it under the terms of the GNU Lesser General Public
22* License as published by the Free Software Foundation; either
23* version 2.1 of the License, or (at your option) any later version.
24*
25* This library is distributed in the hope that it will be useful,
26* but WITHOUT ANY WARRANTY; without even the implied warranty of
27* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28* Lesser General Public License for more details.
29*
30* You should have received a copy of the GNU Lesser General Public
31* License along with this library; if not, write to the Free Software
32* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33*
34 ************************************************************ ggt-cpr end */
35#ifndef _GMTL_SPHEREOPS_H_
36#define _GMTL_SPHEREOPS_H_
37
38#include <gmtl/Sphere.h>
39#include <gmtl/VecOps.h>
40#include <gmtl/Math.h>
41
42namespace gmtl
43{
44
45/** @ingroup Compare Sphere
46 * @name Sphere Comparitors
47 * @{
48 */
49
50/**
51 * Compare two spheres to see if they are EXACTLY the same.
52 *
53 * @param s1      the first sphere to compare
54 * @param s2      the second sphere to compare
55 *
56 * @return  true if they are equal, false otherwise
57 */
58template< class DATA_TYPE >
59inline bool operator==( const Sphere<DATA_TYPE>& s1, const Sphere<DATA_TYPE>& s2 )
60{
61   return ( (s1.mCenter == s2.mCenter) && (s1.mRadius == s2.mRadius) );
62}
63
64/**
65 * Compare two spheres to see if they are not EXACTLY the same.
66 *
67 * @param s1      the first sphere to compare
68 * @param s2      the second sphere to compare
69 *
70 * @return  true if they are not equal, false otherwise
71 */
72template< class DATA_TYPE >
73inline bool operator!=( const Sphere<DATA_TYPE>& s1, const Sphere<DATA_TYPE>& s2 )
74{
75   return (! (s1 == s2));
76}
77
78/**
79 * Compare two spheres to see if they are the same within the given tolerance.
80 *
81 * @param s1      the first sphere to compare
82 * @param s2      the second sphere to compare
83 * @param eps     the tolerance value to use
84 *
85 * @pre eps must be >= 0
86 *
87 * @return  true if they are equal within a tolerance, false otherwise
88 */
89template< class DATA_TYPE >
90inline bool isEqual( const Sphere<DATA_TYPE>& s1, const Sphere<DATA_TYPE>& s2, const DATA_TYPE& eps )
91{
92   gmtlASSERT( eps >= 0 );
93   return ( (isEqual(s1.mCenter, s2.mCenter, eps)) &&
94            (Math::isEqual(s1.mRadius, s2.mRadius, eps)) );
95}
96/** @} */
97
98} // namespace gmtl
99
100#endif
101
Note: See TracBrowser for help on using the repository browser.