Rodrigues’ rotation formula: Difference between revisions

m
→‎{{header|Raku}}: more cosmetic twiddles
m (→‎{{header|Raku}}: rearrange terms to be more symmetrical (strictly cosmetic))
m (→‎{{header|Raku}}: more cosmetic twiddles)
Line 635:
}
 
put qq:to/ENDTESTING/;
put "Task example - Point and composite axis / angle:\n" ~
{ point-vector [5, -6, 4], [8, 5, -30]; }
 
Perhaps more useful, (when calculating a range of motion for a robot appendage,
put qq:to/END/;
for example), feeding a point, axis of rotation and rotation angle separately;
since theoretically, the point vector and axis of rotation should be constant:
 
{
Perhaps more useful, (when calculating a range of motion for a robot appendage,
for (0, 10, 20 ... 180).map( { # in degrees
for example), feeding a point, axis of rotation and rotation angle separately;
printfsprintf "Rotated %3d°: %.13f, %.13f, %.13f\n", $_,
since theoretically, the point vector and axis of rotation should be constant:
END
 
for 0, 10, 20 ... 180 { # in degrees
printf "Rotated %3d°: %.13f, %.13f, %.13f\n", $_,
rodrigues-rotate [5, -6, 4], ([5, -6, 4] ❌ [8, 5, -30]).&normal, .°
}).join: "\n"
}</lang>
}
}TESTING</lang>
{{out}}
<pre>Task example - Point and composite axis / angle:
10,327

edits