T,R Plot

RTSX Help: Plot a transformed frame in 3D

trplot

Plot a coordinate frame compared to world frame. Can hold previous frames for comparison.

Syntax

  • trplot(T,options)

Input Arguments

  • T  — a   4 x 4 homogeneous transformation matrix

Output Arguments

  • none.

Options

Note : options in [ ] must be passed to the function in pairs.

  • ‘world’ — plot world coordinate for comparison
  • ‘grid’ — show grid
  • ‘hold’ — hold frames from previous plots. Must use with ‘figure’ option to plot on the same figure
  • [ ‘figure’, fnum] — command the plot to a particular window indicated by fnum
  • [ ‘color’, ‘(your choice)’] — plot in a particular color. Choices are ‘black’, ‘blue’, ‘green’, ‘cyan’, ‘red’, ‘purple’, ‘yellow’, ‘white’
  • [ ‘linestyle’,'(your choice)’] — plot in a particular line style. Choices are ‘solid’ (‘-‘), ‘dash’ (‘–‘), ‘dash dot’ (‘-.’), ‘longdash dot’ (‘–.’), ‘bigdash dot’ (‘=.’), ‘bigdash longdash’ (‘=–‘), ‘dot’ (‘.’), ‘double dot’ (‘..’)

Description

trplot( ) is a simple graphic function that can be used as quick visual check for a transformed coordinate frame compared with world frame, or a couple of transformations compared together. It is best used to compare rotated frame at the origin. When it is used with a frame translated far away from the orign, the function may have difficulty scaling the axes, especially when previous plots are held by ‘hold’ option. Using PlotFrame( ) is recommended for a chain of frames involving both rotation and translation.

Examples

Try the following commands to see the response.

T=trotx(pi/2);  // rotate pi/2 about X axis
trplot(T);	// plot without world frame
trplot(T,'world','grid');	// plot together with world frame and grid
trplot(T,'figure',1,'color','blue','linestyle','-.');  // plot a dash-dot, blue frame in graphic window no 1
T2=trotz(pi/4);   // make another frame rotated pi/4 about Z axis
trplot(T2,'figure', 1, 'hold', 'color','yellow', 'linestyle', '.'); // compare a new dotted, yellow frame with previous

Suppose you want to see the resulting frames from the following steps:

  1. rotate 45 degree about Y axis
  2. rotate 30 degree about current Z axis

Issuing these commands

T1= troty(45,'deg');	// first rotation
trplot(T1,'world','figure',1,'color','green','linestyle','.');   // plot first frame in dotted green
T2 = T1*trotz(30,'deg');	// combined rotation of step 1 and 2
trplot(T2,'figure',1,'color','red','hold');  // hold previous frame and plot second frame in red

yields the plot shown in Figure 1 below. The first frame is shown in dotted green and second frame in solid red. Verify that they correspond correctly to the combined rotation steps above.


Figure 1: combined rotation example with trplot( )

See Also

  • PlotFrame — plot frames in a trasformation chain