This file is indexed.

/usr/include/libwildmagic/Wm5Ellipse2.inl is in libwildmagic-dev 5.13-1+b2.

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
189
190
191
192
193
194
195
196
197
// Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.0 (2010/01/01)

//----------------------------------------------------------------------------
template <typename Real>
Ellipse2<Real>::Ellipse2 ()
{
}
//----------------------------------------------------------------------------
template <typename Real>
Ellipse2<Real>::~Ellipse2 ()
{
}
//----------------------------------------------------------------------------
template <typename Real>
Ellipse2<Real>::Ellipse2 (const Vector2<Real>& center,
    const Vector2<Real> axis[2], const Real extent[2])
    :
    Center(center)
{
    Axis[0] = axis[0];
    Axis[1] = axis[1];
    Extent[0] = extent[0];
    Extent[1] = extent[1];
}
//----------------------------------------------------------------------------
template <typename Real>
Ellipse2<Real>::Ellipse2 (const Vector2<Real>& center,
    const Vector2<Real>& axis0, const Vector2<Real>& axis1,
    const Real extent0, const Real extent1)
    :
    Center(center)
{
    Axis[0] = axis0;
    Axis[1] = axis1;
    Extent[0] = extent0;
    Extent[1] = extent1;
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::GetM (Matrix2<Real>& M) const
{
    Vector2<Real> ratio0 = Axis[0]/Extent[0];
    Vector2<Real> ratio1 = Axis[1]/Extent[1];
    M = Matrix2<Real>(ratio0, ratio0) + Matrix2<Real>(ratio1, ratio1);
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::GetMInverse (Matrix2<Real>& MInverse) const
{
    Vector2<Real> ratio0 = Axis[0]*Extent[0];
    Vector2<Real> ratio1 = Axis[1]*Extent[1];
    MInverse = Matrix2<Real>(ratio0, ratio0) +
        Matrix2<Real>(ratio1, ratio1);
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::ToCoefficients (Real coeff[6]) const
{
    Matrix2<Real> A;
    Vector2<Real> B;
    Real C;
    ToCoefficients(A, B, C);
    Convert(A, B, C, coeff);

    // Arrange for one of the x0^2 or x1^2 coefficients to be 1.
    Real maxValue = Math<Real>::FAbs(coeff[3]);
    int maxIndex = 3;
    Real absValue = Math<Real>::FAbs(coeff[5]);
    if (absValue > maxValue)
    {
        maxValue = absValue;
        maxIndex = 5;
    }

    Real invMaxValue = ((Real)1)/maxValue;
    for (int i = 0; i < 6; ++i)
    {
        if (i != maxIndex)
        {
            coeff[i] *= invMaxValue;
        }
        else
        {
            coeff[i] = (Real)1;
        }
    }
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::ToCoefficients (Matrix2<Real>& A, Vector2<Real>& B,
    Real& C) const
{
    Vector2<Real> ratio0 = Axis[0]/Extent[0];
    Vector2<Real> ratio1 = Axis[1]/Extent[1];
    A = Matrix2<Real>(ratio0, ratio0) + Matrix2<Real>(ratio1, ratio1);
    B = ((Real)-2)*(A*Center);
    C = A.QForm(Center, Center) - (Real)1;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Ellipse2<Real>::FromCoefficients (const Real coeff[6])
{
    Matrix2<Real> A;
    Vector2<Real> B;
    Real C;
    Convert(coeff, A, B, C);
    return FromCoefficients(A, B, C);
}
//----------------------------------------------------------------------------
template <typename Real>
bool Ellipse2<Real>::FromCoefficients (const Matrix2<Real>& A,
    const Vector2<Real>& B, Real C)
{
    // Compute the center K = -A^{-1}*B/2.
    Matrix2<Real> invA = A.Inverse();
    if (invA == Matrix2<Real>::ZERO)
    {
        return false;
    }

    Center = ((Real)-0.5)*(invA*B);

    // Compute B^T*A^{-1}*B/4 - C = K^T*A*K - C = -K^T*B/2 - C.
    Real rightSide = -((Real)0.5)*(Center.Dot(B)) - C;
    if (Math<Real>::FAbs(rightSide) < Math<Real>::ZERO_TOLERANCE)
    {
        return false;
    }

    // Compute M = A/(K^T*A*K - C).
    Real invRightSide = ((Real)1)/rightSide;
    Matrix2<Real> M = invRightSide*A;

    // Factor into M = R*D*R^T.
    EigenDecomposition<Real> eigensystem(M);
    eigensystem.Solve(true);
    for (int i = 0; i < 2; ++i)
    {
        if (eigensystem.GetEigenvalue(i) <= (Real)0)
        {
            return false;
        }

        Extent[i] = Math<Real>::InvSqrt(eigensystem.GetEigenvalue(i));
        Axis[i] = eigensystem.GetEigenvector2(i);
    }

    return true;
}
//----------------------------------------------------------------------------
template <typename Real>
Real Ellipse2<Real>::Evaluate (const Vector2<Real>& point) const
{
    Vector2<Real> diff = point - Center;
    Real ratio0 = Axis[0].Dot(diff)/Extent[0];
    Real ratio1 = Axis[1].Dot(diff)/Extent[1];
    Real value = ratio0*ratio0 + ratio1*ratio1 - (Real)1;
    return value;
}
//----------------------------------------------------------------------------
template <typename Real>
bool Ellipse2<Real>::Contains (const Vector2<Real>& point) const
{
    return (Evaluate(point) <= (Real)0);
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::Convert (const Real coeff[6], Matrix2<Real>& A,
    Vector2<Real>& B, Real& C)
{
    C = coeff[0];
    B[0] = coeff[1];
    B[1] = coeff[2];
    A[0][0] = coeff[3];
    A[0][1] = ((Real)0.5)*coeff[4];
    A[1][0] = A[0][1];
    A[1][1] = coeff[5];
}
//----------------------------------------------------------------------------
template <typename Real>
void Ellipse2<Real>::Convert (const Matrix2<Real>& A,
    const Vector2<Real>& B, Real C, Real coeff[6])
{
    coeff[0] = C;
    coeff[1] = B[0];
    coeff[2] = B[1];
    coeff[3] = A[0][0];
    coeff[4] = ((Real)2)*A[0][1];
    coeff[5] = A[1][1];
}
//----------------------------------------------------------------------------