/usr/include/crystalspace-2.0/csgeom/tri.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /*
Copyright (C) 2003 by Jorrit Tyberghein
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_TRIANGLE_H__
#define __CS_TRIANGLE_H__
/**\file
* Triangle.
*/
/**
* \addtogroup geom_utils
* @{ */
#include "csextern.h"
namespace CS
{
/**
* A templated triangle. Note that this structure is only sensible if used
* in combination with a vertex or edge table. 'a', 'b', and 'c' are then
* indices in that table (either vertices or edges).
*/
template<typename T>
struct TriangleT
{
#if !defined(__STRICT_ANSI__) && !defined(SWIG)
union
{
struct
{
#endif
//@{
/// Triangle vertices or edges.
T a, b, c;
//@}
#if !defined(__STRICT_ANSI__) && !defined(SWIG)
};
/// All components
T components[3];
};
#endif
/// Empty default constructor
TriangleT () {}
/// Convenience constructor, builds a triangle with initializers
TriangleT (const T& _a, const T& _b, const T& _c) : a(_a), b(_b), c(_c) {}
/// Copy constructor.
TriangleT (const TriangleT& t)
{
a = t.a;
b = t.b;
c = t.c;
}
/// Assignment.
TriangleT& operator= (const TriangleT& t)
{
a = t.a;
b = t.b;
c = t.c;
return *this;
}
/// Set the values.
void Set (const T& _a, const T& _b, const T& _c)
{
a = _a;
b = _b;
c = _c;
}
/// Returns n-th component of the triangle.
#if defined( __STRICT_ANSI__) || defined(SWIG)
inline const T& operator[] (size_t n) const { return !n?a:n&1?b:c; }
#else
inline const T& operator[] (size_t n) const { return components[n]; }
#endif
/// Returns n-th component of the triangle.
#if defined( __STRICT_ANSI__) || defined(SWIG)
inline T& operator[] (size_t n) { return !n?a:n&1?b:c; }
#else
inline T& operator[] (size_t n) { return components[n]; }
#endif
};
}
/**
* A triangle. Note that this structure is only valid if used
* in combination with a vertex or edge table. 'a', 'b', and 'c' are then
* indices in that table (either vertices or edges).
*/
struct csTriangle : public CS::TriangleT<int>
{
csTriangle () {}
/// Convenience constructor, builds a triangle with initializers
csTriangle (int _a, int _b, int _c) : CS::TriangleT<int> (_a, _b, _c) {}
/// Copy constructor.
csTriangle (const CS::TriangleT<int>& t) : CS::TriangleT<int> (t) {}
};
/** @} */
#endif // __CS_TRIANGLE_H__
|