3c4e78f2 |
1 | // Created on: 2013-12-20 |
2 | // Created by: Denis BOGOLEPOV |
d5f74e42 |
3 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
3c4e78f2 |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
d5f74e42 |
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 |
3c4e78f2 |
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 _BVH_Triangulation_Header |
17 | #define _BVH_Triangulation_Header |
18 | |
19 | #include <BVH_PrimitiveSet.hxx> |
20 | |
679d3878 |
21 | //! Triangulation as an example of BVH primitive set. |
22 | //! \tparam T Numeric data type |
23 | //! \tparam N Vector dimension |
3c4e78f2 |
24 | template<class T, int N> |
25 | class BVH_Triangulation : public BVH_PrimitiveSet<T, N> |
26 | { |
27 | public: |
28 | |
3a7a7013 |
29 | typedef typename BVH::VectorType<T, N>::Type BVH_VecNt; |
3c4e78f2 |
30 | |
31 | public: |
32 | |
679d3878 |
33 | //! Creates empty triangulation. |
3c4e78f2 |
34 | BVH_Triangulation(); |
35 | |
679d3878 |
36 | //! Releases resources of triangulation. |
3c4e78f2 |
37 | virtual ~BVH_Triangulation(); |
38 | |
39 | public: |
40 | |
41 | //! Array of vertex coordinates. |
3a7a7013 |
42 | typename BVH::ArrayType<T, N>::Type Vertices; |
3c4e78f2 |
43 | |
679d3878 |
44 | //! Array of indices of triangle vertices. |
3c4e78f2 |
45 | BVH_Array4i Elements; |
46 | |
47 | public: |
48 | |
679d3878 |
49 | //! Returns total number of triangles. |
3c4e78f2 |
50 | virtual Standard_Integer Size() const; |
51 | |
679d3878 |
52 | //! Returns AABB of the given triangle. |
3c4e78f2 |
53 | virtual BVH_Box<T, N> Box (const Standard_Integer theIndex) const; |
54 | |
679d3878 |
55 | //! Returns centroid position along the given axis. |
3c4e78f2 |
56 | virtual T Center (const Standard_Integer theIndex, |
57 | const Standard_Integer theAxis) const; |
58 | |
679d3878 |
59 | //! Performs transposing the two given triangles in the set. |
3c4e78f2 |
60 | virtual void Swap (const Standard_Integer theIndex1, |
61 | const Standard_Integer theIndex2); |
62 | |
63 | }; |
64 | |
65 | #include <BVH_Triangulation.lxx> |
66 | |
67 | #endif // _BVH_Triangulation_Header |