0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / BRepExtrema / BRepExtrema_TriangleSet.hxx
CommitLineData
558e68ea 1// Created on: 2014-10-20
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BRepExtrema_TriangleSet_HeaderFile
17#define _BRepExtrema_TriangleSet_HeaderFile
18
19#include <TopoDS_Face.hxx>
558e68ea 20#include <BVH_PrimitiveSet.hxx>
21
22//! List of shapes and their IDs for collision detection.
23typedef NCollection_Vector<TopoDS_Face> BRepExtrema_ShapeList;
24
25//! Triangle set corresponding to specific face.
ae9a414a 26class BRepExtrema_TriangleSet : public BVH_PrimitiveSet<Standard_Real, 3>, public Standard_Transient
558e68ea 27{
28public:
29
30 //! Creates empty triangle set.
31 Standard_EXPORT BRepExtrema_TriangleSet();
32
33 //! Creates triangle set from the given face.
34 Standard_EXPORT BRepExtrema_TriangleSet (const BRepExtrema_ShapeList& theFaces);
35
36 //! Releases resources of triangle set.
37 Standard_EXPORT ~BRepExtrema_TriangleSet();
38
39public: //! @name methods implementing BVH set interface
40
41 //! Returns total number of triangles.
42 Standard_Integer Size() const;
43
44 //! Returns AABB of the given triangle.
45 BVH_Box<Standard_Real, 3> Box (const Standard_Integer theIndex) const;
46
47 //! Returns centroid position along specified axis.
48 Standard_Real Center (const Standard_Integer theIndex, const Standard_Integer theAxis) const;
49
50 //! Swaps indices of two specified triangles.
51 void Swap (const Standard_Integer theIndex1, const Standard_Integer theIndex2);
52
53public:
54
55 //! Clears triangle set data.
56 Standard_EXPORT void Clear();
57
58 //! Initializes triangle set.
59 Standard_EXPORT Standard_Boolean Init (const BRepExtrema_ShapeList& theFaces);
60
61 //! Returns vertices of the given triangle.
62 Standard_EXPORT void GetVertices (const Standard_Integer theIndex,
63 BVH_Vec3d& theVertex1,
64 BVH_Vec3d& theVertex2,
65 BVH_Vec3d& theVertex3) const;
66
67 //! Returns face ID of the given triangle.
68 Standard_EXPORT Standard_Integer GetFaceID (const Standard_Integer theIndex) const;
69
70protected:
71
72 //! Array of vertex indices.
73 BVH_Array4i myTriangles;
74
75 //! Array of vertex UV params.
76 BVH_Array2d myVertUVArray;
77
78 //! Array of vertex coordinates.
79 BVH_Array3d myVertexArray;
80
ae9a414a 81public:
82
ec357c5c 83 DEFINE_STANDARD_RTTI(BRepExtrema_TriangleSet, Standard_Transient)
ae9a414a 84
558e68ea 85};
86
ae9a414a 87DEFINE_STANDARD_HANDLE (BRepExtrema_TriangleSet, Standard_Transient)
88
558e68ea 89#endif // _BRepExtrema_TriangleSet_HeaderFile