Example for using the rotation group manifold SO3.
#include <gomath.h>
#include <goplot.h>
#include <gorandom.h>
template<class T>
void plot_tripod (
goSinglePlot& p, goMatrix<T>& R,
int style_offset)
{
o.fill(0.0);
for (goIndex_t i = 0; i < 3; ++i)
{
R.refRow (i, r);
goString cmd =
"w l ls "; cmd += int(i) + style_offset;
p.
addLine (r, o,
"", cmd.
toCharPtr());
}
}
int main ()
{
w[0] = 1.0; w[1] = 0.0; w[2] = 0.0;
w *= M_PI * 0.5;
goMatrixf R1;
w[0] = 1.0; w[1] = 1.0; w[2] = 2.0;
w *= M_PI;
goMatrixf R2;
so3.matrix (w, R2);
R1.print();
R2.print();
set style line 1 lw 4 lt 1 lc rgb 'red'\n\
set style line 2 lw 4 lt 1 lc rgb 'green'\n\
set style line 3 lw 4 lt 1 lc rgb 'blue'\n\
set style line 4 lw 1 lt 1 lc rgb 'red'\n\
set style line 5 lw 1 lt 1 lc rgb 'green'\n\
set style line 6 lw 1 lt 1 lc rgb 'blue'\n\
set mouse\n";
mp.setPrefix (prefix);
plot_tripod (
plot, R1, 4);
plot_tripod (
plot, R2, 1);
(R1*R1.getTranspose()).print();
(R2*R2.getTranspose()).print();
for (goIndex_t i = 0; i < 10; ++i)
{
goFloat t = float(i) / 9.0;
plot_tripod (
plot, R, 4);
mp.clear();
mp.setPrefix (prefix);
mp.setPostfix ("pause mouse\n");
mp.plot(&gp);
}
exit (1);
}