Add Tkinter 3D canvas with semi-transparent stiffened cylinder visualization#208
Draft
audunarn wants to merge 11 commits into
Draft
Add Tkinter 3D canvas with semi-transparent stiffened cylinder visualization#208audunarn wants to merge 11 commits into
audunarn wants to merge 11 commits into
Conversation
…tion This commit adds a pure Tkinter-based 3D drawing module as an alternative to matplotlib 3D drawing. The implementation includes: - Point3D: 3D point class with vector operations - Camera3D: 3D camera with orbit controls and perspective projection - Tkinter3DCanvas: Canvas widget supporting 3D drawing primitives - Drawing functions for cylinders, longitudinal stiffeners, and ring stiffeners - Mouse interaction for rotation and zoom - Demo function showing a stiffened cylinder with 8 longitudinal and 4 ring stiffeners Two versions are provided: - tkinter_3d_canvas.py: Uses numpy for matrix operations (faster) - tkinter_3d_canvas_simple.py: Pure Python implementation without dependencies To run the demo: python anystruct/tkinter_3d_canvas_simple.py Mouse controls: - Left-click and drag: Rotate camera - Scroll wheel: Zoom in/out - Buttons: Reset view, Top/Side/Iso views Co-authored-by: audunarn <audunarn@users.noreply.github.com>
Co-authored-by: audunarn <audunarn@users.noreply.github.com>
Co-authored-by: audunarn <audunarn@users.noreply.github.com>
…window Co-authored-by: audunarn <audunarn@users.noreply.github.com>
Co-authored-by: audunarn <audunarn@users.noreply.github.com>
…in front have negative z Co-authored-by: audunarn <audunarn@users.noreply.github.com>
…implify demo Co-authored-by: audunarn <audunarn@users.noreply.github.com>
Co-authored-by: audunarn <audunarn@users.noreply.github.com>
This implementation includes: - Proper camera basis calculation with world_to_camera transformation - Caching of primitives for performance - Backface culling - Depth sorting (painter's algorithm) - Adaptive detail levels (fast vs full quality) - Support for cylinders, longitudinal stiffeners, and ring stiffeners - Mouse interaction: drag to orbit, wheel to zoom - Camera controls: fit, reset, top, side, front, iso views - Automatic scene fitting Co-authored-by: audunarn <audunarn@users.noreply.github.com>
…tions The demo now shows 8 different configurations: 1. Cylinder with outside stiffeners (opaque) 2. Cylinder with inside stiffeners (opaque) 3. Cylinder with outside stiffeners (transparent) 4. Cylinder with inside stiffeners (transparent) 5. Cylinder with outside girders (ring stiffeners) 6. Cylinder with inside girders (ring stiffeners) 7. Cylinder with both outside stiffeners and girders 8. Cylinder with both inside stiffeners and girders Examples are arranged in a grid with descriptive labels. Co-authored-by: audunarn <audunarn@users.noreply.github.com>
…ization - Implement pure Tkinter 3D canvas with camera, projection, and rendering - Add semi-transparent cylinder shell (opacity=0.4) to see inside structure - Add 8 longitudinal stiffeners inside with alternating thicknesses (10mm/15mm, 20mm/25mm) - Add 4 ring girders inside with alternating thicknesses (15mm/20mm, 25mm/30mm) - Color-code stiffeners by plate thickness using red gradient - Add legend frame showing thickness-color mapping - Support mouse interaction: drag to orbit, wheel to zoom - Include control buttons: Fit, Reset, Top, Side, Front, Iso views Thickness color scheme: - 10mm: #ffcccc (light red) - 15mm: #ff9999 (medium-light red) - 20mm: #ff6666 (medium red) - 25mm: #ff3333 (dark red) - 30mm: #ff0000 (solid red) Co-authored-by: audunarn <audunarn@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Features Implemented
Thickness Color Scheme
#ffcccc(light red)#ff9999(medium-light red)#ff6666(medium red)#ff3333(dark red)#ff0000(solid red)Usage
Run the demo:
Technical Details