/usr/include/crystalspace-2.0/csgeom/polyidx.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) 1998 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_POLYIDX_H__
#define __CS_POLYIDX_H__
/**\file
* General polygon (space-agnostic).
*/
/**
* \addtogroup geom_utils
* @{ */
#include "csextern.h"
/**
* The following class represents a general polygon.
* Vertices are indexed relative to some vertex array instead of directly
* represented in the polygon. Note that this polygon has no
* knowledge of the actual values of the vertices. It only keeps
* the indices. So it can actually be used both for 3D and 2D polygons.
*/
class CS_CRYSTALSPACE_EXPORT csPolyIndexed
{
protected:
/// The vertex indices.
int* vertices_idx;
///
int num_vertices;
///
int max_vertices;
public:
/**
* Make a new empty polygon.
*/
csPolyIndexed (int start_size = 10);
/// Copy constructor.
csPolyIndexed (csPolyIndexed& copy);
/// Destructor.
virtual ~csPolyIndexed ();
/// Assignment operator.
csPolyIndexed& operator = (const csPolyIndexed& other);
/**
* Initialize the polygon to empty.
*/
void MakeEmpty ();
/**
* Get the number of vertices.
*/
int GetVertexCount () const { return num_vertices; }
/**
* Get the array with all vertex indices.
*/
int* GetVertexIndices () { return vertices_idx; }
/**
* Get the array with all vertex indices.
*/
const int* GetVertexIndices () const { return vertices_idx; }
/**
* Get the specified vertex index.
*/
int GetVertex (int i) const
{
if (i<0 || i>=num_vertices) return -1;
return vertices_idx[i];
}
/**
* Get the specified vertex index.
*/
int& operator[] (int i)
{
CS_ASSERT (i >= 0 && i < num_vertices);
return vertices_idx[i];
}
/**
* Get the specified vertex index.
*/
int& operator[] (int i) const
{
CS_ASSERT (i >= 0 && i < num_vertices);
return vertices_idx[i];
}
/**
* Make room for at least the specified number of vertices.
*/
void MakeRoom (int new_max);
/**
* Add a vertex index to the polygon.
* Return index of added index.
*/
int AddVertex (int i);
};
/** @} */
#endif // __CS_POLYIDX_H__
|