VectorSampleCommands.html   (MotionGenesis input/output).
   (1) % MotionGenesis file:  VectorSampleCommands.txt
   (2) %---------------------------------------------------
   (3) % Multiply 2 by the zero vector and assign the result.
   (4) twoTimesZeroVector> = 2 * 0>
-> (5) twoTimesZeroVector> = 0>

   (6) % Create sets of right-handed orthogonal unit vectors:
   (7) % Ax>, Ay>, Az>  fixed in a reference frame A, and
   (8) % Bx>, By>, Bz>  fixed in a rigid body B.
   (9) RigidFrame A
   (10) RigidBody  B
   (11) % Define other vectors in terms of these unit vectors.
   (12) v> = 2*Ax> + 3*Ay> + 4*Az>
-> (13) v> = 2*Ax> + 3*Ay> + 4*Az>

   (14) w> = Vector( A, 6, 7, 8 )
-> (15) w> = 6*Ax> + 7*Ay> + 8*Az>

   (16) F> = Vector( B, [3, 5, 7] )
-> (17) F> = 3*Bx> + 5*By> + 7*Bz>

   (18) % Multiply the vector v> by 5.
   (19) vFive> = 5 * v>
-> (20) vFive> = 10*Ax> + 15*Ay> + 20*Az>

   (21) % Add vectors v> and w>.
   (22) addVW> = v> + w>
-> (23) addVW> = 8*Ax> + 10*Ay> + 12*Az>

   (24) % Dot-multiply  v>  with  w>.
   (25) dotVW = Dot( v>, w> )
-> (26) dotVW = 65

   (27) % Cross-multiply  v>  with  w>  and form  w> x (w> x v>).
   (28) crossVW> = Cross( w>, v> )
-> (29) crossVW> = 4*Ax> - 8*Ay> + 4*Az>

   (30) crossWWV> = Cross( w>, Cross(w>,v>) )
-> (31) crossWWV> = 92*Ax> + 8*Ay> - 76*Az>

   (32) % Find the magnitude and magnitude-squared of v>.
   (33) magV = GetMagnitude( v> )
-> (34) magV = 5.385165

   (35) magVSquared = GetMagnitudeSquared( v> )
-> (36) magVSquared = 29

   (37) % Form the unit vector in the direction of v>.
   (38) unitV> = GetUnitVector( v> )
-> (39) unitV> = 0.3713907*Ax> + 0.557086*Ay> + 0.7427814*Az>

   (40) % Find the radian-measure of the angle between v> and w>.
   (41) angleBetweenVW = GetAngleBetweenVectors( v>, w> )
-> (42) angleBetweenVW = 0.1496115

   (43) % Form the ordinary time-derivative of the vector  t*v> + sin(t)*w>  in reference frame A.
   (44) vectorDerivative> = Dt( t*v> + sin(t)*w>, A  )
-> (45) vectorDerivative> = (2+6*cos(t))*Ax> + (3+7*cos(t))*Ay> + (4+8*cos(t))*Az>

   (46) % Form a rotation matrix relating  Bx>, By>, Bz>  to  Ax>, Ay>, Az>  in terms of time t.
   (47) B.RotateZ( A, t )
-> (48) B_A = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]
-> (49) w_B_A> = Bz>
-> (50) alf_B_A> = 0>

   (51) % Express vector v> in terms of Bx>, By>, Bz>.
   (52) Express( v>, B )
-> (53) v> = (2*cos(t)+3*sin(t))*Bx> + (3*cos(t)-2*sin(t))*By> + 4*Bz>

   (54) % To express vector  v> + F>  in terms of  Ax>, Ay>, Az>,  type
   (55) sumInTermsOfA> = Express( v> + F>,  A )
-> (56) sumInTermsOfA> = (2*sin(t)*(-2.5+sin(t))+2*cos(t)*(1.5+cos(t)))*Ax>
        + (3*sin(t)*(1+sin(t))+3*cos(t)*(1.666667+cos(t)))*Ay> + 11*Az>

   (57) % Form the  Bx>, By>, Bz>  measures of w> (without changing w>).
   (58) wMatrix = Vector( B, w> )
-> (59) wMatrix = [6*cos(t) + 7*sin(t);  7*cos(t) - 6*sin(t);  8]

   (60) % Save input and output responses.
Saved by Motion Genesis LLC.   Command names and syntax: Copyright (c) 2009-2021 Motion Genesis LLC. All rights reserved.