Skip to content

Commit 14c0a2d

Browse files
committed
some checking for symbolically valued quaternions
1 parent 1e27192 commit 14c0a2d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Quaternion.m

+7-3
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,14 @@
146146
%Quaternion.set.v Set vector component
147147
%
148148
% Q.v = V sets the vector part of the Quaternion object to V (1x3).
149-
assert(isvec(v,3), 'SMTB:Quaternion:badarg', 'v must be a real 3-vector');
150-
151149
qo = q;
152-
qo.v = v(:).';
150+
if isa(v, 'symfun')
151+
qo.v = v;
152+
else
153+
assert(isvec(v,3), 'SMTB:Quaternion:badarg', 'v must be a real 3-vector');
154+
155+
qo.v = v(:).';
156+
end
153157
end
154158

155159
% function s = get.s(q)

UnitQuaternion.m

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@
191191
end
192192
elseif nargin == 2 && isscalar(s) && isvec(v,3)
193193
% ensure its a unit quaternion
194+
if isa(v, 'symfun')
195+
v = formula(v);
196+
end
194197
n = norm([s; v(:)]);
195198
uq.s = s/n;
196199
uq.v = v/n;

0 commit comments

Comments
 (0)