This file is indexed.

/usr/include/psurface/DomainPolygon.h is in libpsurface-dev 2.0.0-2+b1.

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
198
199
200
201
202
203
204
205
206
#ifndef DOMAIN_POLYGON_H
#define DOMAIN_POLYGON_H

#include "Domains.h"
#include "PlaneParam.h"
#include "PSurface.h"

#include "psurfaceAPI.h"


namespace psurface {

template <class ctype> class DomainTriangle;
template <class ctype> class CircularPatch;


/** A polygon carrying a plane triangulation */
class PSURFACE_API DomainPolygon : public PlaneParam<float> {
public:
    /// standard constructor
    DomainPolygon(PSurface<2,float>* _par) : par(_par) {};

    ///
    ~DomainPolygon() {};

    /// use of assignment operator and copy constructor is blocked
private:
    DomainPolygon& operator=(const DomainPolygon& rhs) {return *this;}

    DomainPolygon(const DomainPolygon& other) {}

public:
        
    ///
    void init(const DomainTriangle<float>& tri, const StaticVector<float,2> coords[3]);


    enum NodeLocation {IN_TRIANGLE, ON_SEGMENT, IN_POLYGON};
    ///
    NodeIdx cornerNode(int i) const {
        
        return edgePoints[i][0];
    }

    ///
    NodeIdx getNextEdgeNode(NodeIdx n) const {
        assert(!nodes[n].isINTERIOR_NODE());

        int edge    = nodes[n].getDomainEdge();
        int edgePos = nodes[n].getDomainEdgePosition();

        if (edgePos!=edgePoints[edge].size()-1) {
            return edgePoints[edge][edgePos+1];
        } else {
            int edge = (nodes[n].getDomainEdge()+1)%boundaryPoints.size();
            return edgePoints[edge][1];
        }
    }

    ///
    NodeIdx getPreviousEdgeNode(NodeIdx n) const {
       assert(!nodes[n].isINTERIOR_NODE());

        int edgePos = nodes[n].getDomainEdgePosition();

        if (edgePos!=0) {
            return edgePoints[nodes[n].getDomainEdge()][edgePos-1];
        } else {
            int edge = (nodes[n].getDomainEdge()+boundaryPoints.size()-1)%boundaryPoints.size();
            return edgePoints[edge][edgePoints[edge].size()-2];
        }
    }

    ///
    void unflipTriangles() {
        PlaneParam<float>::unflipTriangles(par->iPos);
    }

    ///
    void applyParametrization() {
        PlaneParam<float>::applyParametrization(par->iPos);
    }

    ///
    void garbageCollection() {
        std::vector<int> offArr;
        garbageCollection(offArr);
    }

    ///
    void garbageCollection(std::vector<int>& offArr);

    ///
    void createPointLocationStructure();

    ///
    void insertExtraEdges();
        
    /// merges the polygon with a triangle
    void mergeTriangle(int tri, StaticVector<float,2> coords[3], int& newCenterNode,
                       std::vector<unsigned int>& nodeStack);

    /** \brief This uses a given triangulation to cut a DomainPolygon into a
     * set of DomainTriangles.
     *
     */
    bool triangulate(CircularPatch<float> &fillIn, 
                     std::vector<unsigned int>& nodeStack);

    ///
    void cutParameterEdges(int boundaryIdx, NodeIdx startNode, NodeIdx lastNode,
                           std::vector<int>& nodeLocs,
                           DomainTriangle<float>& cT,
                           const std::tr1::array<StaticVector<float,2>, 3>& newTriangleCoords,
                           std::vector<int>& triNewEdgePoints,
                           std::vector<int>& polyNewEdgePoints,
                           std::vector<unsigned int>& nodeStack);

    ///
    NodeIdx splitNode(NodeIdx cN, std::vector<int>& nodeLocs);

    ///
    unsigned int createNodePosition(std::vector<StaticVector<float,3> >& nodePositions, std::vector<unsigned int>& nodeStack,
                                    const StaticVector<float,3>& newImagePos);

    /// removes a vertex from the polygon
    void removeVertex(int point);

    /// does a cut from a given node to the first boundaryVertex
    void slice(int centerNode, int centerVertex, int bVertex);

    /** \brief Determines the intersection point of \f$(p1, p2) \f$ and (p3, p4) as the affine
     *  combination of p1 and p2 
     *
     * \todo Rewrite this */
    float computeIntersection(float &mu, const StaticVector<float,2> &p1, const StaticVector<float,2> &p2, 
                              const StaticVector<float,2> &p3, const StaticVector<float,2> &p4);

    /** \brief Transforms the domain positions into a world coordinate system
     *
     * Assuming that the domain positions of the nodes contained in the
     * PlaneParam underlying this DomainPolygon are given in barycentric 
     * coordinates, this function 
     * transforms them into a world coordinates.  The new coordinate system
     * is specified by supplying new coordinates for the three points
     * (1,0), (0,1), and (0, 0).  The transformation can be restricted
     * to nodes appearing in the local node array with a fixed index
     * or higher.
     *
     * \param newNodeIdx 
     * \param a, b, c : The new coordinates of the points \f$(1,0)\f$, 
     * \f$(0,1)\f$, and \f$(0,0)\f$, respectively.
     */
    void installWorldCoordinates(int newNodeIdx, const StaticVector<float,2> &a, const StaticVector<float,2> &b, const StaticVector<float,2> &c){
        for (int i=newNodeIdx; i<nodes.size(); i++)
            nodes[i].setDomainPos(a*nodes[i].domainPos()[0] + b*nodes[i].domainPos()[1] + 
                c*(1-nodes[i].domainPos()[0]-nodes[i].domainPos()[1]));
    }

    void augmentNeighborIdx(int newNodeIdx, std::tr1::array<std::vector<int>, 3>& edgePoints) {
        int i,d = newNodeIdx;

        for (i=newNodeIdx; i<nodes.size(); i++)
            for (int j=0; j<nodes[i].degree(); j++)
                nodes[i].neighbors(j) += d;

        for (i=0; i<3; i++)
            for (int j=0; j<edgePoints[i].size(); j++)
                edgePoints[i][j] += d;
    }

    void updateEdgePoints(std::tr1::array<std::vector<int>,3>& edgePoints, int oldNode, int newNode) {
        int i;
        for (i=0; i<3; i++){
            if (edgePoints[i][0]==oldNode)
                edgePoints[i][0] = newNode;
            if (edgePoints[i].back()==oldNode)
                edgePoints[i].back() = newNode;
        }
    }


    /**@name debug code */
    //@{
    /// prints info about the triangle (to stdout)
    void print(bool showEdgePoints=false, bool showParamEdges=false, bool showNodes=false) const;

    /// 
    void checkConsistency(const char* where);
    //@}

    ////////////////////////////////////////////

    /// a list of the boundary points
    std::vector<int> boundaryPoints;

    /// for each edge of the polygon, a list of the mapping nodes that are right on this edge
    std::vector<std::vector<int> > edgePoints;

    PSurface<2,float>* par;

};

} // namespace psurface

#endif