MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/RACER / input

Method input

swarm_exploration/plan_env/src/raycast.cpp:329–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329bool RayCaster::input(const Eigen::Vector3d& start, const Eigen::Vector3d& end) {
330 start_ = start / resolution_;
331 end_ = end / resolution_;
332
333 x_ = (int)std::floor(start_.x());
334 y_ = (int)std::floor(start_.y());
335 z_ = (int)std::floor(start_.z());
336 endX_ = (int)std::floor(end_.x());
337 endY_ = (int)std::floor(end_.y());
338 endZ_ = (int)std::floor(end_.z());
339 direction_ = (end_ - start_);
340 maxDist_ = direction_.squaredNorm();
341
342 // Break out direction vector.
343 dx_ = endX_ - x_;
344 dy_ = endY_ - y_;
345 dz_ = endZ_ - z_;
346
347 // Direction to increment x,y,z when stepping.
348 stepX_ = (int)signum((int)dx_);
349 stepY_ = (int)signum((int)dy_);
350 stepZ_ = (int)signum((int)dz_);
351
352 // See description above. The initial values depend on the fractional
353 // part of the origin.
354 tMaxX_ = intbound(start_.x(), dx_);
355 tMaxY_ = intbound(start_.y(), dy_);
356 tMaxZ_ = intbound(start_.z(), dz_);
357
358 // The change in t when taking a step (always positive).
359 tDeltaX_ = ((double)stepX_) / dx_;
360 tDeltaY_ = ((double)stepY_) / dy_;
361 tDeltaZ_ = ((double)stepZ_) / dz_;
362
363 dist_ = 0;
364
365 step_num_ = 0;
366
367 // Avoids an infinite loop.
368 if (stepX_ == 0 && stepY_ == 0 && stepZ_ == 0)
369 return false;
370 else
371 return true;
372}
373
374bool RayCaster::nextId(Eigen::Vector3i& idx) {
375 auto tmp = Eigen::Vector3d(x_, y_, z_);

Callers 5

findViewpointsMethod · 0.80
countVisibleCellsMethod · 0.80
searchPathMethod · 0.80
inputPointCloudMethod · 0.80
shortenPathMethod · 0.80

Calls 2

signumFunction · 0.85
intboundFunction · 0.85

Tested by

no test coverage detected