# Plotting SE(3) points in a 3D graph

I have a data-set containing points in SE(3), i.e the 4 $\times$ 4 transformation matrices and the corresponding dual quaternions. Now, I want to plot these points in a 3D graph. How to generate this plot?

• What do you intend to see from the generated graph? – Petch Puttichai Mar 15 '18 at 10:14
• I am about to perform a classification of the points using Support Vector Machines. So before doing that, I just wanted to have an intuition about the points in the space (so that it gives me an idea for choosing the input features and the kernel). – Riddhiman Laha Mar 15 '18 at 18:44
• I think while plotting those points just for the sake of visualization is fine, it would not be so useful if you want it to give you some intuition of how you should classify the points. Since a point in $SE(3)$ needs 6 coordinates, to actually plot it you need some kind of projection. And I think what kind of plot and what kind of intuition you get are pretty much dependent on the choice of projection function. – Petch Puttichai Mar 16 '18 at 7:43
• @PetchPuttichai What kind of projection function do you think would be suitable for my purpose ? – Riddhiman Laha Mar 16 '18 at 22:07
• Well, I don't really know. A natural choice seems to be decoupling rotation and translation as the answer suggested. But whether or not it suits your purpose, you just need to try it out. – Petch Puttichai Mar 17 '18 at 7:58

## 3 Answers

A point in SE(3) has six degrees of freedom, so the three DOF's in a 3D plot would not be sufficient to capture this. I would split it up into two 3D plots. One of them would be quite straight forward, namely just plot the 3D position vector. The other plot should capture the information of the attitude part. There are multiple ways of representing this in 3D, such as Euler angles or axis angle representation, where the axis is of unit length and then scaled that by the angle. I myself would prefer the last one.

If your SE(3) is represented as a 4 by 4 matrix

$$M = \begin{bmatrix} R & p \\ 0 & 1 \end{bmatrix}$$

with $R\in\mathbb{R}^{3\times3}$ a rotation matrix and $p\in\mathbb{R}^{3}$ the position vector. So the position vector $p$ is straight forward to extract. The axis angle information can be extracted from $R$ after some calculations

$$\theta = \cos^{-1}\left(\frac{\mathrm{Tr}(R)-1}{2}\right)$$

$$\begin{bmatrix} 0 & -v_3 & v_2 \\ v_3 & 0 & -v_1 \\ -v_2 & v_1 & 0 \end{bmatrix} = \frac{R - R^\top}{2\,\sin\theta}$$

An alternative visualization would be to draw coordinate axes in the 3D plot to represent each SE(3) point. Provided you have a way to view 3D graphs, this allows the points to be all viewed without projecting down to a lower-dimensional space. e.g., you can do this in Matlab with the drawframe function from Brad Kradochvil's kinematics toolbox. It draws an arrow of a different color for the X, Y, and Z axes.

Or you can use the trplot() function from my Robotics Toolbox for MATLAB