-
Notifications
You must be signed in to change notification settings - Fork 15
Swept Surface #438
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
Open
OberGue
wants to merge
62
commits into
develop
Choose a base branch
from
ft-swept
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Swept Surface #438
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
0db4075
Add: show_swept-file and swept-function in create-file
OberGue f99202c
Add: first kinda swept surface implementation in show_swept-file
OberGue bf4a2a4
Fix: Moved computation from show_swept-file to create-file
OberGue 03f2a94
Add: function for transformation matrix
OberGue 0dfd431
Add: show_options changed in show_swept-file
OberGue 250fe0b
Add: positioning of cross-section control points
OberGue c800030
Fix: now, evaluation-points are fitted instead of CPs
OberGue 119b913
Add: rotation matrix and centered cross section
OberGue 95fa2cb
Fix: getting fitting flexible for CS eval points; Note: WIP
OberGue f6e0ac2
Add: Transformation matrix now with projection; Note: WIP
OberGue 31cc929
Fix: calculation of transformation matrix - still working on projecti…
OberGue e7b68b0
minor clean up during discussion
j042 1661aaa
Fix: create-file transformation matrices now calculated once; rotatio…
OberGue 91ae3a6
Fix: changed arbitrary vector vec and rotation matrix in create-file;…
OberGue 5d334b6
Fix: random vector vec now dependent of tangent
OberGue 03b4f70
Add: new function in fit.py-file; Fix: adaptions in create.py-file ac…
OberGue b8839db
Fix: pre-commit changes
OberGue bf6097b
Add: changed show-settings to better possibility of comparison
OberGue eb67c22
Big update; Add: nurbs, traj refinement; Del: fitting routine
OberGue ec53430
Fix: calculation of rotation matrix
OberGue 1864586
Add: refinement routine; Fix: no more derivative redundance
OberGue 1051648
Fix: no more global splinepy import
OberGue bc777de
Add: self-refinement now working; added function in bspline.py (note:…
OberGue 3ee93db
Add: function for closed trajectories
OberGue cfe52dd
Add: some checks were added
OberGue 9bf2f5a
Add: reference to nurbs book
OberGue fdf2bfc
Add: auto_refinement variable
OberGue 8958cff
Fix: positioning of cs-cps now acc to traj-cps; Fix: auto_refinement …
OberGue f45523d
Add: test functions in create-test-file
OberGue 4188eb8
Rm: removed unnecessary insertion function in bspline.py
OberGue e0f28d0
Add: opportunity to set cross-sec CPs on traj eval points or traj CPs
OberGue e4dca0b
Add: swept description; Fix: using settings.TOLERANCE
OberGue 100d929
Fix: get rid of x,y,z
OberGue 1b5bbab
Fix: embedded calc of transf matrices in normal code - without functi…
OberGue ad48986
Add: debug log at cs_normal_vector
OberGue ff7f611
Add: debug log for B division by zero
OberGue 578a2ed
Add: functionality to rotate cross_section around traj-tangent-vector
OberGue a3bf642
Add: test function to compare swept and extruded
OberGue 1401fe4
Add: test_swept_with_costum_normal now with derivative check
OberGue a99724f
Rm: auto_refinement; Rm: clean up show_swept file
OberGue 4773cb3
Fix: new test functions
OberGue c3ba46f
Rm: german comment
OberGue d7bdb0f
Add: capabilities of sweeping in the docstring
OberGue 29eed97
Fix: changed indentation in docstring
OberGue c229871
Fix: added points in docstring
OberGue f3097a1
Add: show_swept-file now shows more examples
OberGue 50cee92
Rm: .all()-function in test_create-file
OberGue 52de258
Fix: show_options and variable names in show_swept
OberGue 0d32b17
Fix: changed comments of cs_nv
OberGue 9b39767
Add: assertions and comments in test_basic_functionality-function in …
OberGue 0e08f5b
Fix: error messages in create-file
OberGue 01cfca0
Fix: clarified error messages at input checks of create-file
OberGue 29194bd
Fix: rotation matrix calculation now also for e2 entries
OberGue 9115a39
Add: catch division by zero in trajectory-tangent calculation
OberGue 1860c07
Fix: input checks now with spline-instance; Add: casting of rotation_…
OberGue 1536702
Add: temporal variable in order to avoid multiple cross-product-calcu…
OberGue 75c9b40
Fix: changed vector calculations to inplace syntax (where possible)
OberGue 648f0d7
Fix: changed name of centering test-function
OberGue f39adeb
Fix: split first instance check and insert f for string
OberGue 46dfb72
Fix: changed error messages semantically
OberGue eee6e36
Fix: changed TypeError to ValueError
OberGue d5d5155
Add: catch division by zero
OberGue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| import gustaf as gus | ||
| import numpy as np | ||
|
|
||
| import splinepy | ||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| ### TRAJECTORY ### | ||
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # define a hook-trajectory | ||
| dict_trajectory = { | ||
| "degrees": [3], | ||
| "knot_vectors": [ | ||
| [0.0, 0.0, 0.0, 0.0, 0.2, 0.4, 0.6, 0.8, 0.9, 1.0, 1.0, 1.0, 1.0] | ||
| ], | ||
| "control_points": np.array( | ||
| [ | ||
| [0.5, 0], | ||
| [0.5, 2], | ||
| [1.0, 3], | ||
| [2.0, 4], | ||
| [2.15, 5], | ||
| [1.8, 5.9], | ||
| [1.0, 6.2], | ||
| [-0.25, 6], | ||
| [-0.5, 5], | ||
| ] | ||
| ), | ||
| } | ||
|
|
||
| # create spline of trajectory dict | ||
| trajectory = splinepy.BSpline(**dict_trajectory) | ||
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # refine trajectory by inserting knots and control points | ||
| trajectory.uniform_refine(0, 1) | ||
|
|
||
| ### CROSS SECTIONS ### | ||
|
|
||
| # 1. create a circular 1D-line-cross-section | ||
| cross_section_circle = splinepy.helpme.create.circle(0.5).nurbs | ||
|
|
||
| # 2. create a circular 2D-surface-cross-section | ||
| cross_section_disk = splinepy.helpme.create.surface_circle(0.5).nurbs | ||
|
|
||
| # 3. create a rectangular 2D-surface-cross-section | ||
| cross_section_plate = splinepy.helpme.create.box(1, 1).nurbs | ||
|
|
||
| # Define a custom normal vector for the cross-section when: | ||
| # a) The cross-section is not planar in the x-y plane, or | ||
| # b) Crooked sweeping is desired | ||
| cs_nv = np.array([1, 0, 1]) | ||
|
|
||
| ### SWEEP ### | ||
|
|
||
| # create swept surface | ||
| swept_surface_circle = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_circle, | ||
| cross_section_normal=None, | ||
| set_on_trajectory=False, | ||
| rotation_adaption=None, | ||
| ) | ||
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # create crooked swept solid (circular nr. 1) | ||
| # the cross-section's normal vector is not default; crooked sweeping | ||
| swept_solid_disk_1 = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_disk, | ||
| cross_section_normal=cs_nv, | ||
| set_on_trajectory=False, | ||
| rotation_adaption=None, | ||
| ) | ||
|
|
||
| # create swept solid (circular nr. 2) | ||
| # the cross-sections are set on the trajectory's control points (default) | ||
| swept_solid_disk_2 = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_disk, | ||
| cross_section_normal=None, | ||
| set_on_trajectory=False, | ||
| rotation_adaption=None, | ||
| ) | ||
|
|
||
| # create swept solid (circular nr. 3) | ||
| # the cross-sections are set on the trajectory's evaluation points | ||
| swept_solid_disk_3 = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_disk, | ||
| cross_section_normal=None, | ||
| set_on_trajectory=True, | ||
| rotation_adaption=None, | ||
| ) | ||
|
|
||
| # create swept solid (rectangular nr. 1) | ||
| swept_solid_plate_1 = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_plate, | ||
| cross_section_normal=None, | ||
| set_on_trajectory=False, | ||
| rotation_adaption=None, | ||
| ) | ||
|
|
||
| # create swept solid (rectangular nr. 2) | ||
| # rotation adaption with 45 degrees | ||
| swept_solid_plate_2 = splinepy.helpme.create.swept( | ||
| trajectory=trajectory, | ||
| cross_section=cross_section_plate, | ||
| cross_section_normal=None, | ||
| set_on_trajectory=False, | ||
| rotation_adaption=45 * np.pi / 180, | ||
| ) | ||
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### VISUALIZATION ### | ||
|
|
||
| # first window: swept surface | ||
| gus.show( | ||
| ["Trajectory", trajectory], | ||
| ["1D Cross Section", cross_section_circle], | ||
| ["Swept Surface", swept_surface_circle], | ||
| resolution=51, | ||
| control_mesh=False, | ||
| control_point_ids=False, | ||
| ) | ||
|
|
||
| # adjust show options | ||
| swept_solid_disk_2.show_options["alpha"] = 0.3 | ||
| swept_solid_disk_3.show_options["alpha"] = 0.3 | ||
| trajectory.show_options["control_points"] = False | ||
OberGue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # second window: swept solids (circular) | ||
| gus.show( | ||
| ["2D Cross Section", cross_section_disk], | ||
| ["Swept Solid - Crooked Sweeping", swept_solid_disk_1], | ||
| [ | ||
| "Swept Solid - Set on Control Points", | ||
| swept_solid_disk_2, | ||
| trajectory, | ||
| ], | ||
| [ | ||
| "Swept Solid - Set on Evaluation Points", | ||
| swept_solid_disk_3, | ||
| trajectory, | ||
| ], | ||
| resolution=51, | ||
| control_mesh=False, | ||
| control_point_ids=False, | ||
| ) | ||
|
|
||
| # third window: swept solids (rectangular) | ||
| gus.show( | ||
| ["New Cross Section", cross_section_plate], | ||
| ["Swept Solid without Rotation", swept_solid_plate_1], | ||
| ["Swept Solid with 45° Rotation", swept_solid_plate_2], | ||
| resolution=51, | ||
| control_mesh=False, | ||
| control_point_ids=False, | ||
| ) | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.