Open CASCADE Technology  6.5.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Protected Member Functions
NIS_Surface Class Reference

#include <NIS_Surface.hxx>

Inheritance diagram for NIS_Surface:
Inheritance graph
[legend]

Public Types

enum  DisplayMode { Shading, Wireframe }

Public Member Functions

 NIS_Surface (const Handle_Poly_Triangulation &theTri, const Handle_NCollection_BaseAllocator &theAlloc=0L)
 NIS_Surface (const TopoDS_Shape &theShape, const Standard_Real theDeflection, const Handle_NCollection_BaseAllocator &theAl=0L)
virtual ~NIS_Surface ()
void Init (const TopoDS_Shape &theShape, const Standard_Real theDefl)
void Clear ()
Standard_Integer NNodes () const
Standard_Integer NTriangles () const
Standard_Integer NEdges () const
const Standard_ShortRealNode (const Standard_Integer theIndex) const
const Standard_IntegerTriangle (const Standard_Integer theIndex) const
const Standard_IntegerEdge (const Standard_Integer theIndex) const
const Standard_ShortRealNormal (const Standard_Integer theIndex) const
virtual NIS_DrawerDefaultDrawer (NIS_Drawer *) const
void SetColor (const Quantity_Color &theColor)
void SetBackColor (const Quantity_Color &theColor)
void SetPolygonOffset (const Standard_Real theValue)
void SetDisplayMode (const DisplayMode theMode)
DisplayMode GetDisplayMode () const
virtual void Clone (const Handle_NCollection_BaseAllocator &theAll, Handle_NIS_InteractiveObject &theDest) const
virtual Standard_Real Intersect (const gp_Ax1 &theAxis, const Standard_Real theOver) const
virtual Standard_Boolean Intersect (const Bnd_B3f &theBox, const gp_Trsf &theTrf, const Standard_Boolean isFull) const
virtual Standard_Boolean Intersect (const NCollection_List< gp_XY > &thePolygon, const gp_Trsf &theTrf, const Standard_Boolean isFullIn) const

Protected Member Functions

 NIS_Surface (const Handle_NCollection_BaseAllocator &theAl)
virtual void computeBox ()
Standard_Boolean computeNormal (Standard_Integer theIndex, gp_XYZ &theNormal) const

Detailed Description

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.

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.

This class is conceived as replacement of AIS_Shape; both wireframe and shading modes are available for dynamic switching.


Member Enumeration Documentation

Enumerator:
Shading 
Wireframe 

Constructor & Destructor Documentation

NIS_Surface::NIS_Surface ( const Handle_Poly_Triangulation &  theTri,
const Handle_NCollection_BaseAllocator &  theAlloc = 0L 
)

Constructor

NIS_Surface::NIS_Surface ( const TopoDS_Shape theShape,
const Standard_Real  theDeflection,
const Handle_NCollection_BaseAllocator &  theAl = 0L 
)

Constructor. Creates the presentation of all faces in 'theShape' object.

Parameters:
theShapeSource geometry. It should contain triangulations inside.
theDeflectionAbsolute deflection for meshing 'theShape' if such meshing is needed.
theAlAllocator used for nodes and triangles in this presentation.
virtual NIS_Surface::~NIS_Surface ( ) [virtual]

Destructor

NIS_Surface::NIS_Surface ( const Handle_NCollection_BaseAllocator &  theAl) [protected]

Allocator for method Clone().


Member Function Documentation

Deallocate all internal data structures.

virtual void NIS_Surface::Clone ( const Handle_NCollection_BaseAllocator &  theAll,
Handle_NIS_InteractiveObject &  theDest 
) const [virtual]

Create a copy of theObject except its ID.

Parameters:
theAllAllocator where the Dest should store its private data.
theDest[in-out] The target object where the data are copied. If passed NULL then the target should be created.

Reimplemented from NIS_InteractiveObject.

virtual void NIS_Surface::computeBox ( ) [protected, virtual]

Create a 3D bounding box of the object.

Implements NIS_InteractiveObject.

Standard_Boolean NIS_Surface::computeNormal ( Standard_Integer  theIndex,
gp_XYZ theNormal 
) const [protected]

Compute normal to the surface at the node with the given index. Returns true if the vertex is artificial at this node.

virtual NIS_Drawer* NIS_Surface::DefaultDrawer ( NIS_Drawer ) const [virtual]

Create a default drawer instance.

Implements NIS_InteractiveObject.

Access to array of integers that represents an Edge.

Returns:
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.

Query the current display mode: Shading or Wireframe.

Initialize the instance with a TopoDS_Shape. Used in constructor but can be called any time to redefine the geometry.

virtual Standard_Real NIS_Surface::Intersect ( const gp_Ax1 theAxis,
const Standard_Real  theOver 
) const [virtual]

Intersect the surface shading/wireframe geometry with a line/ray.

Parameters:
theAxisThe line or ray in 3D space.
theOverHalf-thickness of the selecting line - ignored.
Returns:
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.

Implements NIS_InteractiveObject.

virtual Standard_Boolean NIS_Surface::Intersect ( const Bnd_B3f theBox,
const gp_Trsf theTrf,
const Standard_Boolean  isFull 
) const [virtual]

Intersect the surface shading/wireframe geometry with an oriented box.

Parameters:
theBox3D box of selection
theTrfPosition/Orientation of the box.
isFullTrue if full inclusion is required, False - if partial.
Returns:
True if the InteractiveObject geometry intersects the box or is inside it

Reimplemented from NIS_InteractiveObject.

virtual Standard_Boolean NIS_Surface::Intersect ( const NCollection_List< gp_XY > &  thePolygon,
const gp_Trsf theTrf,
const Standard_Boolean  isFullIn 
) const [virtual]

Intersect the surface shading/wireframe geometry with a selection polygon.

Parameters:
thePolygonthe 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.
theTrfPosition/Orientation of the polygon.
isFullInTrue if full inclusion is required, False - if partial.
Returns:
True if the InteractiveObject geometry intersects the polygon or is inside it

Reimplemented from NIS_InteractiveObject.

Query the number of edges for wireframe display.

Query the number of nodes.

Query the node by its index.

Returns:
pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)

Query the normal vector at the given triangulation node (by index)

Returns:
pointer to array of 3 Standard_ShortReal values (X,Y,Z coordinates)

Query the number of triangles.

Set the color for presentation of the back side of triangles.

Parameters:
theColorNew color to use for the presentation.

Set the normal color for presentation.

Parameters:
theColorNew color to use for the presentation.

Set the display mode: Shading or Wireframe. The default mode is Shading.

Set the offset for the presentation.

Parameters:
theValueNew offset to use for the presentation.

Query the triangle by its index.

Returns:
pointer to array of 3 Standard_Integer values (nodes 0, 1, 2)

The documentation for this class was generated from the following file: