This file is indexed.

/usr/include/opencascade/NIS_Triangulated.hxx is in libopencascade-visualization-dev 6.5.0.dfsg-2build1.

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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// File:      NIS_Triangulated.hxx
// Created:   17.07.07 08:42
// Author:    Alexander GRIGORIEV
// Copyright: Open Cascade 2007


#ifndef NIS_Triangulated_HeaderFile
#define NIS_Triangulated_HeaderFile

#include <NIS_InteractiveObject.hxx>
#include <Quantity_Color.hxx>

class Handle_NIS_TriangulatedDrawer;
class NCollection_BaseAllocator;
class Handle_NCollection_BaseAllocator;

/**
 * Block of comments describing class NIS_Triangulated
 */

class NIS_Triangulated : public NIS_InteractiveObject
{
 protected:
  // Constants defining the mode (type) of presentation. They allow mixed type,
  // e.g., Triangulation+Line. Line and Segments are not mixable, their mix is
  // treated as Line only.
  enum {
    Type_None          =  0,
    Type_Loop          =  1,  // modifier to Line
    Type_Line          =  2,
    Type_Segments      =  4,
    Type_Triangulation =  8,
    Type_Polygons      = 16
  };

 public:
  // ---------- PUBLIC METHODS ----------


  /**
   * Constructor. Optionally defines the number of nodes that will be allocated
   * (this number may be defined later in methods Set*Prs) as well as the
   * memory allocator where the nodes, lines and triangles will be stored by
   * this instance.
   */
  Standard_EXPORT NIS_Triangulated(const Standard_Integer nNodes = 0,
                                   const Handle_NCollection_BaseAllocator& =0L);

  /**
   * Define the polygonal presentration.
   * @param nPolygons
   *   Number of separate polygons. If set to 0, polygons are cancelled
   * @param nNodes
   *   Optional: Number of nodes to allocate. If left as 0, the previous nodes
   *   allocation is used, otherwise a new allocation is created.
   */ 
  Standard_EXPORT void              SetPolygonsPrs
                                        (const Standard_Integer nPolygons,
                                         const Standard_Integer nNodes = 0);

  /**
   * Define the triangulated presentration.
   * @param nTriangles
   *   Number of triangles. If set to 0, triangulation is cancelled
   * @param nNodes
   *   Optional: Number of nodes to allocate. If left as 0, the previous nodes
   *   allocation is used, otherwise a new allocation is created.
   */ 
  Standard_EXPORT void              SetTriangulationPrs
                                        (const Standard_Integer nTriangles,
                                         const Standard_Integer nNodes = 0);

  /**
   * Define the line presentration (polygon through points)
   * @param nPoints
   *   Number of nodes defining the line. If set to 0, line is cancelled
   * @param isClosed
   *   True if the polygon is closed, so the segment between the first and
   *   the last points is created automatically.
   * @param nNodes
   *   Optional: Number of nodes to allocate. If left as 0, the previous nodes
   *   allocation is used, otherwise a new allocation is created.
   */ 
  Standard_EXPORT void              SetLinePrs
                                        (const Standard_Integer nPoints,
                                         const Standard_Boolean isClosed,
                                         const Standard_Integer nNodes = 0);

  /**
   * Define the segments presentration. Each segment is defined by 2 nodes
   * @param nSegments
   *   Number of segments. If set to 0, segments presentation is cancelled
   * @param nNodes
   *   Optional: Number of nodes to allocate. If left as 0, the previous nodes
   *   allocation is used, otherwise a new allocation is created.
   */ 
  Standard_EXPORT void              SetSegmentPrs
                                        (const Standard_Integer nSegments,
                                         const Standard_Integer nNodes = 0);

  /**
   * Query if there is Triangulation component in the presentation.
   */
  inline Standard_Boolean           IsTriangulation () const
  { return (myType & Type_Triangulation) != 0; }

  /**
   * Query if there is Polygons component in the presentation.
   */
  inline Standard_Boolean           IsPolygons  () const
  { return (myType & Type_Polygons) != 0; }

  /**
   * Query if there is Line component in the presentation.
   */
  inline Standard_Boolean           IsLine      (Standard_Boolean& isLoop) const
  { isLoop = (myType & Type_Loop) != 0; return (myType & Type_Line) != 0; }

  /**
   * Query if there is Segments component in the presentation.
   */
  inline Standard_Boolean           IsSegments  () const
  { return (myType & Type_Segments) != 0; }

  /**
   * Reset all data memebers and free all allocated memory.
   * Called from the destructor, also can be usedto re-initialize a given
   * Interactive Objects. 
   */
  Standard_EXPORT void              Clear       ();

  /**
   * Destructor.
   */
  Standard_EXPORT virtual ~NIS_Triangulated     ();

  /**
   * Create a default drawer instance.
   */
  Standard_EXPORT virtual Handle_NIS_Drawer
                                    DefaultDrawer () const;


  /**
   * Define the coordinates of node [ind].
   */
  Standard_EXPORT void              SetNode   (const Standard_Integer  ind,
                                               const gp_XYZ&           thePnt);

  /**
   * Define the coordinates of node [ind]. Z coordinate is assigned to 0.
   */
  Standard_EXPORT void              SetNode   (const Standard_Integer  ind,
                                               const gp_XY&            thePnt);

  /**
   * Define the triangle [ind] by indices of its three nodes.
   */
  Standard_EXPORT void              SetTriangle(const Standard_Integer  ind,
                                                const Standard_Integer  iNode0,
                                                const Standard_Integer  iNode1,
                                                const Standard_Integer  iNode2);

  /**
   * Allocate a single polygon, should be called for each polygon following
   * the call SetPolygonsPrs().
   * @param ind
   *   Index of the polygon, should be [0..Npolygons-1]
   * @param theSz
   *   Number of points (segments) in the polygon.
   * @return
   *   Pointer to the allocated buffer where you should store the indices
   *   of all polygon nodes in order, total "theSz" integers.
   */
  Standard_EXPORT Standard_Integer* SetPolygon (const Standard_Integer  ind,
                                                const Standard_Integer  theSz);

  /**
   * Define the line node by index.
   */
  Standard_EXPORT void              SetLineNode(const Standard_Integer ind,
                                                const Standard_Integer iNode);

  /**
   * Query the number of nodes.
   */
  inline Standard_Integer           NNodes    () const
  { return myNNodes; }

  /**
   * Query the number of triangles.
   */
  inline Standard_Integer           NTriangles() const
  { return myNTriangles; }

  /**
   * Query the number of line points.
   */
  inline Standard_Integer           NLineNodes() const
  { return myNLineNodes; }

  /**
   * Query the number of polygons.
   */
  inline Standard_Integer           NPolygons () const
  { return myNPolygons; }

  /**
   * Query the node by its index.
   * @return
   *   pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)
   */
  inline const Standard_ShortReal * Node      (const Standard_Integer ind) const
  { return &mypNodes[ind*3]; }

  /**
   * Query the triangle by its index.
   * @return
   *   pointer to array of 3 Standard_Integer values (nodes 0, 1, 2)
   */
  inline const Standard_Integer *   Triangle  (const Standard_Integer ind) const
  { return &mypTriangles[ind*3]; }

  /**
   * Query the node of line or segments by index in the array of node indices.
   * This method does not make distinction of the presentation type
   * (field myType), so the correct definition of ind is to be done by the
   * caller.
   * @return
   *   pointer to the Integer value representing the index of the node.
   */
  inline const Standard_Integer *   LineNode  (const Standard_Integer ind) const
  { return &mypLines[ind]; }


  /**
   * Query the polygon.
   * @param ind
   *   rank of the polygon [0 .. N-1]
   * @param outInd
   *   <tt>[out]</tt> array of vertex indice
   * @return
   *   number of vertice in the polygon - the dimension of outInd array
   */
  inline const Standard_Integer     Polygon   (const Standard_Integer ind,
                                               Standard_Integer* & outInd) const
  { return * (outInd = mypPolygons[ind])++; }

  /**
   * Set the boolean flag defining if the polygons or the triangulation
   * should be drawn. This method does not affect the presentation of
   * Line/Segments.
   * @param isDrawPolygons
   *   True defines that no triangulation is drawn, only polygons are. False
   *   defines that only triangulation is draw, no polygons.
   * @param isUpdateV
   *   True if all views should be updated, otherwise wait till the next update
   */
  Standard_EXPORT void              SetDrawPolygons
                                        (const Standard_Boolean isDrawPolygons,
                                         const Standard_Boolean isUpdateViews
                                         = Standard_True);
  /**
   * Set the normal color for presentation.
   * @param theColor
   *   New color to use for the presentation.
   * @param isUpdateV
   *   True if all views should be updated, otherwise wait till the next update
   */
  Standard_EXPORT void              SetColor  (const Quantity_Color&  theColor,
                                               const Standard_Boolean isUpdateV
                                               = Standard_True);

  /**
   * Get Normal, Transparent or Hilighted color of the presentation.
   * @param theDrawType
   *   The draw type, for which the color is retrieved.
   */
  Standard_EXPORT Quantity_Color GetColor  
                          (const NIS_Drawer::DrawType theDrawType) const;

  /**
   * Set the color for hilighted presentation.
   * @param theColor
   *   New color to use for the presentation.
   * @param isUpdateV
   *   True if all views should be updated, otherwise wait till the next update
   */
  Standard_EXPORT void      SetHilightColor   (const Quantity_Color&  theColor,
                                               const Standard_Boolean isUpdateV
                                               = Standard_True);

  /**
   * Set the color for dynamic hilight presentation.
   * @param theColor
   *   New color to use for the presentation.
   * @param isUpdateV
   *   True if all views should be updated, otherwise wait till the next update
   */
  Standard_EXPORT void      SetDynHilightColor(const Quantity_Color&  theColor,
                                               const Standard_Boolean isUpdateV
                                               = Standard_True);

  /**
   * Set the width of line presentations in pixels.
   * @param theWidth
   *   New line width to use for the presentation.
   * @param isUpdateV
   *   True if all views should be updated, otherwise wait till the next update
   */
  Standard_EXPORT void      SetLineWidth      (const Standard_Real    theWidth,
                                               const Standard_Boolean isUpdateV
                                               = Standard_True);

  /**
   * Intersect the InteractiveObject geometry with a line/ray.
   * @param theAxis
   *   The line or ray in 3D space.
   * @param theOver
   *   Half-thickness of the selecting line.
   * @return
   *   If the return value is more than 0.1*RealLast() then no intersection is
   *   detected. Otherwise returns the coordinate of thePnt on the ray. May be
   *   negative.
   */
  Standard_EXPORT Standard_Real
                            Intersect       (const gp_Ax1&       theAxis,
                                             const Standard_Real theOver) const;

  /**
   * Intersect the InteractiveObject geometry with an oriented box.
   * @param theBox
   *   3D box of selection
   * @param theTrf
   *   Position/Orientation of the box.
   * @param isFull
   *   True if full inclusion is required, False - if partial.
   * @return
   *   True if the InteractiveObject geometry intersects the box or is inside it
   */
  Standard_EXPORT virtual Standard_Boolean
                             Intersect     (const Bnd_B3f&         theBox,
                                            const gp_Trsf&         theTrf,
                                            const Standard_Boolean isFull)const;

  Standard_EXPORT static int tri_line_intersect (const double      start[3],
                                                 const double      dir[3],
                                                 const float       V0[3],
                                                 const float       V1[3],
                                                 const float       V2[3],
                                                 double            * tInter);

  Standard_EXPORT static int seg_line_intersect (const gp_XYZ&     aStart,
                                                 const gp_XYZ&     aDir,
                                                 const double      over2,
                                                 const float       V0[3],
                                                 const float       V1[3],
                                                 double            * tInter);

  Standard_EXPORT static int seg_box_intersect  (const Bnd_B3f&    theBox,
                                                 const gp_Pnt      thePnt[2]);

  Standard_EXPORT static int seg_box_included   (const Bnd_B3f&    theBox,
                                                 const gp_Pnt      thePnt[2]);

  Standard_EXPORT static void ComputeBox    (Bnd_B3f&                  theBox,
                                             const Standard_Integer    nNodes,
                                             const Standard_ShortReal* pNodes);

 protected:

  /**
   * Create a 3D bounding box of the object.
   */
  Standard_EXPORT virtual void computeBox     ();

  /**
   * Create the memory buffer for the declared number of nodes, old nodes
   * are deallocated.
   */
  Standard_EXPORT void         allocateNodes  (const Standard_Integer nNodes);

 protected:
  // ---------- PROTECTED FIELDS ----------

  /**
   * Combination of Type_* constants
   */
  Standard_Integer                 myType;
  Standard_ShortReal               *  mypNodes;
  Standard_Integer                 *  mypTriangles;
  Standard_Integer                 *  mypLines;
  Standard_Integer                 ** mypPolygons;
  Standard_Integer                 myNNodes;
  Standard_Integer                 myNTriangles;
  Standard_Integer                 myNPolygons;
  Standard_Integer                 myNLineNodes;
  NCollection_BaseAllocator        * myAlloc;
  Standard_Boolean                 myIsDrawPolygons;

 public:
// Declaration of CASCADE RTTI
DEFINE_STANDARD_RTTI (NIS_Triangulated)
};

// Definition of HANDLE object using Standard_DefineHandle.hxx
DEFINE_STANDARD_HANDLE (NIS_Triangulated, NIS_InteractiveObject)

#endif