java: Add getDistance, getWorldAzimuth, and getWorldElevation to Camera API#3236
java: Add getDistance, getWorldAzimuth, and getWorldElevation to Camera API#3236code2766 wants to merge 9 commits into
Conversation
|
You are modifying libf3d public API! |
|
mwestphal
left a comment
There was a problem hiding this comment.
not rdy for review until description has been filled.
|
\ci fast |
|
\ci fast |
Hum, isnt this fixing #1419 ? |
Ah, you are completely right! I wasn't aware of the existing tracker item. This completely implements the camera getters requested in #1419. I have updated the PR description to link it properly. Thank you! |
|
\ci fast |
you commented on it 14 hours ago, I'm getting confused now.
You did not. |
|
\ci fast |
|
Style Checks CI failed: diff --git a/library/testing/TestSDKCamera.cxx b/library/testing/TestSDKCamera.cxx
index ba903f7..e795d79 100644
--- a/library/testing/TestSDKCamera.cxx
+++ b/library/testing/TestSDKCamera.cxx
@@ -39,10 +39,11 @@ int TestSDKCamera([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
cam.setPosition({ 0, 0, 10 }).setFocalPoint({ 0, 0, 0 }).setViewUp(up);
cam.azimuth(a).elevation(e);
- std::string title = " (up=" + f3d::options::format(up) + ", a=" + std::to_string(static_cast<int>(a)) + ")";
-
- // We use a tolerance of 0.5 degrees. This is required because VTK internally
- // re-normalizes the camera's orthonormal basis (Right, Up, Forward) after
+ std::string title =
+ " (up=" + f3d::options::format(up) + ", a=" + std::to_string(static_cast<int>(a)) + ")";
+
+ // We use a tolerance of 0.5 degrees. This is required because VTK internally
+ // re-normalizes the camera's orthonormal basis (Right, Up, Forward) after
// floating-point matrix rotations.
test("get azimuth" + title, cam.getWorldAzimuth(), approx(a, 0.5));
test("get elevation" + title, cam.getWorldElevation(), approx(e, 0.5)); |
Describe your changes
This PR exposes three core camera spatial tracking metrics (
getDistance(),getWorldAzimuth(), andgetWorldElevation()) to thef3d::camerapublic C++ API.Per maintainer feedback, the primary focus of this PR is the C++ implementation and ensuring its core functionality is sound.
library/): Added tracking and calculation for camera distance and world orientation angles incamera.handcamera_impl.cxx.library/testing/): UpdatedTestSDKCamera.cxxto verify the accuracy of these new metrics.Issue ticket number and link if any
None. (Feature enhancement developed to support downstream application wrapping).
Checklist for finalizing the PR
AI Disclosure
F3DCameraBindings.cxx), and the Java native method declarations inCamera.java. All logic was compiled, checked, and tested locally.Continuous integration
Please write a comment to run CI, eg:
\ci fast.See here for more info.
Overview
This PR exposes three core camera spatial metrics (
getDistance,getWorldAzimuth, andgetWorldElevation) to the Java binding layer. This allows downstream Java applications wrapping F3D to query critical camera position and orientation properties natively without needing to manually recalculate them on the client side.Changes
library/): Exposed tracking for camera distance and world orientation angles incamera.hand implemented them withincamera_impl.h/.cxx.java/): Added matching native C++ bridging functions insideF3DCameraBindings.cxxto map the Java runtime calls safely over to the underlying native engine.java/app/f3d/F3D/): Declared the public native method signatures along with clear JavaDoc documentation insideCamera.java.library/testing/): UpdatedTestSDKCamera.cxxto ensure complete coverage of the new camera metrics.Testing Done
-DF3D_BINDINGS_JAVA=ONon macOS (Apple Silicon, Temurin JDK 25).libf3d-java.dylib) and Java archive (f3d.jar) generate successfully.clang-formaton all modified C++ files to ensure code alignment with F3D styling rules.