This file is indexed.

/usr/include/crystalspace-2.0/csgeom/obb.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
    Copyright (C) 2002 by Jorrit Tyberghein
    Copyright (C) 2002 by Daniel Duhprey

    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_OBB_H__
#define __CS_OBB_H__

/**\file 
 * Oriented bounding box.
 */
/**
 * \addtogroup geom_utils
 * @{ */

#include "csextern.h"

#include "csgeom/box.h"
#include "csgeom/matrix3.h"

class csVector3;
class csReversibleTransform;

/**
 * Oriented bounding box (OBB). This is basically
 * a csBox3 with a matrix to rotate it.
 */
class CS_CRYSTALSPACE_EXPORT csOBB : public csBox3
{
private:
  csMatrix3 mMat;

public:
  /**
   * Initialize the OBB to empty with identity transform.
   */
  csOBB () {}

  /**
   * Copy constructor.
   */
  csOBB (const csOBB &b) : csBox3 (b), mMat (b.mMat) { }

  /**
   * Initialize the OBB to the given AABB with identity transform.
   */
  csOBB (const csBox3 &b) : csBox3 (b) { }

  /**
   * Construct an OBB from the three given vectors. This will
   * setup the orientation.
   * dir1 are the two vertices furthest appart.
   * dir2 is the two vertices after moving them to the plane perpendicular
   * to dir1 and dir3 is the cross of dir1 and dir2.
   */
  csOBB (const csVector3 &dir1, const csVector3 &dir2,
  	const csVector3 &dir3);

  void AddBoundingVertex (const csVector3 &v);
  csVector3 GetCorner (int corner) const; 

  /**
   * Get the rotation matrix for the OBB
   */
  inline const csMatrix3 &GetMatrix () const 
  { return mMat; }

  /**
   * Get the rotation matrix for the OBB
   */
  inline csMatrix3 &GetMatrix () 
  { return mMat; }


  /**
   * Get the diameter of this OBB.
   */
  float Diameter ();

  /**
   * Get the volume of this OBB.
   */
  float Volume ();

  /**
   * Given the table of vertices find a csOBB that matches this table.
   * This is a faster version that FindOBBAccurate() but it is less
   * accurate.
   */
  void FindOBB (const csVector3 *vertex_table, int num, float eps = 0.0);

  /**
   * Given the table of vertices find a csOBB that matches this table.
   * This version is a lot slower than FindOBB but it gives a more accurate
   * OBB.
   */
  void FindOBBAccurate (const csVector3 *vertex_table, int num);
};

/**
 * Version of the csOBB with frozen corners (for optimization purposes).
 */
class CS_CRYSTALSPACE_EXPORT csOBBFrozen
{
private:
  csVector3 corners[8];

public:
  /**
   * Copy a normal OBB and freeze the corners.
   */
  inline void Copy (const csOBB& obb)
  {
    for (int i = 0 ; i < 8 ; i++)
    {
      corners[i] = obb.GetCorner (i);
    }
  }

  /**
   * Copy a normal OBB and freeze the corners.
   */
  void Copy (const csOBB& obb, const csReversibleTransform& trans);

  /**
   * Create an empty csOBBFrozen which is not initialized.
   */
  csOBBFrozen ()
  {
  }

  /**
   * Create a frozen OBB from a normal OBB.
   */
  csOBBFrozen (const csOBB& obb)
  {
    Copy (obb);
  }

  /**
   * Create a frozen OBB from a normal OBB.
   * The given transform is applied to the vertices
   * AFTER the matrix of the obb is applied (using
   * Other2This).
   */
  csOBBFrozen (const csOBB& obb, const csReversibleTransform& trans)
  {
    Copy (obb, trans);
  }

  /**
   * Get one corner from the OBB.
   */
  inline const csVector3& GetCorner (int corner) const
  {
    CS_ASSERT (corner >= 0 && corner < 8);
    return corners[corner];
  }

  //@{
  /**
   * Project this OBB to a 2D screen space box.
   * Returns false if OBB is not on screen.
   */
  bool ProjectOBB (float fov, float sx, float sy, csBox2& sbox,
	float& min_z, float& max_z);
  bool ProjectOBB (const CS::Math::Matrix4& projection, csBox2& sbox,
	float& min_z, float& max_z, int screenWidth, int screenHeight);
  //@}
};

/** @} */

#endif // __CS_OBB_H__