0024623: Visualization - improve selection mechanism
[occt.git] / src / BVH / BVH_Triangulation.hxx
CommitLineData
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 24template<class T, int N>
25class BVH_Triangulation : public BVH_PrimitiveSet<T, N>
26{
27public:
28
3a7a7013 29 typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
3c4e78f2 30
31public:
32
679d3878 33 //! Creates empty triangulation.
3c4e78f2 34 BVH_Triangulation();
35
679d3878 36 //! Releases resources of triangulation.
3c4e78f2 37 virtual ~BVH_Triangulation();
38
39public:
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
47public:
48
679d3878 49 //! Returns total number of triangles.
3c4e78f2 50 virtual Standard_Integer Size() const;
51
7c58a2ab 52 //! Returns AABB of entire set of objects.
53 using BVH_PrimitiveSet<T, N>::Box;
54
679d3878 55 //! Returns AABB of the given triangle.
3c4e78f2 56 virtual BVH_Box<T, N> Box (const Standard_Integer theIndex) const;
57
679d3878 58 //! Returns centroid position along the given axis.
3c4e78f2 59 virtual T Center (const Standard_Integer theIndex,
60 const Standard_Integer theAxis) const;
61
679d3878 62 //! Performs transposing the two given triangles in the set.
3c4e78f2 63 virtual void Swap (const Standard_Integer theIndex1,
64 const Standard_Integer theIndex2);
65
66};
67
68#include <BVH_Triangulation.lxx>
69
70#endif // _BVH_Triangulation_Header