We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f222bec commit 72e9a22Copy full SHA for 72e9a22
UnitQuaternion.m
@@ -195,6 +195,11 @@
195
v = formula(v);
196
end
197
n = norm([s; v(:)]);
198
+ if s < 0
199
+ % enforce non-negative scalar
200
+ s = -s;
201
+ v = -v;
202
+ end
203
uq.s = s/n;
204
uq.v = v/n;
205
elseif isvec(s,4)
@@ -203,6 +208,10 @@
208
if ~isa(s, 'sym')
209
s = unit(s);
210
211
+ if s(1) < 0
212
213
214
206
215
uq.s = s(1);
207
216
uq.v = s(2:4);
217
else
@@ -1189,6 +1198,7 @@ function animate(Q, varargin)
1189
1198
uq = UnitQuaternion(s, qv);
1190
1199
1191
1200
1201
+
1192
1202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193
1203
%%%% OTHER STATIC METHODS, ALTERNATIVE CONSTRUCTORS
1194
1204
0 commit comments