201 Coord p0 = lineSegment.getPoint1();
202 Coord p1 = lineSegment.getPoint2();
203 Coord segmentDirection = p1 - p0;
204 Triplet<double> point0 = Triplet<double>(p0.x - spatialGrid->constraintAreaMin.x, p0.y - spatialGrid->constraintAreaMin.y, p0.z - spatialGrid->constraintAreaMin.z);
205 Triplet<double> direction = Triplet<double>(segmentDirection.x, segmentDirection.y, segmentDirection.z);
206 index = spatialGrid->coordToMatrixIndices(p0);
207 endPoint = spatialGrid->coordToMatrixIndices(p1);
208 for (
int i = 0; i < 3; i++)
210 tDelta[i] = voxelSizes[i] / std::abs(direction[i]);
211 double ithdirection = direction[i];
212 if (ithdirection > 0)
214 else if (ithdirection < 0)
218 if (ithdirection != 0) {
219 double d = point0[i] - index[i] * voxelSizes[i];
221 d = voxelSizes[i] - d;
222 ASSERT(d >= 0 && d <= voxelSizes[i]);
223 tExit[i] = d / std::abs(ithdirection);
Triplet< int > endPoint
Definition: SpatialGrid.h:79
Triplet< int > step
Definition: SpatialGrid.h:80
bool reachedEnd
Definition: SpatialGrid.h:83
Triplet< double > tExit
Definition: SpatialGrid.h:82
double max(double a, double b)
Returns the greater of the given parameters.
Definition: INETMath.h:161
Triplet< double > tDelta
Definition: SpatialGrid.h:81
Triplet< int > index
Definition: SpatialGrid.h:78