Skip to content

Commit

Permalink
Fixed screento functions names
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde committed Jul 20, 2021
1 parent dbbc3d7 commit 5d3dfda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions include/ignition/rendering/Utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace ignition
/// \param[in] _maxDistance maximum distance to check the collision
/// \return 3D coordinates of a point in the 3D scene.
IGNITION_RENDERING_VISIBLE
math::Vector3d ScreenToScene(
math::Vector3d screenToScene(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
Expand All @@ -58,7 +58,7 @@ namespace ignition
/// \param[in] _maxDistance maximum distance to check the collision
/// \return 3D coordinates of a point in the 3D scene.
IGNITION_RENDERING_VISIBLE
math::Vector3d ScreenToScene(
math::Vector3d screenToScene(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
Expand All @@ -73,7 +73,7 @@ namespace ignition
/// \param[in] _offset Offset along the plane normal
/// \return 3D coordinates of a point in the 3D scene.
IGNITION_RENDERING_VISIBLE
math::Vector3d ScreenToPlane(
math::Vector3d screenToPlane(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
Expand Down
8 changes: 4 additions & 4 deletions src/Utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace rendering
inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
//
/////////////////////////////////////////////////
math::Vector3d ScreenToScene(
math::Vector3d screenToScene(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
Expand Down Expand Up @@ -63,18 +63,18 @@ math::Vector3d ScreenToScene(
}

/////////////////////////////////////////////////
math::Vector3d ScreenToScene(
math::Vector3d screenToScene(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
float _maxDistance)
{
RayQueryResult rayResult;
return ScreenToScene(_screenPos, _camera, _rayQuery, rayResult, _maxDistance);
return screenToScene(_screenPos, _camera, _rayQuery, rayResult, _maxDistance);
}

/////////////////////////////////////////////////
math::Vector3d ScreenToPlane(
math::Vector3d screenToPlane(
const math::Vector2i &_screenPos,
const CameraPtr &_camera,
const RayQueryPtr &_rayQuery,
Expand Down
18 changes: 9 additions & 9 deletions src/Utils_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)
RayQueryPtr rayQuery = scene->CreateRayQuery();
EXPECT_TRUE(rayQuery != nullptr);

// ScreenToPlane
math::Vector3d result = ScreenToPlane(centerClick, camera, rayQuery);
// screenToPlane
math::Vector3d result = screenToPlane(centerClick, camera, rayQuery);

EXPECT_NEAR(0.0, result.Z(), 1e-10);
EXPECT_NEAR(0.0, result.X(), 2e-6);
EXPECT_NEAR(0.0, result.Y(), 2e-6);

// call with non-zero plane offset
result = ScreenToPlane(centerClick, camera, rayQuery, 5.0);
result = screenToPlane(centerClick, camera, rayQuery, 5.0);

EXPECT_NEAR(5.0, result.Z(), 1e-10);
EXPECT_NEAR(0.0, result.X(), 2e-6);
EXPECT_NEAR(0.0, result.Y(), 2e-6);

// ScreenToScene
// screenToScene
// API without RayQueryResult and default max distance
result = ScreenToScene(centerClick, camera, rayQuery);
result = screenToScene(centerClick, camera, rayQuery);

// No objects currently in the scene, so return a point max distance in
// front of camera
Expand All @@ -98,7 +98,7 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)

// Try with different max distance
RayQueryResult rayResult;
result = ScreenToScene(centerClick, camera, rayQuery, rayResult, 20.0);
result = screenToScene(centerClick, camera, rayQuery, rayResult, 20.0);

EXPECT_NEAR(-5.0 - camera->NearClipPlane(), result.Z(), 4e-6);
EXPECT_NEAR(0.0, result.X(), 4e-6);
Expand All @@ -118,7 +118,7 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)
root->AddChild(box);

// API without RayQueryResult and default max distance
result = ScreenToScene(centerClick, camera, rayQuery, rayResult);
result = screenToScene(centerClick, camera, rayQuery, rayResult);

EXPECT_NEAR(0.5, result.Z(), 1e-10);
EXPECT_NEAR(0.0, result.X(), 2e-6);
Expand All @@ -127,7 +127,7 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)
EXPECT_NEAR(14.5 - camera->NearClipPlane(), rayResult.distance, 4e-6);
EXPECT_EQ(box->Id(), rayResult.objectId);

result = ScreenToScene(centerClick, camera, rayQuery, rayResult, 20.0);
result = screenToScene(centerClick, camera, rayQuery, rayResult, 20.0);

EXPECT_NEAR(0.5, result.Z(), 1e-10);
EXPECT_NEAR(0.0, result.X(), 2e-6);
Expand All @@ -140,7 +140,7 @@ void UtilTest::ClickToScene(const std::string &_renderEngine)
camera->SetLocalPosition(0.0, 0.0, 7.0);
camera->SetLocalRotation(0.0, IGN_PI / 2, 0.0);

result = ScreenToScene(centerClick, camera, rayQuery, rayResult);
result = screenToScene(centerClick, camera, rayQuery, rayResult);

EXPECT_NEAR(0.5, result.Z(), 1e-10);
EXPECT_NEAR(0.0, result.X(), 2e-6);
Expand Down

0 comments on commit 5d3dfda

Please sign in to comment.