Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
3
3DES-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Camille Chapeland
3DES-project
Commits
5c08ca52
Commit
5c08ca52
authored
1 year ago
by
Camille Chapeland
Browse files
Options
Downloads
Patches
Plain Diff
added rotate_curve function which was still in the notebook files to the utils/function.py
parent
23d68e30
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Error analysis
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils/functions.py
+23
-0
23 additions, 0 deletions
utils/functions.py
with
23 additions
and
0 deletions
utils/functions.py
+
23
−
0
View file @
5c08ca52
...
...
@@ -3,6 +3,8 @@ import pandas as pd
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
scipy.interpolate
import
CubicSpline
from
scipy.spatial.transform
import
Rotation
as
R
'''
This file contains the functions required for running the shape sensing notebooks.
...
...
@@ -279,3 +281,24 @@ def path_info(P, name):
print
(
"
Shape of
"
,
name
,
P
.
shape
,
"
with physical length
"
,
P_length
)
return
def
rotate_curve
(
Curve
):
# Extract last point of curve
last_point
=
Curve
[
-
1
]
# Define last point constrained at z=0
rotated_last_point
=
np
.
array
([
last_point
[
0
],
last_point
[
1
],
0
])
# Compute the angle between both vectors
unit_vector_1
=
last_point
/
np
.
linalg
.
norm
(
last_point
)
unit_vector_2
=
rotated_last_point
/
np
.
linalg
.
norm
(
rotated_last_point
)
dot_product
=
np
.
dot
(
unit_vector_1
,
unit_vector_2
)
angle
=
np
.
arccos
(
dot_product
)
# Rotate the entire curve by the angle
r
=
R
.
from_euler
(
'
y
'
,
angle
)
rotated_curve
=
r
.
apply
(
Curve
)
return
rotated_curve
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment