1 // Created on: 2013-12-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BVH_Types_Header
17 #define _BVH_Types_Header
19 // Use this macro to switch between STL and OCCT vector types
20 #define _BVH_USE_STD_VECTOR_
22 #include <NCollection_Vec2.hxx>
23 #include <NCollection_Vec3.hxx>
24 #include <NCollection_Vec4.hxx>
25 #include <NCollection_Vector.hxx>
26 #include <NCollection_Mat4.hxx>
27 #include <Standard_Type.hxx>
33 //! Allows to fast switching between Eigen and NCollection vectors.
34 template<class T, int N> struct VectorType
39 template<class T> struct VectorType<T, 1>
44 template<class T> struct VectorType<T, 2>
46 typedef NCollection_Vec2<T> Type;
49 template<class T> struct VectorType<T, 3>
51 typedef NCollection_Vec3<T> Type;
54 template<class T> struct VectorType<T, 4>
56 typedef NCollection_Vec4<T> Type;
59 template<class T, int N = 1> struct ArrayType
61 #ifndef _BVH_USE_STD_VECTOR_
62 typedef NCollection_Vector<typename VectorType<T, N>::Type> Type;
64 typedef std::vector<typename VectorType<T, N>::Type> Type;
68 //! Allows to fast switching between Eigen and NCollection matrices.
69 template<class T, int N> struct MatrixType
74 template<class T> struct MatrixType<T, 4>
76 typedef NCollection_Mat4<T> Type;
80 //! 2D vector of integers.
81 typedef BVHTools::VectorType<Standard_Integer, 2>::Type BVH_Vec2i;
82 //! 3D vector of integers.
83 typedef BVHTools::VectorType<Standard_Integer, 3>::Type BVH_Vec3i;
84 //! 4D vector of integers.
85 typedef BVHTools::VectorType<Standard_Integer, 4>::Type BVH_Vec4i;
87 //! Array of 2D vectors of integers.
88 typedef BVHTools::ArrayType<Standard_Integer, 2>::Type BVH_Array2i;
89 //! Array of 3D vectors of integers.
90 typedef BVHTools::ArrayType<Standard_Integer, 3>::Type BVH_Array3i;
91 //! Array of 4D vectors of integers.
92 typedef BVHTools::ArrayType<Standard_Integer, 4>::Type BVH_Array4i;
94 //! 2D vector of single precision reals.
95 typedef BVHTools::VectorType<Standard_ShortReal, 2>::Type BVH_Vec2f;
96 //! 3D vector of single precision reals.
97 typedef BVHTools::VectorType<Standard_ShortReal, 3>::Type BVH_Vec3f;
98 //! 4D vector of single precision reals.
99 typedef BVHTools::VectorType<Standard_ShortReal, 4>::Type BVH_Vec4f;
101 //! Array of 2D vectors of single precision reals.
102 typedef BVHTools::ArrayType<Standard_ShortReal, 2>::Type BVH_Array2f;
103 //! Array of 3D vectors of single precision reals.
104 typedef BVHTools::ArrayType<Standard_ShortReal, 3>::Type BVH_Array3f;
105 //! Array of 4D vectors of single precision reals.
106 typedef BVHTools::ArrayType<Standard_ShortReal, 4>::Type BVH_Array4f;
108 //! 2D vector of double precision reals.
109 typedef BVHTools::VectorType<Standard_Real, 2>::Type BVH_Vec2d;
110 //! 3D vector of double precision reals.
111 typedef BVHTools::VectorType<Standard_Real, 3>::Type BVH_Vec3d;
112 //! 4D vector of double precision reals.
113 typedef BVHTools::VectorType<Standard_Real, 4>::Type BVH_Vec4d;
115 //! Array of 2D vectors of double precision reals.
116 typedef BVHTools::ArrayType<Standard_Real, 2>::Type BVH_Array2d;
117 //! Array of 3D vectors of double precision reals.
118 typedef BVHTools::ArrayType<Standard_Real, 3>::Type BVH_Array3d;
119 //! Array of 4D vectors of double precision reals.
120 typedef BVHTools::ArrayType<Standard_Real, 4>::Type BVH_Array4d;
122 //! 4x4 matrix of single precision reals.
123 typedef BVHTools::MatrixType<Standard_ShortReal, 4>::Type BVH_Mat4f;
125 //! 4x4 matrix of double precision reals.
126 typedef BVHTools::MatrixType<Standard_Real, 4>::Type BVH_Mat4d;
128 #include <BVH_Types.lxx>
130 #endif // _BVH_Types_Header