Skip to content
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

Update rotation computation #319

Open
wants to merge 6 commits into
base: update-0.3.3
Choose a base branch
from
Open
Changes from 5 commits
Commits
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
8 changes: 6 additions & 2 deletions elastica/_rotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ def _inv_rotate(director_collection):
)
)

# TODO HARDCODED bugfix has to be changed. Remove 1e-14 tolerance
theta = arccos(0.5 * trace - 0.5 - 1e-10)
# Clip the trace to between -3 and 3.
nmnaughton marked this conversation as resolved.
Show resolved Hide resolved
# Any deviation beyond this is numerical error
trace = min(trace, 3.0)
trace = max(trace, -1.0)
theta = arccos(0.5 * trace - 0.5)

# TODO HARDCODED bugfix has to be changed. Remove 1e-14 tolerance
nmnaughton marked this conversation as resolved.
Show resolved Hide resolved
vector_collection[0, k] *= -0.5 * theta / sin(theta + 1e-14)
vector_collection[1, k] *= -0.5 * theta / sin(theta + 1e-14)
vector_collection[2, k] *= -0.5 * theta / sin(theta + 1e-14)
Expand Down