25 auto &domain = levelSet->getDomain();
26 auto &grid = levelSet->getGrid();
29 Vec3D<NumericType> minDefinedPoint;
30 Vec3D<NumericType> maxDefinedPoint;
32 for (
int i = 0; i <
D; ++i) {
33 minDefinedPoint[i] = std::numeric_limits<NumericType>::max();
34 maxDefinedPoint[i] = std::numeric_limits<NumericType>::lowest();
39 !it.isFinished(); it.next()) {
44 auto point = it.getStartIndices();
45 for (
int i = 0; i <
D; ++i) {
48 minDefinedPoint[i] = std::min(minDefinedPoint[i], coord);
49 maxDefinedPoint[i] = std::max(maxDefinedPoint[i], coord);
55 auto dir = Normalize(Inv(direction)) *
56 static_cast<NumericType>(domain.getGrid().getGridDelta());
58 auto numDefinedPoints = domain.getNumberOfPoints();
59 std::vector<NumericType> visibilities(numDefinedPoints);
61#pragma omp parallel num_threads(levelSet->getNumberOfSegments())
65 p = omp_get_thread_num();
68 hrleVectorType<hrleIndexType, D> startVector =
69 (p == 0) ? grid.getMinGridPoint() : domain.getSegmentation()[p - 1];
71 hrleVectorType<hrleIndexType, D> endVector =
72 (p !=
static_cast<int>(domain.getNumberOfSegments() - 1))
73 ? domain.getSegmentation()[p]
74 : grid.incrementIndices(grid.getMaxGridPoint());
78 for (
int i = 0; i < p; ++i) {
79 id += domain.getDomainSegment(i).getNumberOfPoints();
84 it.getStartIndices() < endVector; ++it) {
90 Vec3D<NumericType> currentPos;
91 for (
int i = 0; i <
D; ++i) {
92 currentPos[i] = it.getStartIndices(i);
98 Vec3D<NumericType> rayPos = currentPos;
99 bool visibility =
true;
103 for (
int i = 0; i <
D; ++i) {
108 Vec3D<hrleIndexType> nearestCell;
109 for (
int i = 0; i <
D; ++i) {
110 nearestCell[i] =
static_cast<hrleIndexType
>(rayPos[i]);
121 bool outOfBounds =
false;
122 for (
int i = 0; i <
D; ++i) {
123 if (nearestCell[i] < minDefinedPoint[i] ||
124 nearestCell[i] > maxDefinedPoint[i]) {
135 NumericType neighborValue = std::numeric_limits<NumericType>::max();
136 hrleSparseIterator<typename Domain<NumericType, D>::DomainType>
138 neighborIt.goToIndices(nearestCell);
139 neighborValue = neighborIt.getValue();
142 if (neighborValue < minLevelSetValue) {
149 visibilities[
id++] = visibility ? 1.0 : 0.0;
153 auto &pointData = levelSet->getPointData();
155 if (
int i = pointData.getScalarDataIndex(visibilitiesLabel); i != -1) {
156 pointData.eraseScalarData(i);
158 pointData.insertNextScalarData(visibilities, visibilitiesLabel);