This file is indexed.

/usr/include/wfmath-0.3/wfmath/rotbox_funcs.h is in libwfmath-0.3-dev 0.3.12-3ubuntu2.

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
// rotbox_funcs.h (line rotbox implementation)
//
//  The WorldForge Project
//  Copyright (C) 2000, 2001  The WorldForge Project
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program 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 General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//  For information about WorldForge and its authors, please contact
//  the Worldforge Web Site at http://www.worldforge.org.
//

// Author: Ron Steinke

#ifndef WFMATH_ROT_BOX_FUNCS_H
#define WFMATH_ROT_BOX_FUNCS_H

#include <wfmath/rotbox.h>

#include <wfmath/vector.h>
#include <wfmath/point.h>
#include <wfmath/axisbox.h>
#include <wfmath/ball.h>

#include <cassert>

namespace WFMath {

template<int dim>
inline RotBox<dim>& RotBox<dim>::operator=(const RotBox<dim>& a)
{
  m_corner0 = a.m_corner0;
  m_size = a.m_size;
  m_orient = a.m_orient;

  return *this;
}

template<int dim>
inline bool RotBox<dim>::isEqualTo(const RotBox<dim>& b, double epsilon) const
{
  return Equal(m_corner0, b.m_corner0, epsilon)
      && Equal(m_size, b.m_size, epsilon)
      && Equal(m_orient, b.m_orient, epsilon);
}

template<int dim>
inline Point<dim> RotBox<dim>::getCorner(int i) const
{
  assert(i >= 0 && i < (1 << dim));

  Vector<dim> dist;

  if(i == 0)
    return m_corner0;

  for(int j = 0; j < dim; ++j)
    dist[j] = (i & (1 << j)) ? m_size[j] : 0;

  dist.setValid(m_size.isValid());

  return m_corner0 + Prod(dist, m_orient);
}

template<int dim>
AxisBox<dim> RotBox<dim>::boundingBox() const
{
  Point<dim> min = m_corner0, max = m_corner0;

//  for(int i = 0; i < dim; ++i) {
//    Vector<dim> edge;
//    edge.zero();
//    edge[i] = m_size[i];
//    edge = Prod(edge, m_orient);
//    // Edge now represents the i'th edge
//    // pointing away from m_corner0
//    for(int j = 0; j < dim; ++j) {
//      if(edge[j] < 0)
//        min[j] += edge[j];
//      else
//        max[j] += edge[j];
//    }
//  }

// The following is equivalent to the above. The above is easier to understand,
// so leave it in as a comment.

  for(int i = 0; i < dim; ++i) {
    for(int j = 0; j < dim; ++j) {
      CoordType value = m_orient.elem(j, i) * m_size[j];
      if(value < 0)
        min[i] += value;
      else
        max[i] += value;
    }
  }

  bool valid = isValid();

  min.setValid(valid);
  max.setValid(valid);

  return AxisBox<dim>(min, max, true);
}

// This is here, instead of defined in the class, to
// avoid include order problems

template<int dim>
Point<dim> Point<dim>::toParentCoords(const RotBox<dim>& coords) const
{
  return coords.corner0() + (*this - Point().setToOrigin()) * coords.orientation();
}

template<int dim>
Point<dim> Point<dim>::toLocalCoords(const RotBox<dim>& coords) const
{
  return Point().setToOrigin() + coords.orientation() * (*this - coords.corner0());
}

} // namespace WFMath

#endif  // WFMATH_ROT_BOX_FUNCS_H