-
Notifications
You must be signed in to change notification settings - Fork 50
Implement dynamic camera position calculation for 3D rendering #1301
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: main
Are you sure you want to change the base?
Implement dynamic camera position calculation for 3D rendering #1301
Conversation
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.
Pull request overview
This PR introduces a dynamic camera position calculation utility for 3D circuit board rendering. Instead of using hardcoded camera positions, the system now automatically determines optimal camera angles and distances based on the actual board and component dimensions from the circuit JSON.
Key Changes:
- Added
calculateCameraPositionutility that computes camera position and target based on board/component layout - Integrated the utility into the snapshot generation workflow to replace hardcoded camera settings
- Added comprehensive test coverage for various scenarios including boards, components, and string dimension formats
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/shared/calculate-camera-position.ts |
New utility function that calculates optimal camera position and look-at target based on circuit board and component dimensions, with support for both numeric and string dimension formats |
lib/shared/snapshot-project.ts |
Updated to use dynamic camera position calculation instead of hardcoded values, improving 3D snapshot accuracy |
tests/lib/shared/calculate-camera-position.test.ts |
Added test suite covering empty circuits, board-only scenarios, components without boards, and string dimension parsing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
imrishabh18
left a comment
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.
Can you add the 3d snapshots in the test for this? It's hard to know how it will look
|
@imrishabh18 did i do something wrong, why did it fail |
|
probably an uncaught error |
…amera settings in snapshot rendering
|
@ShiboSoftwareDev @seveibar Before
After
|
…ng and simplify width/height handling
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
|
This PR was closed because it has been inactive for 1 day since being marked as stale. |






This pull request adds a new utility for calculating optimal camera positions for 3D circuit board rendering, integrates it into the snapshot generation workflow, and introduces comprehensive tests to ensure correct behavior. The main focus is to automatically determine the best camera angle and distance based on the board and component layout in the circuit JSON, improving the accuracy and reliability of 3D previews.
Camera position calculation utility
calculateCameraPositioninlib/shared/calculate-camera-position.ts, which computes the ideal camera position and target for rendering a circuit board in 3D, considering board and component dimensions, positions, and supports both numeric and string dimension formats.Integration into snapshot workflow
lib/shared/snapshot-project.tsto use the new camera position calculation, replacing hardcoded camera settings with dynamic values derived from the circuit JSON, resulting in more accurate 3D snapshots. [1] [2]Testing
tests/lib/shared/calculate-camera-position.test.tsto thoroughly test the camera position calculation utility with various board/component scenarios and dimension formats, ensuring correctness and robustness.