This repository was archived by the owner on Jun 18, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 69
Quaternion implementation #461
Merged
Merged
Conversation
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
Codecov Report
@@ Coverage Diff @@
## main #461 +/- ##
==========================================
+ Coverage 85.82% 86.10% +0.27%
==========================================
Files 99 100 +1
Lines 13613 14171 +558
Branches 716 740 +24
==========================================
+ Hits 11684 12202 +518
- Misses 1213 1229 +16
- Partials 716 740 +24
Continue to review full report at Codecov.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Quaternion implementation #461 adds
sicmutils.quaternion
, with a full arithmetic implementation andthe beginnings of a rotation API. Quaternions are implemented like vectors of
length 4, and implement all appropriate Clojure protocols. All arithmetic is
compatible with all scalars and complex numbers.
Accessors:
get-r
,real-part
,get-i
,get-j
,get-k
,complex-1
,complex-2
,->complex-pair
,->vector
,three-vector
Predicates:
real?
,zero?
,one?
,pure?
,unit?
Constants:
ZERO
,ONE
,I
,J
,K
Reader literal
#sicm/quaternion
takes a 4-vector or a single entry.Constructors:
make
,from-complex
,spherical
,semipolar
,multipolar
,cylindrospherical
,cylindrical
More:
arity
,evaluate
,partial-derivative
,magnitude-sq
,normalize
,commutator
Transcendental functions:
exp
log
,cos
,sin
,tan
sinh
,cosh
,tanh
. Many more transcendentals will work, thanks to their defaultimplementations.
Arithmetic and generics:
+
,-
,*
,/
,dot-product
,cross-product
,conjugate
,magnitude
,expt
,sqrt
,simplify
,infinite?
,solve-linear-right
,solve-linear
Rotation-related:
from-angle-normal-axis
,from-angle-axis
,pitch
,roll
,yaw
,->angle-axis