/usr/include/oce/NIS_Surface.hxx is in liboce-visualization-dev 0.18.2-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 | // Created on: 2008-03-19
// Created by: Alexander GRIGORIEV
// Copyright (c) 2008-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef NIS_Surface_HeaderFile
#define NIS_Surface_HeaderFile
#include <NIS_InteractiveObject.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <gp_XYZ.hxx>
class Quantity_Color;
class Handle(Poly_Triangulation);
class TopoDS_Shape;
/**
* Presentation of a meshed surface.
* Consists of 4 arrays: Nodes, Triangles, Normals and Edges. Normals are
* defined in nodes, so the number of stored normals is strictly the number of
* nodes. Edges is an array of pointers: each pointer starts an array of
* node indices that define a single edge (i.e., a polygon that can be closed or
* open, no matter). The first number in the edge is the number of nodes in it.
* <p>
* Instances of this class can be initialized either atomically (setting every
* node and triangle and edge) or from a TopoDS_Shape object. In side the
* TopoDS_Shape only triangulations in faces are used; edges are taken from
* PolygonOnTriangulation also belonging to faces.
* <p>
* This class is conceived as replacement of AIS_Shape; both wireframe and
* shading modes are available for dynamic switching.
*/
class NIS_Surface : public NIS_InteractiveObject
{
public:
enum DisplayMode {
Shading,
Wireframe
};
/**
* Constructor
*/
Standard_EXPORT NIS_Surface(const Handle(Poly_Triangulation)& theTri,
const Handle(NCollection_BaseAllocator)&
theAlloc =0L);
/**
* Constructor. Creates the presentation of all faces in 'theShape' object.
* @param theShape
* Source geometry. It should contain triangulations inside.
* @param theDeflection
* Absolute deflection for meshing 'theShape' if such meshing is needed.
* @param theAl
* Allocator used for nodes and triangles in this presentation.
*/
Standard_EXPORT NIS_Surface(const TopoDS_Shape& theShape,
const Standard_Real theDeflection,
const Handle(NCollection_BaseAllocator)& theAl=0L);
/**
* Destructor
*/
Standard_EXPORT virtual ~NIS_Surface ();
/**
* Initialize the instance with a TopoDS_Shape. Used in constructor but can
* be called any time to redefine the geometry.
*/
Standard_EXPORT void Init (const TopoDS_Shape& theShape,
const Standard_Real theDefl);
/**
* Deallocate all internal data structures.
*/
Standard_EXPORT void Clear ();
/**
* 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 edges for wireframe display.
*/
inline Standard_Integer NEdges () const { return myNEdges; }
/**
* 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 theIndex) const
{
return &mypNodes[theIndex * 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 theIndex) const
{
return &mypTriangles[theIndex * 3];
}
/**
* Access to array of integers that represents an Edge.
* @return
* Pointer to array where the 0th element is the number of nodes in the edge
* and the elements starting from the 1st are node indices.
*/
inline const Standard_Integer*
Edge (const Standard_Integer theIndex) const
{
return mypEdges[theIndex];
}
/**
* Query the normal vector at the given triangulation node (by index)
* @return
* pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)
*/
inline const Standard_ShortReal*
Normal (const Standard_Integer theIndex) const
{
return &mypNormals[theIndex * 3];
}
/**
* Create a default drawer instance.
*/
Standard_EXPORT virtual NIS_Drawer *
DefaultDrawer (NIS_Drawer *) const;
/**
* Set the normal color for presentation.
* @param theColor
* New color to use for the presentation.
*/
Standard_EXPORT void SetColor (const Quantity_Color& theColor);
/**
* Set the color for presentation of the back side of triangles.
* @param theColor
* New color to use for the presentation.
*/
Standard_EXPORT void SetBackColor (const Quantity_Color& theColor);
/**
* Set the offset for the presentation.
* @param theValue
* New offset to use for the presentation.
*/
Standard_EXPORT void SetPolygonOffset (const Standard_Real theValue);
/**
* Set the display mode: Shading or Wireframe.
* The default mode is Shading.
*/
Standard_EXPORT void SetDisplayMode (const DisplayMode theMode);
/**
* Query the current display mode: Shading or Wireframe.
*/
Standard_EXPORT DisplayMode
GetDisplayMode () const;
/**
* Create a copy of theObject except its ID.
* @param theAll
* Allocator where the Dest should store its private data.
* @param theDest
* <tt>[in-out]</tt> The target object where the data are copied. If
* passed NULL then the target should be created.
*/
Standard_EXPORT virtual void
Clone (const Handle(NCollection_BaseAllocator)& theAll,
Handle(NIS_InteractiveObject)& theDest) const;
/**
* Intersect the surface shading/wireframe geometry with a line/ray.
* @param theAxis
* The line or ray in 3D space.
* @param theOver
* Half-thickness of the selecting line - ignored.
* @return
* If the return value is more than 0.1*RealLast() then no intersection is
* detected. Otherwise returns the coordinate of the nearest intersection
* on the ray. May be negative.
*/
Standard_EXPORT virtual Standard_Real
Intersect (const gp_Ax1& theAxis,
const Standard_Real theOver) const;
/**
* Intersect the surface shading/wireframe 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;
/**
* Intersect the surface shading/wireframe geometry with a selection polygon.
* @param thePolygon
* the list of vertices of a free-form closed polygon without
* self-intersections. The last point should not coincide with the first
* point of the list. Any two neighbor points should not be confused.
* @param theTrf
* Position/Orientation of the polygon.
* @param isFullIn
* True if full inclusion is required, False - if partial.
* @return
* True if the InteractiveObject geometry intersects the polygon or is
* inside it
*/
Standard_EXPORT virtual Standard_Boolean Intersect
(const NCollection_List<gp_XY> &thePolygon,
const gp_Trsf &theTrf,
const Standard_Boolean isFullIn) const;
protected:
/**
* Allocator for method Clone().
*/
Standard_EXPORT NIS_Surface (const Handle(NCollection_BaseAllocator)& theAl);
/**
* Create a 3D bounding box of the object.
*/
Standard_EXPORT virtual void computeBox ();
/**
* Compute normal to the surface at the node with the given index.
* Returns true if the vertex is artificial at this node.
*/
Standard_Boolean computeNormal (Standard_Integer theIndex,
gp_XYZ& theNormal) const;
private:
Handle(NCollection_BaseAllocator) myAlloc;
//! Array of nodes in triangles
Standard_ShortReal * mypNodes;
//! Array of normals (TriNodes)
Standard_ShortReal * mypNormals;
//! Array of triangles (node indices)
Standard_Integer * mypTriangles;
//! Array of edges, each edge is an array of indices prefixed by N nodes
Standard_Integer ** mypEdges;
//! Number of nodes in triangles
Standard_Integer myNNodes;
Standard_Integer myNTriangles;
Standard_Integer myNEdges;
Standard_Boolean myIsWireframe;
public:
// Declaration of CASCADE RTTI
DEFINE_STANDARD_RTTI (NIS_Surface)
};
// Definition of HANDLE object using Standard_DefineHandle.hxx
DEFINE_STANDARD_HANDLE (NIS_Surface, NIS_InteractiveObject)
#endif
|