File indexing completed on 2026-10-04 09:14:02
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>
0022 class BVH_ParallelDistanceFieldBuilder;
0023
0024
0025
0026
0027
0028
0029 template <class T, int N>
0030 class BVH_DistanceField
0031 {
0032 friend class BVH_ParallelDistanceFieldBuilder<T, N>;
0033
0034 public:
0035 typedef typename BVH::VectorType<T, N>::Type BVH_VecNt;
0036
0037 public:
0038
0039 BVH_DistanceField(const int theMaximumSize, const bool theComputeSign);
0040
0041
0042 virtual ~BVH_DistanceField();
0043
0044
0045 bool Build(BVH_Geometry<T, N>& theGeometry);
0046
0047
0048 inline bool IsParallel() const { return myIsParallel; }
0049
0050
0051 inline void SetParallel(const bool isParallel) { myIsParallel = isParallel; }
0052
0053 public:
0054
0055 const T* PackedData() const { return myVoxelData; }
0056
0057
0058 T& Voxel(const int theX, const int theY, const int theZ)
0059 {
0060 return myVoxelData[theX + (theY + theZ * myDimensionY) * myDimensionX];
0061 }
0062
0063
0064 T Voxel(const int theX, const int theY, const int theZ) const
0065 {
0066 return myVoxelData[theX + (theY + theZ * myDimensionY) * myDimensionX];
0067 }
0068
0069
0070 int DimensionX() const { return myDimensionX; }
0071
0072
0073 int DimensionY() const { return myDimensionY; }
0074
0075
0076 int DimensionZ() const { return myDimensionZ; }
0077
0078
0079 const BVH_VecNt& VoxelSize() const { return myVoxelSize; }
0080
0081
0082 const BVH_VecNt& CornerMin() const { return myCornerMin; }
0083
0084
0085 const BVH_VecNt& CornerMax() const { return myCornerMax; }
0086
0087 protected:
0088
0089 void BuildSlices(BVH_Geometry<T, N>& theGeometry, const int theStartZ, const int theFinalZ);
0090
0091 protected:
0092
0093 T* myVoxelData;
0094
0095
0096 BVH_VecNt myVoxelSize;
0097
0098
0099 BVH_VecNt myCornerMin;
0100
0101
0102 BVH_VecNt myCornerMax;
0103
0104
0105 int myDimensionX;
0106
0107
0108 int myDimensionY;
0109
0110
0111 int myDimensionZ;
0112
0113
0114 int myMaximumSize;
0115
0116
0117 bool myComputeSign;
0118
0119 bool myIsParallel;
0120 };
0121
0122 #include <BVH_DistanceField.lxx>
0123
0124 #endif