Open CASCADE Technology 6.6.0
|
#include <NIS_Triangulated.hxx>
Public Types | |
enum | PolygonType { Polygon_Default = 0, Polygon_Line = 1, Polygon_Fill = 2 } |
Public Member Functions | |
NIS_Triangulated (const Standard_Integer nNodes=0, const Standard_Boolean is2D=Standard_False, const Handle_NCollection_BaseAllocator &theAlloc=0L) | |
void | SetPolygonsPrs (const Standard_Integer nPolygons, const Standard_Integer nNodes=0) |
void | SetTriangulationPrs (const Standard_Integer nTriangles, const Standard_Integer nNodes=0) |
void | SetLinePrs (const Standard_Integer nPoints, const Standard_Boolean isClosed, const Standard_Integer nNodes=0) |
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 |
void | Clear () |
virtual | ~NIS_Triangulated () |
virtual NIS_Drawer * | DefaultDrawer (NIS_Drawer *) const |
void | SetNode (const Standard_Integer ind, const gp_XYZ &thePnt) |
void | SetNode (const Standard_Integer ind, const gp_XY &thePnt) |
void | SetTriangle (const Standard_Integer ind, const Standard_Integer iNode0, const Standard_Integer iNode1, const Standard_Integer iNode2) |
void | SetPolygon (const Standard_Integer ind, const Standard_Integer theSz) |
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 |
void | SetPolygonNode (const Standard_Integer indPoly, const Standard_Integer ind, const Standard_Integer iNode) |
Standard_Integer | PolygonNode (const Standard_Integer indPoly, const Standard_Integer ind) const |
Standard_Integer | NPolygonNodes (const Standard_Integer indPoly) const |
void | SetDrawPolygons (const Standard_Boolean isDrawPolygons) |
void | SetPolygonType (const PolygonType theType) |
void | SetColor (const Quantity_Color &theColor) |
Quantity_Color | GetColor (const NIS_Drawer::DrawType theDrawType) const |
void | SetHilightColor (const Quantity_Color &theColor) |
void | SetDynHilightColor (const Quantity_Color &theColor) |
void | SetLineWidth (const Standard_Real theWidth) |
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 |
virtual void | Delete () const |
Static Public Member Functions | |
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) |
static int | tri2d_line_intersect (const double start[3], const double dir[3], const float V0[2], const float V1[2], const float V2[2], double *tInter) |
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) |
static int | seg2d_line_intersect (const gp_XYZ &aStart, const gp_XYZ &aDir, const double over2, const float V0[2], const float V1[2], double *tInter) |
static int | seg_box_intersect (const Bnd_B3f &theBox, const gp_Pnt thePnt[2]) |
static int | seg_box_included (const Bnd_B3f &theBox, const gp_Pnt thePnt[2]) |
static int | seg_polygon_intersect (const NCollection_List< gp_XY > &thePolygon, const gp_XY thePnt[2]) |
static int | seg_polygon_included (const NCollection_List< gp_XY > &thePolygon, const gp_XY thePnt[2]) |
static void | ComputeBox (Bnd_B3f &theBox, const Standard_Integer nNodes, const Standard_ShortReal *pNodes, const Standard_Integer nCoord) |
static Standard_Boolean | IsIn (const NCollection_List< gp_XY > &thePolygon, const gp_XY &thePoint) |
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 void | computeBox () |
void | allocateNodes (const Standard_Integer nNodes) |
gp_Pnt | nodeAtInd (const Standard_Integer *theArr, const Standard_Integer i) const |
float * | nodeArrAtInd (const Standard_Integer *theArr, const Standard_Integer i) const |
Protected Attributes | |
NCollection_BaseAllocator * | myAlloc |
Usually from InteractiveContext. | |
Standard_Integer | myType |
Combination of Type_* constants. | |
Standard_ShortReal * | mypNodes |
Standard_Integer * | mypTriangles |
Standard_Integer * | mypLines |
Standard_Integer ** | mypPolygons |
Standard_Integer | myNNodes |
Standard_Integer | myNTriangles |
Standard_Integer | myNLineNodes |
unsigned int | myNPolygons: 24 |
Standard_Boolean | myIsDrawPolygons: 1 |
Standard_Boolean | myIsCloned: 1 |
How it is allocated. | |
unsigned int | myIndexType: 2 |
0:8bit, 1:16bit, 2:32bit | |
unsigned int | myNodeCoord: 2 |
2 or 3 coordinates | |
unsigned int | myPolygonType: 2 |
Interactive object that consists of triangles, lines and polygons without normals. Particularly can be used to render planar 2D shapes.
anonymous enum [protected] |
NIS_Triangulated::NIS_Triangulated | ( | const Standard_Integer | nNodes = 0 , |
const Standard_Boolean | is2D = Standard_False , |
||
const Handle_NCollection_BaseAllocator & | theAlloc = 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.
nNodes | Total number of nodes that will be initialized for this object |
is2D | If true then the nodes will be 2D in plane Z=0, otherwise normal 3D. |
theAlloc | Allocator for internal data |
virtual NIS_Triangulated::~NIS_Triangulated | ( | ) | [virtual] |
Destructor.
void NIS_Triangulated::allocateNodes | ( | const Standard_Integer | nNodes | ) | [protected] |
Create the memory buffer for the declared number of nodes, old nodes are deallocated.
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 void NIS_Triangulated::Clone | ( | const Handle_NCollection_BaseAllocator & | theAll, |
Handle_NIS_InteractiveObject & | theDest | ||
) | const [virtual] |
Create a copy of theObject except its ID.
theAll | Allocator 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.
static void NIS_Triangulated::ComputeBox | ( | Bnd_B3f & | theBox, |
const Standard_Integer | nNodes, | ||
const Standard_ShortReal * | pNodes, | ||
const Standard_Integer | nCoord | ||
) | [static] |
virtual void NIS_Triangulated::computeBox | ( | ) | [protected, virtual] |
Allocator-based operator new for dynamic allocations in method Clone() Create a 3D bounding box of the object.
Implements NIS_InteractiveObject.
virtual NIS_Drawer* NIS_Triangulated::DefaultDrawer | ( | NIS_Drawer * | ) | const [virtual] |
Create a default drawer instance.
Implements NIS_InteractiveObject.
virtual void NIS_Triangulated::Delete | ( | ) | const [virtual] |
Implements deallocation of the object instance
Reimplemented from Standard_Transient.
Quantity_Color NIS_Triangulated::GetColor | ( | const NIS_Drawer::DrawType | theDrawType | ) | const |
Get Normal, Transparent or Hilighted color of the presentation.
theDrawType | The draw type, for which the color is retrieved. |
virtual Standard_Real NIS_Triangulated::Intersect | ( | const gp_Ax1 & | theAxis, |
const Standard_Real | theOver | ||
) | const [virtual] |
Intersect the InteractiveObject geometry with a line/ray.
theAxis | The line or ray in 3D space. |
theOver | Half-thickness of the selecting line. |
Implements NIS_InteractiveObject.
virtual 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.
theBox | 3D box of selection |
theTrf | Position/Orientation of the box. |
isFull | True if full inclusion is required, False - if partial. |
Reimplemented from NIS_InteractiveObject.
virtual Standard_Boolean NIS_Triangulated::Intersect | ( | const NCollection_List< gp_XY > & | thePolygon, |
const gp_Trsf & | theTrf, | ||
const Standard_Boolean | isFullIn | ||
) | const [virtual] |
Intersect the InteractiveObject geometry with a selection polygon.
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. |
theTrf | Position/Orientation of the polygon. |
isFullIn | True if full inclusion is required, False - if partial. |
Reimplemented from NIS_InteractiveObject.
static Standard_Boolean NIS_Triangulated::IsIn | ( | const NCollection_List< gp_XY > & | thePolygon, |
const gp_XY & | thePoint | ||
) | [static] |
Classification of thePoint with respect to thePolygon.
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. |
thePoint | the point to be classified. |
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.
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.
float* NIS_Triangulated::nodeArrAtInd | ( | const Standard_Integer * | theArr, |
const Standard_Integer | i | ||
) | const [protected] |
Get the node pointed by the i-th index in the array.
gp_Pnt NIS_Triangulated::nodeAtInd | ( | const Standard_Integer * | theArr, |
const Standard_Integer | i | ||
) | const [protected] |
Get the node pointed by the i-th index in the array.
Standard_Integer NIS_Triangulated::NPolygonNodes | ( | const Standard_Integer | indPoly | ) | const |
Get the number of nodes for the polygon number 'indPoly'.
Standard_Integer NIS_Triangulated::NPolygons | ( | ) | const [inline] |
Query the number of polygons.
Standard_Integer NIS_Triangulated::NTriangles | ( | ) | const [inline] |
Query the number of triangles.
Standard_Integer NIS_Triangulated::PolygonNode | ( | const Standard_Integer | indPoly, |
const Standard_Integer | ind | ||
) | const |
Get the node with index 'ind' from the polygon number 'indPoly'.
static int NIS_Triangulated::seg2d_line_intersect | ( | const gp_XYZ & | aStart, |
const gp_XYZ & | aDir, | ||
const double | over2, | ||
const float | V0[2], | ||
const float | V1[2], | ||
double * | tInter | ||
) | [static] |
static int NIS_Triangulated::seg_box_included | ( | const Bnd_B3f & | theBox, |
const gp_Pnt | thePnt[2] | ||
) | [static] |
static int NIS_Triangulated::seg_box_intersect | ( | const Bnd_B3f & | theBox, |
const gp_Pnt | thePnt[2] | ||
) | [static] |
static 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] |
static int NIS_Triangulated::seg_polygon_included | ( | const NCollection_List< gp_XY > & | thePolygon, |
const gp_XY | thePnt[2] | ||
) | [static] |
static int NIS_Triangulated::seg_polygon_intersect | ( | const NCollection_List< gp_XY > & | thePolygon, |
const gp_XY | thePnt[2] | ||
) | [static] |
void NIS_Triangulated::SetColor | ( | const Quantity_Color & | theColor | ) |
Set the normal color for presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetDrawPolygons | ( | const Standard_Boolean | isDrawPolygons | ) |
Set the boolean flag defining if the polygons or the triangulation should be drawn. This method does not affect the presentation of Line/Segments.
isDrawPolygons | True defines that no triangulation is drawn, only polygons are. False defines that only triangulation is drawn, no polygons. |
void NIS_Triangulated::SetDynHilightColor | ( | const Quantity_Color & | theColor | ) |
Set the color for dynamic hilight presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetHilightColor | ( | const Quantity_Color & | theColor | ) |
Set the color for hilighted presentation.
theColor | New color to use for the presentation. |
void NIS_Triangulated::SetLineNode | ( | const Standard_Integer | ind, |
const Standard_Integer | iNode | ||
) |
Define the line node by index.
void NIS_Triangulated::SetLinePrs | ( | const Standard_Integer | nPoints, |
const Standard_Boolean | isClosed, | ||
const Standard_Integer | nNodes = 0 |
||
) |
Define the line presentration (polygon through points)
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. |
void NIS_Triangulated::SetLineWidth | ( | const Standard_Real | theWidth | ) |
Set the width of line presentations in pixels.
theWidth | New line width to use for the presentation. |
void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind, |
const gp_XYZ & | thePnt | ||
) |
Define the coordinates of node [ind].
void NIS_Triangulated::SetNode | ( | const Standard_Integer | ind, |
const gp_XY & | thePnt | ||
) |
Define the coordinates of node [ind]. Z coordinate is assigned to 0.
void 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(). The polygon can be filled by node indices using the method SetPolygonNode().
ind | Index of the polygon, should be [0..Npolygons-1] |
theSz | Number of points (segments) in the polygon. |
void NIS_Triangulated::SetPolygonNode | ( | const Standard_Integer | indPoly, |
const Standard_Integer | ind, | ||
const Standard_Integer | iNode | ||
) |
Define the node of a polygon by index.
indPoly | Index of the Polygon, should be less than the number of polygons that is defined in SetPolygonsPrs() and can be returned by NPOlygons(). |
ind | Index of the node in the Polygon. Should be less than the parameter theSz in the corresponding previous SetPolygon() call. |
iNode | Index of the node in the given position of the Polygon. |
void NIS_Triangulated::SetPolygonsPrs | ( | const Standard_Integer | nPolygons, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the polygonal presentration.
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. |
void NIS_Triangulated::SetPolygonType | ( | const PolygonType | theType | ) |
Set the type of polygon rendering.
void NIS_Triangulated::SetSegmentPrs | ( | const Standard_Integer | nSegments, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the segments presentration. Each segment is defined by 2 nodes
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. |
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.
void NIS_Triangulated::SetTriangulationPrs | ( | const Standard_Integer | nTriangles, |
const Standard_Integer | nNodes = 0 |
||
) |
Define the triangulated presentration.
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 int NIS_Triangulated::tri2d_line_intersect | ( | const double | start[3], |
const double | dir[3], | ||
const float | V0[2], | ||
const float | V1[2], | ||
const float | V2[2], | ||
double * | tInter | ||
) | [static] |
static 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] |
NCollection_BaseAllocator* NIS_Triangulated::myAlloc [protected] |
unsigned int NIS_Triangulated::myIndexType [protected] |
Standard_Boolean NIS_Triangulated::myIsCloned [protected] |
Standard_Boolean NIS_Triangulated::myIsDrawPolygons [protected] |
Standard_Integer NIS_Triangulated::myNLineNodes [protected] |
Standard_Integer NIS_Triangulated::myNNodes [protected] |
unsigned int NIS_Triangulated::myNodeCoord [protected] |
unsigned int NIS_Triangulated::myNPolygons [protected] |
Standard_Integer NIS_Triangulated::myNTriangles [protected] |
Standard_Integer* NIS_Triangulated::mypLines [protected] |
Standard_ShortReal* NIS_Triangulated::mypNodes [protected] |
unsigned int NIS_Triangulated::myPolygonType [protected] |
Standard_Integer** NIS_Triangulated::mypPolygons [protected] |
Standard_Integer* NIS_Triangulated::mypTriangles [protected] |
Standard_Integer NIS_Triangulated::myType [protected] |