Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed May 12, 2022
1 parent 680bc44 commit d32ecb8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/integration/gpu_rays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,15 @@ void GpuRaysTest::Visibility(const std::string &_renderEngine)
if (_renderEngine == "optix")
{
igndbg << "GpuRays visibility mask not supported yet in rendering engine: "
<< _renderEngine << std::endl;
<< _renderEngine << std::endl;
return;
}

// Test GPU rays with 3 boxes in the world.
// One of the boxes has visibility flags set to a value that
// makes it invisible to the sensor
const double hMinAngle = -IGN_PI/2.0;
const double hMaxAngle = IGN_PI/2.0;
const double hMinAngle = -IGN_PI / 2.0;
const double hMaxAngle = IGN_PI / 2.0;
const double minRange = 0.1;
const double maxRange = 10.0;
const int hRayCount = 320;
Expand All @@ -867,7 +867,7 @@ void GpuRaysTest::Visibility(const std::string &_renderEngine)
if (!engine)
{
igndbg << "Engine '" << _renderEngine
<< "' is not supported" << std::endl;
<< "' is not supported" << std::endl;
return;
}

Expand Down Expand Up @@ -945,11 +945,13 @@ void GpuRaysTest::Visibility(const std::string &_renderEngine)
gpuRays->Update();
scene->SetTime(scene->Time() + std::chrono::milliseconds(16));

int mid = static_cast<int>(hRayCount/2) * channels;
int mid = static_cast<int>(hRayCount / 2) * channels;
int last = (hRayCount - 1) * channels;
double unitBoxSize = 1.0;
double expectedRangeAtMidPointBox1 = abs(box01Pose.Pos().X()) - unitBoxSize/2;
double expectedRangeAtMidPointBox2 = abs(box02Pose.Pos().Y()) - unitBoxSize/2;
double expectedRangeAtMidPointBox1 =
abs(box01Pose.Pos().X()) - unitBoxSize / 2;
double expectedRangeAtMidPointBox2 =
abs(box02Pose.Pos().Y()) - unitBoxSize / 2;

// rays caster should see box01 and box02 but not box03
EXPECT_NEAR(scan[mid], expectedRangeAtMidPointBox1, LASER_TOL);
Expand Down

0 comments on commit d32ecb8

Please sign in to comment.