/usr/include/crystalspace-2.0/csutil/sparse3d.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 | /*
Sparse 3-D matrix.
Copyright (C) 1998-2001 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_SPARSE3D_H__
#define __CS_SPARSE3D_H__
/**\file
* 3D sparse matrix
*/
#include "csextern.h"
/**
* General 3D sparse matrix class. This is an abstract class.
* Specific implementations are csWideSparse3D and csDenseSparse3D.
*/
class CS_CRYSTALSPACE_EXPORT csSparse3D
{
public:
///
csSparse3D () { }
///
virtual ~csSparse3D () { }
///
virtual void Clear () = 0;
///
virtual void Set (int x, int y, int z, void* obj) = 0;
///
virtual void* Get (int x, int y, int z) = 0;
///
virtual void Del (int x, int y, int z) = 0;
};
/**
* This implementation of csSparse3D is very suited where the
* accesses will be very widely spaced (for example: one element
* at (-1000,0,0) and one at (1000,0,0)). Getting and setting
* elements is not as efficient as with DenseSparse3D but it
* consumes less memory.
* \todo Current implementation is very naive. The list should
* be sorted to make searching at least a little more efficient.
* <p>
* This implementation of Sparse3D is better suited when accesses
* are close together. The speed of access is much better (no need
* to scan lists).
*/
class CS_CRYSTALSPACE_EXPORT csWideSparse3D : public csSparse3D
{
private:
///
struct SparseCell
{
int z;
void* obj;
SparseCell* next, * prev;
};
///
struct HdY
{
HdY () { first_z = 0; }
int y;
HdY* next, * prev;
SparseCell* first_z;
};
///
struct HdX
{
HdX () { first_y = 0; }
int x;
HdX* next, * prev;
HdY* first_y;
};
///
HdX* first_x;
///
HdX* get_header_x (int x);
///
HdY* get_header_y (HdX* y_list, int y);
///
SparseCell* get_cell_z (HdY* z_list, int z);
public:
///
csWideSparse3D ();
///
virtual ~csWideSparse3D ();
///
virtual void Clear ();
///
virtual void Set (int x, int y, int z, void* obj);
///
virtual void* Get (int x, int y, int z);
///
virtual void Del (int x, int y, int z);
};
#endif // __CS_SPARSE3D_H__
|