File indexing completed on 2025-01-18 10:03:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _BVH_DistanceField_Header
0017 #define _BVH_DistanceField_Header
0018
0019 #include <BVH_Geometry.hxx>
0020
0021 template<class T, int N> class BVH_ParallelDistanceFieldBuilder;
0022
0023
0024
0025
0026
0027
0028 template<class T, int N>
0029 class BVH_DistanceField
0030 {
0031 friend class BVH_ParallelDistanceFieldBuilder<T, N>;
0032
0033 public:
0034
0035 typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
0036
0037 public:
0038
0039
0040 BVH_DistanceField (const Standard_Integer theMaximumSize,
0041 const Standard_Boolean theComputeSign);
0042
0043
0044 virtual ~BVH_DistanceField();
0045
0046
0047 Standard_Boolean Build (BVH_Geometry<T, N>& theGeometry);
0048
0049
0050 inline Standard_Boolean IsParallel() const
0051 {
0052 return myIsParallel;
0053 }
0054
0055
0056 inline void SetParallel(const Standard_Boolean isParallel)
0057 {
0058 myIsParallel = isParallel;
0059 }
0060
0061 public:
0062
0063
0064 const T* PackedData() const
0065 {
0066 return myVoxelData;
0067 }
0068
0069
0070 T& Voxel (const Standard_Integer theX,
0071 const Standard_Integer theY,
0072 const Standard_Integer theZ)
0073 {
0074 return myVoxelData[theX + (theY + theZ * myDimensionY) * myDimensionX];
0075 }
0076
0077
0078 T Voxel (const Standard_Integer theX,
0079 const Standard_Integer theY,
0080 const Standard_Integer theZ) const
0081 {
0082 return myVoxelData[theX + (theY + theZ * myDimensionY) * myDimensionX];
0083 }
0084
0085
0086 Standard_Integer DimensionX() const
0087 {
0088 return myDimensionX;
0089 }
0090
0091
0092 Standard_Integer DimensionY() const
0093 {
0094 return myDimensionY;
0095 }
0096
0097
0098 Standard_Integer DimensionZ() const
0099 {
0100 return myDimensionZ;
0101 }
0102
0103
0104 const BVH_VecNt& VoxelSize() const
0105 {
0106 return myVoxelSize;
0107 }
0108
0109
0110 const BVH_VecNt& CornerMin() const
0111 {
0112 return myCornerMin;
0113 }
0114
0115
0116 const BVH_VecNt& CornerMax() const
0117 {
0118 return myCornerMax;
0119 }
0120
0121 protected:
0122
0123
0124 void BuildSlices (BVH_Geometry<T, N>& theGeometry,
0125 const Standard_Integer theStartZ, const Standard_Integer theFinalZ);
0126
0127 protected:
0128
0129
0130 T* myVoxelData;
0131
0132
0133 BVH_VecNt myVoxelSize;
0134
0135
0136 BVH_VecNt myCornerMin;
0137
0138
0139 BVH_VecNt myCornerMax;
0140
0141
0142 Standard_Integer myDimensionX;
0143
0144
0145 Standard_Integer myDimensionY;
0146
0147
0148 Standard_Integer myDimensionZ;
0149
0150
0151 Standard_Integer myMaximumSize;
0152
0153
0154 Standard_Boolean myComputeSign;
0155
0156 Standard_Boolean myIsParallel;
0157 };
0158
0159 #include <BVH_DistanceField.lxx>
0160
0161 #endif