# Visualization
TKNIS
NIS

# NIS_Triangulated Class Reference

`#include <NIS_Triangulated.hxx>`

Inheritance diagram for NIS_Triangulated:

[legend]

## Public Member Functions

Standard_EXPORT | NIS_Triangulated (const Standard_Integer nNodes=0, const Handle_NCollection_BaseAllocator &=0L)
Standard_EXPORT void | SetPolygonsPrs (const Standard_Integer nPolygons, const Standard_Integer nNodes=0)
Standard_EXPORT void | SetTriangulationPrs (const Standard_Integer nTriangles, const Standard_Integer nNodes=0)
Standard_EXPORT void | SetLinePrs (const Standard_Integer nPoints, const Standard_Boolean isClosed, const Standard_Integer nNodes=0)
Standard_EXPORT void | SetSegmentPrs (const Standard_Integer nSegments, const Standard_Integer nNodes=0)
Standard_Boolean | IsTriangulation () const
Standard_Boolean | IsPolygons () const
Standard_Boolean | IsLine (Standard_Boolean &isLoop) const
Standard_Boolean | IsSegments () const
Standard_EXPORT void | Clear ()
virtual Standard_EXPORT | ~NIS_Triangulated ()
virtual Standard_EXPORT Handle_NIS_Drawer | DefaultDrawer () const
Standard_EXPORT void | SetNode (const Standard_Integer ind, const gp_XYZ &thePnt)
Standard_EXPORT void | SetNode (const Standard_Integer ind, const gp_XY &thePnt)
Standard_EXPORT void | SetTriangle (const Standard_Integer ind, const Standard_Integer iNode0, const Standard_Integer iNode1, const Standard_Integer iNode2)
Standard_EXPORT Standard_Integer * | SetPolygon (const Standard_Integer ind, const Standard_Integer theSz)
Standard_EXPORT void | SetLineNode (const Standard_Integer ind, const Standard_Integer iNode)
Standard_Integer | NNodes () const
Standard_Integer | NTriangles () const
Standard_Integer | NLineNodes () const
Standard_Integer | NPolygons () const
const Standard_ShortReal * | Node (const Standard_Integer ind) const
const Standard_Integer * | Triangle (const Standard_Integer ind) const
const Standard_Integer * | LineNode (const Standard_Integer ind) const
const Standard_Integer | Polygon (const Standard_Integer ind, Standard_Integer *&outInd) const
Standard_EXPORT void | SetDrawPolygons (const Standard_Boolean isDrawPolygons, const Standard_Boolean isUpdateViews=Standard_True)
Standard_EXPORT void | SetColor (const Quantity_Color &theColor, const Standard_Boolean isUpdateV=Standard_True)
Standard_EXPORT Quantity_Color | GetColor (const NIS_Drawer::DrawType theDrawType) const
Standard_EXPORT void | SetHilightColor (const Quantity_Color &theColor, const Standard_Boolean isUpdateV=Standard_True)
Standard_EXPORT void | SetDynHilightColor (const Quantity_Color &theColor, const Standard_Boolean isUpdateV=Standard_True)
Standard_EXPORT void | SetLineWidth (const Standard_Real theWidth, const Standard_Boolean isUpdateV=Standard_True)
Standard_EXPORT Standard_Real | Intersect (const gp_Ax1 &theAxis, const Standard_Real theOver) const
virtual Standard_EXPORT Standard_Boolean | Intersect (const Bnd_B3f &theBox, const gp_Trsf &theTrf, const Standard_Boolean isFull) const

## Static Public Member Functions

static Standard_EXPORT 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)
static Standard_EXPORT 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)
static Standard_EXPORT int | seg_box_intersect (const Bnd_B3f &theBox, const gp_Pnt thePnt[2])
static Standard_EXPORT int | seg_box_included (const Bnd_B3f &theBox, const gp_Pnt thePnt[2])
static Standard_EXPORT void | ComputeBox (Bnd_B3f &theBox, const Standard_Integer nNodes, const Standard_ShortReal *pNodes)

## Protected Types

enum | { Type_None = 0, Type_Loop = 1, Type_Line = 2, Type_Segments = 4, Type_Triangulation = 8, Type_Polygons = 16 }

## Protected Member Functions

virtual Standard_EXPORT void | computeBox ()
Standard_EXPORT void | allocateNodes (const Standard_Integer nNodes)

## Protected Attributes

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

## Detailed Description

Block of comments describing class NIS_Triangulated

## Member Enumeration Documentation

anonymous enum`[protected]`

Enumeration values:

  Type_None |
  Type_Loop |
  Type_Line |
  Type_Segments |
  Type_Triangulation |
  Type_Polygons |

## Constructor & Destructor Documentation

Standard_EXPORT NIS_Triangulated::NIS_Triangulated | ( | const Standard_Integer | nNodes = `0`,
|  | const Handle_NCollection_BaseAllocator & | = `0L`
| ) |

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

virtual Standard_EXPORT NIS_Triangulated::~NIS_Triangulated | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

Standard_EXPORT void NIS_Triangulated::allocateNodes | ( | const Standard_Integer | nNodes | ) | `[protected]`

| Create the memory buffer for the declared number of nodes, old nodes are deallocated.

Standard_EXPORT void NIS_Triangulated::Clear | ( |  | ) |

| Reset all data memebers and free all allocated memory. Called from the destructor, also can be usedto re-initialize a given Interactive Objects.

virtual Standard_EXPORT void NIS_Triangulated::computeBox | ( |  | ) | `[protected, virtual]`

| Create a 3D bounding box of the object. Implements NIS_InteractiveObject.

static Standard_EXPORT void NIS_Triangulated::ComputeBox | ( | Bnd_B3f & | theBox,
|  | const Standard_Integer | nNodes,
|  | const Standard_ShortReal * | pNodes
| ) | `[static]`

virtual Standard_EXPORT Handle_NIS_Drawer NIS_Triangulated::DefaultDrawer | ( |  | ) | const`[virtual]`

| Create a default drawer instance. Implements NIS_InteractiveObject.

Standard_EXPORT Quantity_Color NIS_Triangulated::GetColor | ( | const NIS_Drawer::DrawType | theDrawType | ) | const

Get Normal, Transparent or Hilighted color of the presentation.

Parameters:

  | theDrawType | The draw type, for which the color is retrieved.

virtual Standard_EXPORT Standard_Boolean NIS_Triangulated::Intersect | ( | const Bnd_B3f & | theBox,
|  | const gp_Trsf & | theTrf,
|  | const Standard_Boolean | isFull
| ) | const`[virtual]`

Intersect the InteractiveObject geometry with an oriented box.

Parameters:

  | theBox | 3D box of selection
  | theTrf | Position/Orientation of the box.
  | isFull | True 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.

Standard_EXPORT Standard_Real NIS_Triangulated::Intersect | ( | const gp_Ax1 & | theAxis,
|  | const Standard_Real | theOver
| ) | const`[virtual]`

Intersect the InteractiveObject geometry with a line/ray.

Parameters:

  | theAxis | The line or ray in 3D space.
  | theOver | Half-thickness of the selecting line.

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

Implements NIS_InteractiveObject.

Standard_Boolean NIS_Triangulated::IsLine | ( | Standard_Boolean & | isLoop | ) | const`[inline]`

| Query if there is Line component in the presentation.

Standard_Boolean NIS_Triangulated::IsPolygons | ( |  | ) | const`[inline]`

| Query if there is Polygons component in the presentation.

Standard_Boolean NIS_Triangulated::IsSegments | ( |  | ) | const`[inline]`

| Query if there is Segments component in the presentation.

Standard_Boolean NIS_Triangulated::IsTriangulation | ( |  | ) | const`[inline]`

| Query if there is Triangulation component in the presentation.

const Standard_Integer* NIS_Triangulated::LineNode | ( | const Standard_Integer | ind | ) | const`[inline]`

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.

Returns:
  pointer to the Integer value representing the index of the node.

Standard_Integer NIS_Triangulated::NLineNodes | ( |  | ) | const`[inline]`

| Query the number of line points.

Standard_Integer NIS_Triangulated::NNodes | ( |  | ) | const`[inline]`

| Query the number of nodes.

const Standard_ShortReal* NIS_Triangulated::Node | ( | const Standard_Integer | ind | ) | const`[inline]`

Query the node by its index.

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

Standard_Integer NIS_Triangulated::NPolygons | ( |  | ) | const`[inline]`

| Query the number of polygons.

Standard_Integer NIS_Triangulated::NTriangles | ( |  | ) | const`[inline]`

| Query the number of triangles.

const Standard_Integer NIS_Triangulated::Polygon | ( | const Standard_Integer | ind,
|  | Standard_Integer *& | outInd
| ) | const`[inline]`

Query the polygon.

Parameters:

  | ind | rank of the polygon [0 .. N-1]
  | outInd | `[out]` array of vertex indice

Returns:
  number of vertice in the polygon - the dimension of outInd array

static Standard_EXPORT int NIS_Triangulated::seg_box_included | ( | const Bnd_B3f & | theBox,
|  | const gp_Pnt | thePnt[2]
| ) | `[static]`

static Standard_EXPORT int NIS_Triangulated::seg_box_intersect | ( | const Bnd_B3f & | theBox,
|  | const gp_Pnt | thePnt[2]
| ) | `[static]`

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

Standard_EXPORT void NIS_Triangulated::SetColor | ( | const Quantity_Color & | theColor,
|  | const Standard_Boolean | isUpdateV = `Standard_True`
| ) |

Set the normal color for presentation.

Parameters:

  | theColor | New color to use for the presentation.
  | isUpdateV | True if all views should be updated, otherwise wait till the next update

Standard_EXPORT void NIS_Triangulated::SetDrawPolygons | ( | const Standard_Boolean | isDrawPolygons,
|  | const Standard_Boolean | isUpdateViews = `Standard_True`
| ) |

Set the boolean flag defining if the polygons or the triangulation should be drawn. This method does not affect the presentation of Line/Segments.

Parameters:

  | isDrawPolygons | True defines that no triangulation is drawn, only polygons are. False defines that only triangulation is draw, no polygons.
  | isUpdateV | True if all views should be updated, otherwise wait till the next update

Standard_EXPORT void NIS_Triangulated::SetDynHilightColor | ( | const Quantity_Color & | theColor,
|  | const Standard_Boolean | isUpdateV = `Standard_True`
| ) |

Set the color for dynamic hilight presentation.

Parameters:

  | theColor | New color to use for the presentation.
  | isUpdateV | True if all views should be updated, otherwise wait till the next update

Standard_EXPORT void NIS_Triangulated::SetHilightColor | ( | const Quantity_Color & | theColor,
|  | const Standard_Boolean | isUpdateV = `Standard_True`
| ) |

Set the color for hilighted presentation.

Parameters:

  | theColor | New color to use for the presentation.
  | isUpdateV | True if all views should be updated, otherwise wait till the next update

Standard_EXPORT void NIS_Triangulated::SetLineNode | ( | const Standard_Integer | ind,
|  | const Standard_Integer | iNode
| ) |

| Define the line node by index.

Standard_EXPORT void NIS_Triangulated::SetLinePrs | ( | const Standard_Integer | nPoints,
|  | const Standard_Boolean | isClosed,
|  | const Standard_Integer | nNodes = `0`
| ) |

Define the line presentration (polygon through points)

Parameters:

  | nPoints | Number of nodes defining the line. If set to 0, line is cancelled
  | isClosed | True if the polygon is closed, so the segment between the first and the last points is created automatically.
  | 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 NIS_Triangulated::SetLineWidth | ( | const Standard_Real | theWidth,
|  | const Standard_Boolean | isUpdateV = `Standard_True`
| ) |

Set the width of line presentations in pixels.

Parameters:

  | theWidth | New line width to use for the presentation.
  | isUpdateV | True if all views should be updated, otherwise wait till the next update

Standard_EXPORT void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind,
|  | const gp_XY & | thePnt
| ) |

| Define the coordinates of node [ind]. Z coordinate is assigned to 0.

Standard_EXPORT void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind,
|  | const gp_XYZ & | thePnt
| ) |

| Define the coordinates of node [ind].

Standard_EXPORT Standard_Integer* NIS_Triangulated::SetPolygon | ( | const Standard_Integer | ind,
|  | const Standard_Integer | theSz
| ) |

Allocate a single polygon, should be called for each polygon following the call SetPolygonsPrs().

Parameters:

  | ind | Index of the polygon, should be [0..Npolygons-1]
  | theSz | Number of points (segments) in the polygon.

Returns:
  Pointer to the allocated buffer where you should store the indices of all polygon nodes in order, total "theSz" integers.

Standard_EXPORT void NIS_Triangulated::SetPolygonsPrs | ( | const Standard_Integer | nPolygons,
|  | const Standard_Integer | nNodes = `0`
| ) |

Define the polygonal presentration.

Parameters:

  | nPolygons | Number of separate polygons. If set to 0, polygons are cancelled
  | 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 NIS_Triangulated::SetSegmentPrs | ( | const Standard_Integer | nSegments,
|  | const Standard_Integer | nNodes = `0`
| ) |

Define the segments presentration. Each segment is defined by 2 nodes

Parameters:

  | nSegments | Number of segments. If set to 0, segments presentation is cancelled
  | 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 NIS_Triangulated::SetTriangle | ( | const Standard_Integer | ind,
|  | const Standard_Integer | iNode0,
|  | const Standard_Integer | iNode1,
|  | const Standard_Integer | iNode2
| ) |

| Define the triangle [ind] by indices of its three nodes.

Standard_EXPORT void NIS_Triangulated::SetTriangulationPrs | ( | const Standard_Integer | nTriangles,
|  | const Standard_Integer | nNodes = `0`
| ) |

Define the triangulated presentration.

Parameters:

  | nTriangles | Number of triangles. If set to 0, triangulation is cancelled
  | nNodes | Optional: Number of nodes to allocate. If left as 0, the previous nodes allocation is used, otherwise a new allocation is created.

static Standard_EXPORT int NIS_Triangulated::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
| ) | `[static]`

const Standard_Integer* NIS_Triangulated::Triangle | ( | const Standard_Integer | ind | ) | const`[inline]`

Query the triangle by its index.

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

## Field Documentation

NCollection_BaseAllocator* NIS_Triangulated::myAlloc `[protected]`

Standard_Boolean NIS_Triangulated::myIsDrawPolygons `[protected]`

Standard_Integer NIS_Triangulated::myNLineNodes `[protected]`

Standard_Integer NIS_Triangulated::myNNodes `[protected]`

Standard_Integer NIS_Triangulated::myNPolygons `[protected]`

Standard_Integer NIS_Triangulated::myNTriangles `[protected]`

Standard_Integer* NIS_Triangulated::mypLines `[protected]`

Standard_ShortReal* NIS_Triangulated::mypNodes `[protected]`

Standard_Integer** NIS_Triangulated::mypPolygons `[protected]`

Standard_Integer* NIS_Triangulated::mypTriangles `[protected]`

Standard_Integer NIS_Triangulated::myType `[protected]`

| Combination of Type_* constants

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

- NIS_Triangulated.hxx