Add getters for yaw, azimuth and elevation#2499
Add getters for yaw, azimuth and elevation#2499AbbasReads wants to merge 34 commits intof3d-app:masterfrom
Conversation
|
You are modifying libf3d public API! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2499 +/- ##
==========================================
+ Coverage 96.43% 96.48% +0.04%
==========================================
Files 138 140 +2
Lines 12047 12192 +145
==========================================
+ Hits 11618 11763 +145
Misses 429 429 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
please rebase on latest master |
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
resolved conflicts
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
…d python bindings tests
Co-authored-by: Mathieu Westphal <mathieu.westphal@gmail.com>
…assertions to use pytest.approx for floating-point comparisons
…tion and azimuth checks
| [[nodiscard]] virtual camera_state_t getState() const = 0; | ||
| /** Get the complete state of the camera into the provided arg */ | ||
| virtual void getState(camera_state_t& state) const = 0; | ||
|
|
| vector3_t orthogonalizedUp; | ||
| cam->GetViewUp(orthogonalizedUp.data()); | ||
| static constexpr double EPSILON = 128 * std::numeric_limits<double>::epsilon(); | ||
| for (size_t i = 0; vtkMath::Norm(orthogonalizedUp.data()) < EPSILON && i < up.size(); i++) |
There was a problem hiding this comment.
| for (size_t i = 0; vtkMath::Norm(orthogonalizedUp.data()) < EPSILON && i < up.size(); i++) | |
| for (size_t i = 0; vtkMath::Norm(orthogonalizedUp.data()) < ::EPSILON && i < up.size(); i++) |
| vtkMath::Normalize(dir.data()); | ||
| vtkMath::Normalize(up); | ||
|
|
||
| if (vtkMath::Norm(dir.data()) <= EPSILON) |
There was a problem hiding this comment.
| if (vtkMath::Norm(dir.data()) <= EPSILON) | |
| if (vtkMath::Norm(dir.data()) <= ::EPSILON) |
| } | ||
|
|
||
| // Project forward vector onto up vector | ||
| if (abs(vtkMath::AngleBetweenVectors(dir.data(), up) - vtkMath::Pi() / 2) <= EPSILON) |
There was a problem hiding this comment.
| if (abs(vtkMath::AngleBetweenVectors(dir.data(), up) - vtkMath::Pi() / 2) <= EPSILON) | |
| if (abs(vtkMath::AngleBetweenVectors(dir.data(), up) - vtkMath::Pi() / 2) <= ::EPSILON) |
|
|
||
| // Projection of forward vector along the plane perpendicular to up vector | ||
| vtkMath::Subtract(dir, projectedAlongUp, projected); | ||
| if (vtkMath::Norm(projected.data()) <= EPSILON) |
There was a problem hiding this comment.
| if (vtkMath::Norm(projected.data()) <= EPSILON) | |
| if (vtkMath::Norm(projected.data()) <= ::EPSILON) |
There was a problem hiding this comment.
Please also update F3DEmscriptenBindings.cxx and add a test in webassembly/testing/test_camera.js
|
|
||
| if (vtkMath::Norm(dir.data()) <= EPSILON) | ||
| { | ||
| return 0; |
There was a problem hiding this comment.
please add a test covering this
| vtkMath::Subtract(dir, projectedAlongUp, projected); | ||
| if (vtkMath::Norm(projected.data()) <= EPSILON) | ||
| { | ||
| return 0; |
There was a problem hiding this comment.
please add a test covering this
|
Need any help moving forward @AbbasReads ? |
|
Style Checks CI failed: diff --git a/library/testing/TestSDKCamera.cxx b/library/testing/TestSDKCamera.cxx
index c9fccdb..eacec45 100644
--- a/library/testing/TestSDKCamera.cxx
+++ b/library/testing/TestSDKCamera.cxx
@@ -179,7 +179,8 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// }
// cam.yaw(90.0);
- // if (!compareDouble(cam.getYaw(), 90.0, 1e-6) || !compareDouble(cam.getElevation(), 0.0, 1e-6) ||
+ // if (!compareDouble(cam.getYaw(), 90.0, 1e-6) || !compareDouble(cam.getElevation(), 0.0, 1e-6)
+ // ||
// !compareDouble(cam.getAzimuth(), 90.0, 1e-6))
// {
// std::cerr << "After yaw(90): unexpected orientation\n"
@@ -190,7 +191,8 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// }
// cam.elevation(45.0);
- // if (!compareDouble(cam.getYaw(), 90.0, 1e-6) || !compareDouble(cam.getElevation(), 45.0, 1e-6) ||
+ // if (!compareDouble(cam.getYaw(), 90.0, 1e-6) || !compareDouble(cam.getElevation(), 45.0, 1e-6)
+ // ||
// !compareDouble(cam.getAzimuth(), 90.0, 1e-6))
// {
// std::cerr << "After elevation(45): unexpected orientation\n"
@@ -201,7 +203,8 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// }
// cam.azimuth(90);
- // if (!compareDouble(cam.getYaw(), 180.0, 1e-6) || !compareDouble(cam.getElevation(), 0.0, 1e-6) ||
+ // if (!compareDouble(cam.getYaw(), 180.0, 1e-6) || !compareDouble(cam.getElevation(), 0.0, 1e-6)
+ // ||
// !compareDouble(cam.getAzimuth(), 180.0, 1e-6))
// {
// std::cerr << "After azimuth(90): unexpected orientation\n"
diff --git a/webassembly/testing/test_camera.js b/webassembly/testing/test_camera.js
index a108953..3863df5 100644
--- a/webassembly/testing/test_camera.js
+++ b/webassembly/testing/test_camera.js
@@ -48,8 +48,14 @@ const settings = {
console.log("Yaw:", camera.getYaw());
console.log("Elevation:", camera.getElevation());
- utils.assert(Math.abs(camera.getYaw() - 45) < 0.01, "Yaw should be 45 after yaw(45)");
- utils.assert(Math.abs(camera.getElevation()) < 0.01, "Elevation should remain 0");
+ utils.assert(
+ Math.abs(camera.getYaw() - 45) < 0.01,
+ "Yaw should be 45 after yaw(45)",
+ );
+ utils.assert(
+ Math.abs(camera.getElevation()) < 0.01,
+ "Elevation should remain 0",
+ );
// Test elevation rotation
// camera.resetToDefault(); |
|
Hi @AbbasReads , still wokring on this ? |
Added getters for yaw, azimuth and elevation, and python bindings for them
Issue ticket number and link if any
Checklist for finalizing the PR
.github/workflows/versions.json, I have updatedtimestamp