Skip to content
Open
Show file tree
Hide file tree
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 Apr 18, 2024
f99202c
Add: first kinda swept surface implementation in show_swept-file
OberGue Apr 29, 2024
bf4a2a4
Fix: Moved computation from show_swept-file to create-file
OberGue May 2, 2024
03f2a94
Add: function for transformation matrix
OberGue May 2, 2024
0dfd431
Add: show_options changed in show_swept-file
OberGue May 2, 2024
250fe0b
Add: positioning of cross-section control points
OberGue May 6, 2024
c800030
Fix: now, evaluation-points are fitted instead of CPs
OberGue May 6, 2024
119b913
Add: rotation matrix and centered cross section
OberGue May 7, 2024
95fa2cb
Fix: getting fitting flexible for CS eval points; Note: WIP
OberGue May 7, 2024
f6e0ac2
Add: Transformation matrix now with projection; Note: WIP
OberGue May 14, 2024
31cc929
Fix: calculation of transformation matrix - still working on projecti…
OberGue May 15, 2024
e7b68b0
minor clean up during discussion
j042 May 21, 2024
1661aaa
Fix: create-file transformation matrices now calculated once; rotatio…
OberGue May 22, 2024
91ae3a6
Fix: changed arbitrary vector vec and rotation matrix in create-file;…
OberGue May 22, 2024
5d334b6
Fix: random vector vec now dependent of tangent
OberGue May 23, 2024
03b4f70
Add: new function in fit.py-file; Fix: adaptions in create.py-file ac…
OberGue Jun 9, 2024
b8839db
Fix: pre-commit changes
OberGue Jun 9, 2024
bf6097b
Add: changed show-settings to better possibility of comparison
OberGue Jun 12, 2024
eb67c22
Big update; Add: nurbs, traj refinement; Del: fitting routine
OberGue Jun 12, 2024
ec53430
Fix: calculation of rotation matrix
OberGue Jun 19, 2024
1864586
Add: refinement routine; Fix: no more derivative redundance
OberGue Jun 20, 2024
1051648
Fix: no more global splinepy import
OberGue Jun 27, 2024
bc777de
Add: self-refinement now working; added function in bspline.py (note:…
OberGue Jul 1, 2024
3ee93db
Add: function for closed trajectories
OberGue Jul 2, 2024
cfe52dd
Add: some checks were added
OberGue Jul 2, 2024
9bf2f5a
Add: reference to nurbs book
OberGue Jul 2, 2024
fdf2bfc
Add: auto_refinement variable
OberGue Jul 2, 2024
8958cff
Fix: positioning of cs-cps now acc to traj-cps; Fix: auto_refinement …
OberGue Jul 2, 2024
f45523d
Add: test functions in create-test-file
OberGue Jul 2, 2024
4188eb8
Rm: removed unnecessary insertion function in bspline.py
OberGue Jul 3, 2024
e0f28d0
Add: opportunity to set cross-sec CPs on traj eval points or traj CPs
OberGue Jul 3, 2024
e4dca0b
Add: swept description; Fix: using settings.TOLERANCE
OberGue Jul 3, 2024
100d929
Fix: get rid of x,y,z
OberGue Jul 3, 2024
1b5bbab
Fix: embedded calc of transf matrices in normal code - without functi…
OberGue Jul 3, 2024
ad48986
Add: debug log at cs_normal_vector
OberGue Jul 3, 2024
ff7f611
Add: debug log for B division by zero
OberGue Jul 3, 2024
578a2ed
Add: functionality to rotate cross_section around traj-tangent-vector
OberGue Jul 8, 2024
a3bf642
Add: test function to compare swept and extruded
OberGue Jul 8, 2024
1401fe4
Add: test_swept_with_costum_normal now with derivative check
OberGue Jul 8, 2024
a99724f
Rm: auto_refinement; Rm: clean up show_swept file
OberGue Jul 10, 2024
4773cb3
Fix: new test functions
OberGue Jul 12, 2024
c3ba46f
Rm: german comment
OberGue Jul 12, 2024
d7bdb0f
Add: capabilities of sweeping in the docstring
OberGue Jul 12, 2024
29eed97
Fix: changed indentation in docstring
OberGue Jul 12, 2024
c229871
Fix: added points in docstring
OberGue Jul 12, 2024
f3097a1
Add: show_swept-file now shows more examples
OberGue Sep 9, 2024
50cee92
Rm: .all()-function in test_create-file
OberGue Sep 10, 2024
52de258
Fix: show_options and variable names in show_swept
OberGue Sep 11, 2024
0d32b17
Fix: changed comments of cs_nv
OberGue Sep 16, 2024
9b39767
Add: assertions and comments in test_basic_functionality-function in …
OberGue Sep 16, 2024
0e08f5b
Fix: error messages in create-file
OberGue Sep 16, 2024
01cfca0
Fix: clarified error messages at input checks of create-file
OberGue Sep 16, 2024
29194bd
Fix: rotation matrix calculation now also for e2 entries
OberGue Sep 17, 2024
9115a39
Add: catch division by zero in trajectory-tangent calculation
OberGue Nov 8, 2024
1860c07
Fix: input checks now with spline-instance; Add: casting of rotation_…
OberGue Nov 8, 2024
1536702
Add: temporal variable in order to avoid multiple cross-product-calcu…
OberGue Nov 8, 2024
75c9b40
Fix: changed vector calculations to inplace syntax (where possible)
OberGue Nov 8, 2024
648f0d7
Fix: changed name of centering test-function
OberGue Nov 8, 2024
f39adeb
Fix: split first instance check and insert f for string
OberGue Nov 8, 2024
46dfb72
Fix: changed error messages semantically
OberGue Nov 8, 2024
eee6e36
Fix: changed TypeError to ValueError
OberGue Nov 8, 2024
d5d5155
Add: catch division by zero
OberGue Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions examples/show_swept.py
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 ###

# 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)

# 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,
)

# 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,
)

### 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

# 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,
)
1 change: 0 additions & 1 deletion splinepy/bspline.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ def remove_knots(self, parametric_dimension, knots, tolerance=None):

self._logd(f"Tried to remove {len(knots)} knot(s).")
self._logd(f"Actually removed {sum(removed)} knot(s).")

return removed

def normalize_knot_vectors(self):
Expand Down
Loading
Loading