Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mrdna
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tbgl
tools
mrdna
Commits
b37c4817
Commit
b37c4817
authored
6 years ago
by
cmaffeo2
Browse files
Options
Downloads
Patches
Plain Diff
Updated initial placement of orientation beads
parent
87fc5b22
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
segmentmodel.py
+16
-8
16 additions, 8 deletions
segmentmodel.py
with
16 additions
and
8 deletions
segmentmodel.py
+
16
−
8
View file @
b37c4817
...
@@ -394,15 +394,23 @@ class Segment(ConnectableElement, Group):
...
@@ -394,15 +394,23 @@ class Segment(ConnectableElement, Group):
def
contour_to_orientation
(
self
,
s
):
def
contour_to_orientation
(
self
,
s
):
assert
(
isinstance
(
s
,
float
)
or
isinstance
(
s
,
int
)
or
len
(
s
)
==
1
)
# TODO make vectorized version
assert
(
isinstance
(
s
,
float
)
or
isinstance
(
s
,
int
)
or
len
(
s
)
==
1
)
# TODO make vectorized version
orientation
=
None
orientation
=
None
if
self
.
start_orientation
is
not
None
:
if
self
.
quaternion_spline_params
is
None
:
# axis = self.start_orientation.dot( np.array((0,0,1)) )
axis
=
self
.
contour_to_tangent
(
s
)
if
self
.
quaternion_spline_params
is
None
:
axis
=
axis
/
np
.
linalg
.
norm
(
axis
)
axis
=
self
.
contour_to_tangent
(
s
)
rotAxis
=
np
.
cross
(
axis
,
np
.
array
((
0
,
0
,
1
)))
orientation
=
rotationAboutAxis
(
axis
,
self
.
twist_per_nt
*
self
.
contour_to_nt_pos
(
s
),
normalizeAxis
=
True
)
rotAxisL
=
np
.
linalg
.
norm
(
rotAxis
)
theta
=
np
.
arcsin
(
rotAxisL
)
if
rotAxisL
>
0.001
:
orientation0
=
rotationAboutAxis
(
rotAxis
/
rotAxisL
,
theta
*
180
/
np
.
pi
,
normalizeAxis
=
False
)
else
:
else
:
q
=
interpolate
.
splev
(
s
,
self
.
quaternion_spline_params
)
orientation0
=
np
.
eye
(
3
)
if
len
(
q
)
>
1
:
q
=
np
.
array
(
q
).
T
# TODO: is this needed?
orientation
=
rotationAboutAxis
(
axis
,
self
.
twist_per_nt
*
self
.
contour_to_nt_pos
(
s
),
normalizeAxis
=
False
)
orientation
=
quaternion_to_matrix
(
q
)
orientation
=
orientation
.
dot
(
orientation0
)
else
:
q
=
interpolate
.
splev
(
s
,
self
.
quaternion_spline_params
)
if
len
(
q
)
>
1
:
q
=
np
.
array
(
q
).
T
# TODO: is this needed?
orientation
=
quaternion_to_matrix
(
q
)
return
orientation
return
orientation
def
get_contour_sorted_connections_and_locations
(
self
,
type_
):
def
get_contour_sorted_connections_and_locations
(
self
,
type_
):
...
...
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