-
-
Notifications
You must be signed in to change notification settings - Fork 364
Add getters for camera parameters #1419 #2767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ickly for further processing (cherry picked from commit 935740b)
(cherry picked from commit c589cd3)
…n to compute the distance from the camera position to the focal point (cherry picked from commit a54c71e)
(cherry picked from commit af3407a)
(cherry picked from commit 3f8671b)
…mproved getWorldAzimuth using SignedAngleBetweenVectors
|
You are modifying libf3d public API! |
|
I think this should be correct now, will work on better testing ASAP |
| static constexpr double EPS = 128 * std::numeric_limits<double>::epsilon(); | ||
| if (vtkMath::Norm(horizontal.data()) < EPS) | ||
| { | ||
| return 0.0; | ||
| } | ||
|
|
||
| vtkMath::Normalize(horizontal.data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you've got the tests you can double check if this is actually needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, is it needed @Dtsitos ?
|
please let us know when its ready for review @Dtsitos |
|
@mwestphal Hello there, I have implemented all the bindings and some basic testing for them. Full disclosure, I have never worked with bindings again and mostly deduced what to do based on the patterns from the existing implementations. Thank you for your patience |
Thats perfectly fine and it looks good to me :) |
|
\ci full |
|
Style Checks CI failed: diff --git a/library/src/camera_impl.cxx b/library/src/camera_impl.cxx
index 7db2c14..a7ac8cd 100644
--- a/library/src/camera_impl.cxx
+++ b/library/src/camera_impl.cxx
@@ -7,7 +7,6 @@
#include <vtkRenderer.h>
#include <vtkVersion.h>
-
namespace f3d::detail
{
class camera_impl::internals
@@ -145,7 +144,6 @@ double camera_impl::getWorldAzimuth() const
double angleRad = vtkMath::SignedAngleBetweenVectors(right, horizontal.data(), up);
return vtkMath::DegreesFromRadians(angleRad);
-
}
//----------------------------------------------------------------------------
diff --git a/library/testing/TestSDKCamera.cxx b/library/testing/TestSDKCamera.cxx
index 8bc6885..6fbfda4 100644
--- a/library/testing/TestSDKCamera.cxx
+++ b/library/testing/TestSDKCamera.cxx
@@ -243,8 +243,8 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
if (!compareDouble(elevation, 0.0))
{
- std::cerr << "getWorldElevation (horizontal) is not behaving as expected: "
- << elevation << "\n";
+ std::cerr << "getWorldElevation (horizontal) is not behaving as expected: " << elevation
+ << "\n";
return EXIT_FAILURE;
}
@@ -259,22 +259,22 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
if (!compareDouble(distance, std::sqrt(11.0 * 11.0 + 11.0 * 11.0)))
{
- std::cerr << "getDistance (positive elevation) is not behaving as expected: "
- << distance << "\n";
+ std::cerr << "getDistance (positive elevation) is not behaving as expected: " << distance
+ << "\n";
return EXIT_FAILURE;
}
if (!compareDouble(azimuth, 0.0))
{
- std::cerr << "getWorldAzimuth (positive elevation) is not behaving as expected: "
- << azimuth << "\n";
+ std::cerr << "getWorldAzimuth (positive elevation) is not behaving as expected: " << azimuth
+ << "\n";
return EXIT_FAILURE;
}
if (!compareDouble(elevation, 45.0))
{
- std::cerr << "getWorldElevation (positive elevation) is not behaving as expected: "
- << elevation << "\n";
+ std::cerr << "getWorldElevation (positive elevation) is not behaving as expected: " << elevation
+ << "\n";
return EXIT_FAILURE;
}
@@ -289,15 +289,15 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
if (!compareDouble(distance, std::sqrt(11.0 * 11.0 + 11.0 * 11.0)))
{
- std::cerr << "getDistance (negative elevation) is not behaving as expected: "
- << distance << "\n";
+ std::cerr << "getDistance (negative elevation) is not behaving as expected: " << distance
+ << "\n";
return EXIT_FAILURE;
}
if (!compareDouble(azimuth, 0.0))
{
- std::cerr << "getWorldAzimuth (negative elevation) is not behaving as expected: "
- << azimuth << "\n";
+ std::cerr << "getWorldAzimuth (negative elevation) is not behaving as expected: " << azimuth
+ << "\n";
return EXIT_FAILURE;
}
|
|
\ci full |
…ation to avoid direct call to asin
|
not ready for full CI yet :) |
|
do you need help with the style check @Dtsitos ? |
Describe your changes
This PR adds read-only getters to the camera API to retrieve derived world-space
camera parameters (azimuth, elevation, and distance).
The values are computed from the camera position and focal point and do not
modify camera state. This enables external applications and bindings to query
camera orientation consistently without duplicating math.
No existing behavior is changed.
Original PR: #2724
Issue ticket number and link if any
Fixes #1419
Checklist for finalizing the PR
.github/workflows/versions.json, I have updateddocker_timestampContinuous integration
Please write a comment to run CI, eg:
\ci fast.See here for more info.